import Icon from "./Icon"; const navigation = [ { label: "工作台", icon: "home" as const, page: "home" as const }, { label: "构建脚本", icon: "script" as const, page: "scripts" as const }, { label: "调度配置", icon: "schedule" as const, page: "schedules" as const }, { label: "系统管理", icon: "settings" as const, page: "system" as const }, ]; type ActivePage = "home" | "scripts" | "schedules" | "system"; type SidebarProps = { activePage: ActivePage; collapsed: boolean; onNavigate: (page: ActivePage) => void; onToggleCollapse: () => void; onEndEditing?: () => void; onSelectScript?: (scriptId: null) => void; editSessionRef?: React.RefObject; }; export function Sidebar({ activePage, collapsed, onNavigate, onToggleCollapse, onEndEditing, onSelectScript, editSessionRef, }: SidebarProps) { const handleNavigationClick = (page: ActivePage) => { if (page !== "scripts") { if (editSessionRef?.current) { onEndEditing?.(); } else { onSelectScript?.(null); } } onNavigate(page); }; return ( ); }