import { useState } from 'react'; interface SideNavProps { activePage: string; onPageChange: (page: string) => void; alertCount?: number; } const modules: { id: string; label: string; icon: React.ReactNode; items: { id: string; label: string }[] }[] = [ { id: 'monitoring', label: '监测', icon: ( ), items: [ { id: 'monitoring', label: '监测面板' }, ], }, { id: 'alert', label: '预警', icon: ( ), items: [ { id: 'alerts', label: '预警地图' }, ], }, { id: 'analysis', label: '分析', icon: ( ), items: [ { id: 'trend-analysis', label: '趋势分析' }, { id: 'district-comparison', label: '区域对比' }, { id: 'insights', label: '智能洞察' }, { id: 'reports', label: '报表中心' }, ], }, ]; export function SideNav({ activePage, onPageChange, alertCount = 0, }: SideNavProps) { const [expanded, setExpanded] = useState('monitoring'); const handleItemClick = (moduleId: string, itemId: string) => { setExpanded(moduleId); onPageChange(itemId); }; const isActiveModule = (moduleId: string) => { const module = modules.find(m => m.id === moduleId); if (!module) return false; return module.items.some(item => item.id === activePage); }; return ( ); }