// App shell: sidebar + topbar + routing const { useState, useEffect, useMemo, useRef, createContext, useContext } = React; const AppCtx = createContext(null); const useApp = () => useContext(AppCtx); const NAV = [ { id: 'dashboard', label: 'Dashboard', icon: 'dashboard' }, { id: 'cabinet', label: 'Cabinet', icon: 'cabinet', section: 'Medicines', badge: 2 }, { id: 'schedule', label: 'Schedule & Log', icon: 'clock', section: 'Medicines' }, { id: 'regimens', label: 'Regimens', icon: 'list', section: 'Medicines' }, { id: 'organizer', label: 'Pill Organizer', icon: 'calendar', section: 'Medicines' }, { id: 'library', label: 'Library', icon: 'pill', section: 'Medicines' }, { id: 'refills', label: 'Shopping list', icon: 'refresh', section: 'Medicines', badge: 1 }, { id: 'purchases', label: 'Purchases', icon: 'truck', section: 'Medicines' }, { id: 'prices', label: 'Prices', icon: 'tag', section: 'Medicines' }, { id: 'stores', label: 'Stores', icon: 'store', section: 'Medicines' }, { id: 'activity', label: 'Activity & Spend', icon: 'trend', section: 'Medicines' }, { id: 'settings', label: 'Settings', icon: 'settings' }, ]; const Sidebar = ({ route, onNav }) => { const grouped = useMemo(() => { const g = {}; NAV.forEach(n => { (g[n.section] = g[n.section] || []).push(n); }); return g; }, []); return ( ); }; const Topbar = ({ title, subtitle, crumbs, onSearch, actions, theme, onToggleTheme }) => { return (
{crumbs && crumbs.length > 1 && (
{crumbs.map((c, i) => ( {i > 0 && } {c} ))}
)}

{title}

{subtitle &&
{subtitle}
}
⌘K
{actions}
); }; window.Shell = { Sidebar, Topbar, AppCtx, useApp, NAV };