import { useEffect, useMemo, useState, type ReactNode } from 'react'; import { Flame, Gem, Heart, Wifi, WifiOff } from 'lucide-react'; import { useCompanion } from '../../api/CompanionContext.js'; import type { ScreenId } from '../../app/navigation.js'; import { BottomNav } from '../bottom-nav/BottomNav.js'; type AppShellProps = { activeScreen: ScreenId; children: ReactNode; onNavigate: (screen: ScreenId) => void; }; const screenTitles: Record = { chat: { title: 'Quest', kicker: 'Hermes training path' }, files: { title: 'Backpack', kicker: 'Workspace loot' }, terminal: { title: 'Power move', kicker: 'Run a command' }, activity: { title: 'League', kicker: 'Companion stats' }, settings: { title: 'Nest', kicker: 'Connection setup' }, }; export function AppShell({ activeScreen, children, onNavigate }: AppShellProps) { const { client } = useCompanion(); const [online, setOnline] = useState(false); useEffect(() => { let cancelled = false; client .health() .then(() => { if (!cancelled) setOnline(true); }) .catch(() => { if (!cancelled) setOnline(false); }); return () => { cancelled = true; }; }, [client]); const title = useMemo(() => screenTitles[activeScreen], [activeScreen]); return (

{title.kicker}

{title.title}

7 550 3
{online ? : } {online ? 'Companion online — ready for quests' : 'Companion offline — check Settings'}
{children}
); }