import type { Page } from '../App'; import { useConfig } from '../hooks/useApi'; import { CRA_DATES, hasStarted } from '../content/cra'; import { Cite } from './ui'; interface NavigationProps { currentPage: Page; onNavigate: (page: Page) => void; counts?: { incidents?: number; scanner?: number; }; checklist?: { done: number; total: number }; } const NAV_ITEMS: { id: Page; label: string }[] = [ { id: 'dashboard', label: 'Overview' }, { id: 'checklist', label: 'Checklist' }, { id: 'documents', label: 'Documents' }, { id: 'scanner', label: 'Vulnerabilities' }, { id: 'incidents', label: 'Incidents' }, { id: 'education', label: 'About the CRA' }, { id: 'settings', label: 'Settings' }, ]; const PLAN_LABEL = { free: 'Free plan', basic: 'Basic plan', pro: 'Pro plan' } as const; export function BrandMark({ size = 24 }: { size?: number }) { return ( ); } export function Navigation({ currentPage, onNavigate, counts, checklist }: NavigationProps) { const config = useConfig(); const reportingLive = hasStarted(CRA_DATES.reporting); return ( ResilienceWP Art. 14 {reportingLive ? 'Reporting applies now' : 'Reporting applies from 11 September 2026'} {config.connected ? `Connected, ${PLAN_LABEL[config.plan]}` : 'Not connected'} {NAV_ITEMS.map((item) => { const count = item.id === 'incidents' ? counts?.incidents : item.id === 'scanner' ? counts?.scanner : undefined; const countLabel = item.id === 'incidents' ? 'overdue' : 'critical or exploited'; return ( onNavigate(item.id)} > {item.label} {item.id === 'checklist' && checklist && checklist.total > 0 && ( {checklist.done}/{checklist.total} )} {count ? ( {count > 9 ? '9+' : count} ) : null} ); })} ); }