import { useEffect, useState } from 'react' import { useLocation, Link } from 'react-router-dom' import { LayoutGrid, Server, Bookmark, Terminal, Waypoints, FolderOpen, Box, MonitorSmartphone, Settings, ChevronLeft, ChevronRight, } from 'lucide-react' import { api, type Integration } from '../lib/api' interface SidebarProps { collapsed: boolean onToggle: () => void } const navItems = [ { icon: LayoutGrid, label: 'Glance', route: '/' }, { icon: Server, label: 'Infrastructure', route: '/infrastructure' }, { icon: Bookmark, label: 'BookNest', route: '/booknest' }, { icon: Terminal, label: 'Terminal', route: '/terminal' }, { icon: Waypoints, label: 'Tunnels', route: '/tunnels' }, { icon: FolderOpen, label: 'Files', route: '/files' }, { icon: Box, label: 'Containers', route: '/containers' }, { icon: MonitorSmartphone, label: 'Remote Desktop', route: '/remote-desktop' }, { icon: Settings, label: 'Settings', route: '/settings' }, ] export default function Sidebar({ collapsed, onToggle }: SidebarProps) { const width = collapsed ? 64 : 200 const location = useLocation() const [integrations, setIntegrations] = useState(null) useEffect(() => { api.listIntegrations().then(({ integrations }) => setIntegrations(integrations)) }, []) const errored = integrations?.filter((i) => i.status === 'error').length ?? 0 const statusOk = errored === 0 const statusColor = statusOk ? '#2ECC71' : '#E74C3C' const statusLabel = integrations === null ? 'Checking…' : statusOk ? 'All Systems Operational' : `${errored} Issue${errored > 1 ? 's' : ''} Detected` return ( ) }