import { NavLink } from 'react-router'; import { Sun, Moon, Monitor, Shield, Lock, ShieldAlert, Wifi, LayoutDashboard, Globe, CloudLightning } from 'lucide-react'; import { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarRail, useSidebar, } from './ui/sidebar'; import { useTheme } from '../contexts/ThemeContext'; export function AppSidebar() { const { theme, setTheme } = useTheme(); const { state } = useSidebar(); const cycleTheme = () => { if (theme === 'light') { setTheme('dark'); } else if (theme === 'dark') { setTheme('system'); } else { setTheme('light'); } }; const getThemeIcon = () => { switch (theme) { case 'light': return ; case 'dark': return ; default: return ; } }; const getThemeLabel = () => { switch (theme) { case 'light': return 'Light mode'; case 'dark': return 'Dark mode'; default: return 'System theme'; } }; const servicesItems = [ { to: '/central', icon: LayoutDashboard, label: 'Dashboard', end: true }, { to: '/central/services', icon: Globe, label: 'Services' }, ]; const centralItems = [ { to: '/central/firewall', icon: Shield, label: 'Firewall' }, { to: '/central/vpn', icon: Lock, label: 'VPN' }, { to: '/central/crowdsec', icon: ShieldAlert, label: 'CrowdSec' }, { to: '/central/dhcp', icon: Wifi, label: 'DHCP' }, ]; return (

Wild Central

{state === 'collapsed' ? ( {[...servicesItems, ...centralItems].map((item) => ( {({ isActive }) => ( {item.label} )} ))} ) : ( <> Services {servicesItems.map(({ to, icon: Icon, label, end }) => ( {({ isActive }) => ( {label} )} ))} Central {centralItems.map(({ to, icon: Icon, label }) => ( {({ isActive }) => ( {label} )} ))} )} {getThemeIcon()} {getThemeLabel()}
); }