import { LayoutDashboard, Network, GitFork, Share2, 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 = 'overview' | 'connections' | 'routing-table' | 'topology' | 'settings' interface AppSidebarProps { currentTab: NavTab onSelectTab: (tab: NavTab) => void linksCount?: number establishedLinksCount?: number isConnected?: boolean } export function AppSidebar({ currentTab, onSelectTab, linksCount = 0, establishedLinksCount = 0, isConnected = false, }: AppSidebarProps) { const navItems = [ { id: 'overview' as NavTab, title: '总览', icon: LayoutDashboard, }, { id: 'connections' as NavTab, title: '连接', icon: Network, badge: linksCount > 0 ? `${establishedLinksCount}/${linksCount}` : undefined, }, { id: 'routing-table' as NavTab, title: 'SRv6 路由表', icon: GitFork, }, { id: 'topology' as NavTab, title: '网络拓扑', icon: Share2, }, { 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 实时流已连接' : '实时连接断开'}
) }