diff --git a/website/next.config.ts b/website/next.config.ts index e9ffa30..66440d0 100644 --- a/website/next.config.ts +++ b/website/next.config.ts @@ -1,7 +1,10 @@ import type { NextConfig } from "next"; +import pkg from "../packages/smooth-api-ts/package.json"; const nextConfig: NextConfig = { - /* config options here */ + env: { + NEXT_PUBLIC_TS_PKG_VERSION: pkg.version, + }, }; export default nextConfig; diff --git a/website/src/app/page.tsx b/website/src/app/page.tsx index 9f622ae..26c9c37 100644 --- a/website/src/app/page.tsx +++ b/website/src/app/page.tsx @@ -30,6 +30,18 @@ type SimLog = { export default function Home() { const [activeSection, setActiveSection] = useState("introduction"); const [codeLang, setCodeLang] = useState<"ts" | "py">("ts"); + const [githubStars, setGithubStars] = useState(null); + + useEffect(() => { + fetch("https://api.github.com/repos/AryanSharma48/smoothAPI") + .then((res) => res.json()) + .then((data) => { + if (typeof data.stargazers_count === "number") { + setGithubStars(data.stargazers_count); + } + }) + .catch((err) => console.error("Failed to fetch github stars:", err)); + }, []); /* // Simulator States @@ -164,14 +176,28 @@ export default function Home() {
{/* STICKY HEADER */} -
+
window.scrollTo({ top: 0, behavior: "smooth" })}> - SmoothAPI Logo + SmoothAPI Logo
- v1.0.0 - + v{process.env.NEXT_PUBLIC_TS_PKG_VERSION || "1.0.0"} + + + how about a star? + + + + + {githubStars !== null && ( + + + + + {githubStars.toLocaleString()} + + )}