import type { LucideIcon } from "lucide-react"; import { FolderOpen, Grid3x3, HelpCircle, LayoutGrid, Settings, Workflow } from "lucide-react"; import { Link, useLocation } from "react-router-dom"; import { cn } from "@/lib/utils"; interface SidebarItem { icon: LucideIcon; label: string; href?: string; } const topItems: SidebarItem[] = [ { icon: LayoutGrid, label: "Tools", href: "/" }, { icon: Grid3x3, label: "Grid", href: "/fullscreen" }, { icon: Workflow, label: "Automate", href: "/automate" }, { icon: FolderOpen, label: "Files", href: "/files" }, ]; const bottomItems: SidebarItem[] = [ { icon: HelpCircle, label: "Help" }, { icon: Settings, label: "Settings" }, ]; interface SidebarProps { onSettingsClick: () => void; onHelpClick: () => void; /** When true, renders in expanded mode (for mobile overlay). */ expanded?: boolean; } export function Sidebar({ onSettingsClick, onHelpClick, expanded = false }: SidebarProps) { const location = useLocation(); const renderItem = (item: SidebarItem, isActive: boolean) => { const content = expanded ? (
{item.label}
) : (
{item.label}
); if (item.label === "Settings") { return ( ); } if (item.label === "Help") { return ( ); } return ( {content} ); }; if (expanded) { return (
{topItems.map((item) => renderItem(item, location.pathname === item.href))}
{bottomItems.map((item) => renderItem(item, false))}
); } return ( ); }