import type { ComponentType, CSSProperties } from 'react' import { NavLink, Outlet, useLocation } from 'react-router-dom' import { ClipboardList, Crosshair, Layers, LogOut, Radar, Scale, Settings as SettingsIcon, ShieldCheck, Users, } from 'lucide-react' import { useAuth } from '../lib/useAuth' type Icon = ComponentType<{ size?: number; className?: string; style?: CSSProperties }> type NavItem = { to: string; label: string; icon: Icon } type Tool = { key: string name: string tagline: string accent: string basePath: string icon: Icon match: (path: string) => boolean nav: NavItem[] } // The three tools under the missionMATCH umbrella. The switcher routes between them; each owns its // accent and its own nav. missionMATCH (gold) is the home tool and the default after login. const TOOLS: Tool[] = [ { key: 'mission', name: 'missionMATCH', tagline: 'Command Center', accent: 'var(--color-gold)', basePath: '/command', icon: Radar, match: (p) => p === '/' || p.startsWith('/command') || p.startsWith('/compliance'), nav: [ { to: '/command', label: 'Command Center', icon: Radar }, { to: '/command/candidates', label: 'Candidates', icon: Users }, { to: '/compliance', label: 'Compliance', icon: Scale }, ], }, { key: 'screen', name: 'screenMATCH', tagline: 'Qualification', accent: 'var(--color-screen)', basePath: '/screen', icon: Crosshair, match: (p) => p.startsWith('/screen') || p.startsWith('/requirements') || p.startsWith('/evaluate'), nav: [ { to: '/screen', label: 'Screen Candidate', icon: Crosshair }, { to: '/requirements', label: 'Opportunities', icon: ClipboardList }, ], }, { key: 'slate', name: 'slateMATCH', tagline: 'Proposal Slates', accent: 'var(--color-slate-accent)', basePath: '/slate', icon: Layers, match: (p) => p.startsWith('/slate'), nav: [{ to: '/slate', label: 'Candidate Slate', icon: Layers }], }, ] function activeTool(path: string): Tool { return TOOLS.find((t) => t.match(path)) ?? TOOLS[0] } // Shared and legacy routes belong to no tool; give them their own header title so it never reads the // fallback tool's first nav label (for example the Settings page must not show "Command Center"). const SHARED_TITLES: Record = { '/settings': 'Settings', '/pipeline': 'Talent Pipeline', '/dashboard': 'Dashboard', } function isSharedPath(path: string): boolean { return path in SHARED_TITLES } function headerTitle(tool: Tool, path: string): string { if (SHARED_TITLES[path]) return SHARED_TITLES[path] const item = tool.nav.find((n) => (path === n.to ? true : path.startsWith(n.to) && n.to !== tool.basePath)) return item?.label ?? tool.nav[0]?.label ?? tool.name } export function AppShell() { const { pathname } = useLocation() const { principal, logout } = useAuth() const tool = activeTool(pathname) // On a shared or legacy route no tool is truly active, so no tool chip lights and the header stays // neutral rather than borrowing the fallback tool's identity. const shared = isSharedPath(pathname) return (

{headerTitle(tool, pathname)}

{shared ? 'missionMATCH' : `${tool.name} · ${tool.tagline}`}

FIPS 140-3 • RLS isolated {principal && ( {principal.role} )}
) }