import { NavLink } from "react-router-dom"; import type { ComponentType, SVGProps } from "react"; import { useAuth } from "../../auth/AuthContext"; import { CodesIcon, MachinesIcon, SessionsIcon, UsersIcon, } from "./icons"; interface NavItem { to: string; label: string; Icon: ComponentType>; /** Pass-1 stubs are disabled until their views land in later passes. */ enabled: boolean; /** Only render for admins (the underlying route is admin-gated). */ adminOnly?: boolean; } const NAV: NavItem[] = [ { to: "/machines", label: "Machines", Icon: MachinesIcon, enabled: true }, { to: "/sessions", label: "Sessions", Icon: SessionsIcon, enabled: true }, { to: "/codes", label: "Codes", Icon: CodesIcon, enabled: true }, { to: "/users", label: "Users", Icon: UsersIcon, enabled: true, adminOnly: true, }, ]; export function Sidebar() { const { isAdmin } = useAuth(); // Hide admin-only items from non-admins entirely (the route also gates them, // and the API is admin-gated server-side — this keeps the UX honest). const items = NAV.filter((item) => !item.adminOnly || isAdmin); return ( ); }