import { Activity, MessageSquare, PanelsTopLeft } from "lucide-react"; import { useEffect, useState, type KeyboardEvent, type ReactNode } from "react"; import { TopBar, type TopBarProps } from "../topbar/TopBar.js"; export type WorkspaceTab = "chat" | "skills" | "events"; export function AppShell({ topBar, skills, chat, timeline, activeTab, onTabChange: setActiveTab }: { topBar: TopBarProps; skills: ReactNode; chat: ReactNode; timeline: ReactNode; activeTab: WorkspaceTab; onTabChange: (tab: WorkspaceTab) => void }) { const [mobile, setMobile] = useState(false); useEffect(() => { if (typeof window.matchMedia !== "function") return undefined; const media = window.matchMedia("(max-width: 720px)"); const update = () => setMobile(media.matches); update(); media.addEventListener("change", update); return () => media.removeEventListener("change", update); }, []); const selectAdjacentTab = (current: WorkspaceTab, event: KeyboardEvent) => { if (event.key !== "ArrowLeft" && event.key !== "ArrowRight" && event.key !== "Home" && event.key !== "End") return; event.preventDefault(); const order: WorkspaceTab[] = ["chat", "skills", "events"]; const currentIndex = order.indexOf(current); const targetIndex = event.key === "Home" ? 0 : event.key === "End" ? order.length - 1 : (currentIndex + (event.key === "ArrowRight" ? 1 : -1) + order.length) % order.length; const target = order[targetIndex]; if (target === undefined) return; setActiveTab(target); document.getElementById(`${target}-tab`)?.focus(); }; return (
); } function TabButton({ id, active, onSelect, onKeyDown, children }: { id: WorkspaceTab; active: boolean; onSelect: (tab: WorkspaceTab) => void; onKeyDown: (tab: WorkspaceTab, event: KeyboardEvent) => void; children: ReactNode; }) { return ( ); }