import { LayoutDashboard, Network, GitFork, Share2, Cpu, Settings, Activity, Layers, } from 'lucide-react' import { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarMenu, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarRail, } from '@/components/ui/sidebar' import { Badge } from '@/components/ui/badge' export type NavTab = 'dashboard' | 'links' | 'routes' | 'topology' | 'interfaces' | 'settings' interface AppSidebarProps { currentTab: NavTab onSelectTab: (tab: NavTab) => void onlineDevices?: number linksCount?: number isConnected?: boolean } export function AppSidebar({ currentTab, onSelectTab, onlineDevices = 0, linksCount = 0, isConnected = false, }: AppSidebarProps) { const navItems = [ { id: 'dashboard' as NavTab, title: '仪表盘总览', icon: LayoutDashboard, badge: isConnected ? 'Live' : undefined, }, { id: 'links' as NavTab, title: '线路与链路', icon: Network, badge: linksCount > 0 ? `${linksCount}` : undefined, }, { id: 'routes' as NavTab, title: 'SRv6 路由表', icon: GitFork, }, { id: 'topology' as NavTab, title: '网络拓扑', icon: Share2, badge: onlineDevices > 0 ? `${onlineDevices}` : undefined, }, { id: 'interfaces' as NavTab, title: '网卡接口', icon: Cpu, }, { id: 'settings' as NavTab, title: '系统配置', icon: Settings, }, ] return (
KLALB SRv6 多WAN汇聚网络
网络监控与管理 {navItems.map((item) => { const Icon = item.icon const isActive = currentTab === item.id return ( onSelectTab(item.id)} > {item.title} {item.badge && ( {item.badge} )} ) })} {isConnected ? 'SSE 实时流已连接' : '实时连接断开'}
) }