diff --git a/apps/web/src/app/layout.tsx b/apps/web/src/app/layout.tsx index b02ce4b..d3e21ee 100644 --- a/apps/web/src/app/layout.tsx +++ b/apps/web/src/app/layout.tsx @@ -5,6 +5,7 @@ import Script from "next/script"; import { Footer } from "@profullstack/footer/react"; import { WebMcpProvider } from "@/components/webmcp-provider"; import { PitFooter } from "@/components/pit-footer"; +import { SiteNav } from "@/components/site-nav"; const SITE = "https://c0mpute.com"; const DESCRIPTION = @@ -55,24 +56,7 @@ export default function RootLayout({
- +
{children}
diff --git a/apps/web/src/components/site-nav.tsx b/apps/web/src/components/site-nav.tsx new file mode 100644 index 0000000..badca03 --- /dev/null +++ b/apps/web/src/components/site-nav.tsx @@ -0,0 +1,62 @@ +"use client"; + +import Link from "next/link"; +import { usePathname } from "next/navigation"; +import { useEffect, useRef } from "react"; + +const LINKS: { href: string; label: string; accent?: boolean }[] = [ + { href: "/getting-started", label: "getting-started" }, + { href: "/protocol", label: "protocol" }, + { href: "/providers", label: "run a node", accent: true }, + { href: "/nodes", label: "nodes" }, + { href: "/agents", label: "agents" }, + { href: "/plugins", label: "plugins" }, + { href: "/docs", label: "docs" }, + { href: "/status", label: "status" }, +]; + +// One row on desktop; below lg the links fold into a
menu, which works +// without JS. The effect only closes it again after a client-side navigation. +export function SiteNav() { + const pathname = usePathname(); + const menu = useRef(null); + useEffect(() => { + if (menu.current) menu.current.open = false; + }, [pathname]); + + const linkClass = (accent?: boolean) => + `!border-0 whitespace-nowrap hover:text-[var(--color-accent)] ${accent ? "accent" : ""}`; + + return ( + + ); +}