()
| 53 | } |
| 54 | |
| 55 | function AppShell() { |
| 56 | // Re-render the shell on a language switch so formatter-only subtrees |
| 57 | // (charts, money/date labels that don't call t()) refresh too. |
| 58 | useLocale() |
| 59 | const [sidebarOpen, setSidebarOpen] = useState(false) |
| 60 | const isDesktop = useIsDesktop() // ≥768 — rail is a static column |
| 61 | const isRoomy = useIsRoomy() // ≥1180 — full text rail is allowed |
| 62 | |
| 63 | // When the rail becomes a static column, drop its mobile drawer state. |
| 64 | useEffect(() => { |
| 65 | if (isDesktop) setSidebarOpen(false) |
| 66 | }, [isDesktop]) |
| 67 | |
| 68 | // Lock body scroll while a drawer is open so the page behind doesn't drift |
| 69 | // under the backdrop. Restores the previous value on close/unmount. |
| 70 | useEffect(() => { |
| 71 | if (!sidebarOpen) return |
| 72 | const prev = document.body.style.overflow |
| 73 | document.body.style.overflow = 'hidden' |
| 74 | return () => { |
| 75 | document.body.style.overflow = prev |
| 76 | } |
| 77 | }, [sidebarOpen]) |
| 78 | |
| 79 | const mainContent = ( |
| 80 | <main className="flex flex-col min-w-0 min-h-0 bg-bg h-full"> |
| 81 | {/* Mobile header — visible only below md */} |
| 82 | <div className="flex items-center gap-3 px-4 py-3 border-b border-border/80 bg-bg-secondary shrink-0 md:hidden"> |
| 83 | <button |
| 84 | onClick={() => setSidebarOpen(true)} |
| 85 | className="text-text-muted hover:text-text p-1 -ml-1" |
| 86 | aria-label="Open menu" |
| 87 | > |
| 88 | <svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round"> |
| 89 | <path d="M3 5h14M3 10h14M3 15h14" /> |
| 90 | </svg> |
| 91 | </button> |
| 92 | <span className="text-sm font-semibold text-text">OpenAlice</span> |
| 93 | </div> |
| 94 | |
| 95 | <TabHost /> |
| 96 | </main> |
| 97 | ) |
| 98 | |
| 99 | return ( |
| 100 | <div className="flex flex-col h-full"> |
| 101 | {import.meta.env.VITE_DEMO_MODE && <DemoBanner />} |
| 102 | {import.meta.env.VITE_DEMO_MODE && <DemoAnalytics />} |
| 103 | <UpdateBanner /> |
| 104 | <div className="flex flex-1 min-h-0"> |
| 105 | <ActivityBar |
| 106 | open={sidebarOpen} |
| 107 | onClose={() => setSidebarOpen(false)} |
| 108 | desktopStatic={isDesktop} |
| 109 | compactRailForced={isDesktop && !isRoomy} |
| 110 | /> |
| 111 | <div className="flex-1 min-h-0"> |
| 112 | {mainContent} |
nothing calls this directly
no test coverage detected