"use client" import { useEffect, useState } from "react" import { useAudienceMode } from "@/components/audience-mode-provider" import { Eye, Menu, Moon, Sun, X } from "lucide-react" import { useTheme } from "next-themes" import Link from "next/link" import { usePathname } from "next/navigation" import { cn } from "@/lib/utils" import { fetchBackendManifest } from "@/lib/dashboard-data-client" function formatSnapshotDate(value: string | null | undefined): string | null { if (!value) return null const date = new Date(value) if (Number.isNaN(date.getTime())) return null return date.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric", }) } export function Navigation() { const { theme, setTheme } = useTheme() const { mode, setMode } = useAudienceMode() const pathname = usePathname() const [mobileOpen, setMobileOpen] = useState(false) const navItems = [ { href: "/", label: "Overview", isActive: pathname === "/", }, { href: "/models", label: "Models", isActive: pathname === "/models" || pathname?.startsWith("/models/") || pathname?.startsWith("/developers/"), }, { href: "/evals", label: "Evaluations", isActive: pathname === "/evals" || pathname?.startsWith("/evals/"), }, { href: "/about", label: "About", isActive: pathname === "/about", }, ] useEffect(() => { setMobileOpen(false) }, [pathname]) return ( <> Eval Cards Beta · EvalEval {navItems.map((item) => ( {item.label} ))} setMode("policy")} > Policy setMode("research")} > Research setTheme(theme === "dark" ? "light" : "dark")} aria-label="Toggle theme" title="Toggle theme" > setMobileOpen((current) => !current)} aria-expanded={mobileOpen} aria-label="Toggle navigation menu" > {mobileOpen ? : } {mobileOpen && ( {navItems.map((item) => ( {item.label} ))} setMode("policy")} > Policy setMode("research")} > Research )} > ) } function ReaderModeBanner() { const { mode } = useAudienceMode() const [snapshotLabel, setSnapshotLabel] = useState(null) useEffect(() => { let cancelled = false fetchBackendManifest() .then((status) => { if (cancelled) return setSnapshotLabel( formatSnapshotDate(status?.currentManifest?.generated_at), ) }) .catch(() => { // Manifest fetch is best-effort — just hide the banner label. }) return () => { cancelled = true } }, []) return ( {mode === "research" ? "Research mode" : "Policy mode"} · {mode === "research" ? "Methodology and configuration foregrounded — specific missing fields, setup-variant differences, expanded metric configuration." : "Plain-language interpretation foregrounded — Policy Notes (what / caveat / intended for), accountability framings, compressed metric detail."} {snapshotLabel && ( Snapshot · {snapshotLabel} )} ) }