Skip to content

Commit ac922cd

Browse files
committed
added google analytics and also changed teh url of main page
1 parent dccf9e2 commit ac922cd

File tree

6 files changed

+77
-8
lines changed

6 files changed

+77
-8
lines changed

install.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
# ===============================
3+
# Codekub Installer (Bootstrap)
4+
# ===============================
5+
6+
# URL to fetch the full installer from GitHub
7+
INSTALL_URL="https://raw.githubusercontent.com/CodeCompasss/codekub/main/boot.sh"
8+
9+
echo "============================="
10+
echo " Installing Codekub "
11+
echo "============================="
12+
13+
# Use curl or wget
14+
if command -v curl >/dev/null 2>&1; then
15+
echo "Downloading installer via curl..."
16+
curl -fsSL "$INSTALL_URL" | bash
17+
elif command -v wget >/dev/null 2>&1; then
18+
echo "Downloading installer via wget..."
19+
wget -qO- "$INSTALL_URL" | bash
20+
else
21+
echo "Error: Neither curl nor wget is installed."
22+
exit 1
23+
fi
24+
25+
echo "Installation finished!"

package-lock.json

Lines changed: 14 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
},
2525
"dependencies": {
2626
"next": "15.5.2",
27+
"nextjs-google-analytics": "^2.3.7",
2728
"pino": "^9.9.0",
2829
"prom-client": "^15.1.3",
2930
"react": "19.1.0",

src/app/layout.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Geist, Geist_Mono } from "next/font/google";
33
import "./globals.css";
44
import Script from "next/script";
55
import { jsonLd } from "@/lib/metadata";
6+
import GoogleAnalytics from "@/components/GoogleAnalytics";
67

78
const geistSans = Geist({
89
variable: "--font-geist-sans",
@@ -47,6 +48,7 @@ export default function RootLayout({
4748
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
4849
>
4950
{children}
51+
<GoogleAnalytics />
5052
</body>
5153
</html>
5254
);

src/app/page.tsx

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
1+
"use client"; // needed for React hooks in Next.js app router
2+
import { useState } from "react";
3+
14
export default function Home() {
5+
const [copied, setCopied] = useState(false);
6+
const installCommand =
7+
"curl -sSL https://codekub-website.codecompass2024.workers.dev/install | bash";
8+
9+
const handleCopy = () => {
10+
navigator.clipboard.writeText(installCommand);
11+
setCopied(true);
12+
setTimeout(() => setCopied(false), 2000); // reset after 2 seconds
13+
};
14+
215
return (
316
<main className="min-h-screen bg-gradient-to-b from-[#0e0f1a] to-[#0b0c14] text-slate-200 flex flex-col items-center px-6">
4-
517
{/* Header */}
618
<section className="mt-24 text-center max-w-3xl">
719
<h1 className="text-5xl font-bold tracking-tight text-green-400">
@@ -17,10 +29,14 @@ export default function Home() {
1729
</p>
1830

1931
{/* Install Command */}
20-
<div className="mt-8 bg-[#151728] border border-slate-700 rounded-lg px-5 py-3 font-mono text-sm text-slate-300 inline-flex items-center gap-3">
21-
<span>
22-
curl -sSL https://raw.githubusercontent.com/CodeCompasss/codekub/main/boot.sh | bash
23-
</span>
32+
<div className="mt-8 flex items-center gap-2 bg-[#151728] border border-slate-700 rounded-lg px-5 py-3 font-mono text-sm text-slate-300">
33+
<span className="flex-1 break-all">{installCommand}</span>
34+
<button
35+
onClick={handleCopy}
36+
className="ml-2 px-3 py-1 rounded bg-green-500/30 hover:bg-green-500/50 text-green-300 transition text-sm"
37+
>
38+
{copied ? "Copied ✅" : "Copy"}
39+
</button>
2440
</div>
2541

2642
{/* Manual Button */}
@@ -60,10 +76,9 @@ export default function Home() {
6076
<footer className="mt-24 mb-10 text-center text-slate-500 text-sm">
6177
<p>Brought to you by</p>
6278
<a href="https://code-compass-website.vercel.app/">
63-
<p className="mt-1 font-semibold text-slate-300">CodeCompass</p>
79+
<p className="mt-1 font-semibold text-slate-300">CodeCompass</p>
6480
</a>
6581
</footer>
66-
6782
</main>
6883
);
6984
}

src/components/GoogleAnalytics.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"use client";
2+
3+
import { GoogleAnalytics as GAComponent } from "nextjs-google-analytics";
4+
5+
export default function GoogleAnalytics() {
6+
return (
7+
<GAComponent
8+
trackPageViews
9+
gaMeasurementId="G-Z6GERH4RW8"
10+
debugMode={false}
11+
/>
12+
);
13+
}

0 commit comments

Comments
 (0)