import { useAuth } from "../contexts/AuthContext"; import { useSupervisorQuestions } from "../contexts/SupervisorQuestionsContext"; import { useUserSettings } from "../hooks/useUserSettings"; import { RewriteLink } from "./RewriteLink"; interface NavLink { label: string; href: string; requiresAuth?: boolean; external?: boolean; /** * When true the link is hidden once the user has flipped on the * document-mode UI — those areas (Exec, Contracts) are subsumed by the * directive-document interface and surfacing them just creates noise. */ hideInDocumentMode?: boolean; } const NAV_LINKS: NavLink[] = [ { label: "Listen", href: "/listen" }, { label: "Directives", href: "/directives", requiresAuth: true }, { label: "Orders", href: "/orders", requiresAuth: true }, // /contracts has been removed in Phase 5; the legacy nav entry is gone. // /exec is still reachable for the standalone task page but hidden when // document mode is on (the unified surface routes through /directives). { label: "Exec", href: "/exec", requiresAuth: true, hideInDocumentMode: true, }, { label: "Daemons", href: "/daemons", requiresAuth: true }, { label: "History", href: "/history", requiresAuth: true }, ]; export function NavStrip() { const { isAuthenticated, isAuthConfigured, signOut, user } = useAuth(); const { pendingQuestions } = useSupervisorQuestions(); const { settings } = useUserSettings(); const documentMode = settings?.documentModeEnabled ?? false; const directiveQuestionCount = pendingQuestions.filter(q => q.directiveId).length; const handleSignOut = async () => { await signOut(); window.location.href = "/login"; }; // Check if user has access (authenticated or auth not configured) const hasAccess = isAuthenticated || !isAuthConfigured; return ( ); }