import { useEffect, useState } from "react"; import { ChevronDown, Sparkles } from "lucide-react"; import { cn } from "../../utils/cn"; import { PRIMARY_TABS, ADVANCED_TABS, ADVANCED_TAB_IDS, type TabId, } from "../../tabs/registry"; import { Badge } from "../ui/badge"; interface SidebarProps { active: TabId; onTabChange: (id: TabId) => void; } export function Sidebar({ active, onTabChange }: SidebarProps) { const [advancedOpen, setAdvancedOpen] = useState( () => ADVANCED_TAB_IDS.has(active), ); // Keep the advanced section expanded whenever the active tab is advanced, // regardless of how the navigation happened (tab click, cross-device recalc). useEffect(() => { if (ADVANCED_TAB_IDS.has(active)) setAdvancedOpen(true); }, [active]); const Tile = ({ tab }: { tab: (typeof PRIMARY_TABS)[number] }) => { const Icon = tab.icon; const isActive = active === tab.id; return ( ); }; return ( ); }