// Shell: left nav + layout. Nav locked until authenticated. function groupBy(arr, key) { const out = {}; arr.forEach(x => { (out[x[key]] = out[x[key]] || []).push(x); }); return out; } const NAV_ITEMS = [ { id: 'landing', label: 'Overview', group: 'Public' }, // [EDIT 2026-05-11] Onboarding removed as standalone tab — now built into Assessment pre-flight { id: 'science', label: 'The science', group: 'About' }, { id: 'pricing', label: 'Pricing', group: 'About' }, { id: 'assessment', label: 'Assessment', group: 'Assessment' }, { id: 'completion', label: 'Quality check', group: 'Assessment' }, { id: 'profile', label: 'Profile & blind spots', group: 'Reports' }, { id: 'constitution', label: 'AI constitution', group: 'Reports' }, { id: 'pair-invite', label: 'Pair invite', group: 'Pairing' }, { id: 'pair-report', label: 'Pair report', group: 'Pairing' }, { id: 'settings', label: 'Settings', group: 'Account' }, ]; // Science and pricing are accessible without auth const PUBLIC_IDS = ['landing', 'science', 'pricing', 'tos', 'privacy']; const GROUPED_NAV_ITEMS = groupBy(NAV_ITEMS, 'group'); function Shell({ isAuthed, screen, setScreen, onSignOut, children, rightRail }) { const [authModal, setAuthModal] = React.useState(null); const handleAuth = () => { setAuthModal(null); // This will be passed down from the app level if (window.kalibrHandleAuth) window.kalibrHandleAuth(); }; // Expose function to open auth modal globally React.useEffect(() => { window.kalibrOpenAuthModal = setAuthModal; }, []); return (