"use client"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { useEffect, useState } from "react"; import { Award, BarChart3, Beaker, BookOpen, Bot, Calendar, Clock, FlaskConical, GitBranch, Globe, Inbox, Layers, Mail, Mic, RefreshCw, Route, Search, Settings2, Telescope, Workflow, Zap, } from "lucide-react"; const navGroups = [ { label: "Now", items: [ { href: "/today", label: "Today", icon: Calendar }, { href: "/inbox", label: "Inbox", icon: Inbox }, ], }, { label: "Discover", items: [ { href: "/frontrunner", label: "Frontrunner", icon: Telescope }, { href: "/leaders", label: "Leaders", icon: Globe }, ], }, { label: "Lab", items: [ { href: "/foundry", label: "Foundry", icon: FlaskConical }, { href: "/experiment", label: "Experiment", icon: Beaker }, { href: "/process-lab", label: "Process", icon: Workflow }, { href: "/email-lab", label: "Email Lab", icon: Mail }, ], }, { label: "Evolve", items: [ { href: "/spin-lifecycle", label: "Lifecycle", icon: RefreshCw }, { href: "/spinor-rl", label: "SPINOR-RL", icon: GitBranch }, { href: "/golden-nodes", label: "Golden Nodes", icon: Award }, ], }, { label: "Operate", items: [ { href: "/results", label: "Results", icon: BarChart3 }, { href: "/autopilot", label: "Autopilot", icon: Bot }, { href: "/voice-demo", label: "Voice", icon: Mic }, ], }, { label: "Reference", items: [ { href: "/diary", label: "Diary", icon: BookOpen }, { href: "/history", label: "History", icon: Clock }, { href: "/learnings", label: "Learnings", icon: Route }, { href: "/discovery-ledger", label: "Ledger", icon: BarChart3 }, ], }, ]; export function GameNav() { const pathname = usePathname() ?? ""; const [llmStatus, setLlmStatus] = useState<"live" | "offline" | "checking">("checking"); const [mobileOpen, setMobileOpen] = useState(false); useEffect(() => { let cancelled = false; async function checkLLM() { try { const res = await fetch("/api/health", { cache: "no-store" }); const data = await res.json(); const llmOk = data.checks?.config?.ok || data.checks?.analysis?.ok; if (!cancelled) setLlmStatus(llmOk ? "live" : "offline"); } catch { if (!cancelled) setLlmStatus("offline"); } } checkLLM(); const interval = setInterval(checkLLM, 30000); return () => { cancelled = true; clearInterval(interval); }; }, []); const statusDot = llmStatus === "live" ? "bg-emerald-400" : llmStatus === "offline" ? "bg-red-400" : "bg-amber-400"; const statusText = llmStatus === "live" ? "Live" : llmStatus === "offline" ? "Offline" : "Checking"; const isActive = (href: string) => pathname === href || pathname.startsWith(href + "/"); return (
{/* Logo */}

SPINOR Foundry

Missing-layer product system

{/* Desktop Nav */}
{/* Search trigger */} {/* Voice trigger */} {/* Settings */} {/* LLM status */}
{statusText}
{/* Mobile menu toggle */}
{/* Mobile Nav */} {mobileOpen && (
{navGroups.flatMap((g) => g.items).map((item) => { const Icon = item.icon; const active = isActive(item.href); return ( setMobileOpen(false)} className={`flex items-center gap-2 rounded-lg px-3 py-2.5 text-xs font-medium transition-colors ${ active ? "bg-primary/10 text-primary" : "text-muted-foreground hover:bg-muted/50" }`} > {item.label} ); })}
)}
); }