'use client'; import { useState, useEffect } from 'react'; import Link from 'next/link'; import { usePathname, useRouter } from 'next/navigation'; import { LayoutDashboard, Activity, BarChart3, Cpu, Key, Code2, Settings, LogOut, Menu, X, Sun, Moon, HeartPulse, Sparkles, Server, } from 'lucide-react'; import { useAuth } from '@/lib/auth'; const navItems = [ { href: '/', label: 'Dashboard', icon: LayoutDashboard }, { href: '/hermes', label: 'Hermes', icon: Sparkles }, { href: '/health', label: 'Health', icon: HeartPulse }, { href: '/metrics', label: 'Metrics', icon: BarChart3 }, { href: '/vm', label: 'VM Health', icon: Server }, { href: '/system', label: 'System', icon: Cpu }, { href: '/env', label: 'Environment', icon: Key }, { href: '/code-quality', label: 'Code Quality', icon: Code2 }, { href: '/settings/cosmos', label: 'Settings', icon: Settings }, ]; export function SidebarNav() { const pathname = usePathname(); const router = useRouter(); const { user, logout } = useAuth(); const [mobileOpen, setMobileOpen] = useState(false); const [theme, setTheme] = useState<'light' | 'dark'>('light'); // Sync theme from localStorage on mount useEffect(() => { const saved = (localStorage.getItem('theme') as 'light' | 'dark') || 'light'; setTheme(saved); document.documentElement.classList.toggle('dark', saved === 'dark'); }, []); const handleLogout = () => { logout(); router.push('/login'); }; const initials = user?.email ? user.email.slice(0, 2).toUpperCase() : '??'; const sidebarContent = ( <> {/* Logo */}
Dashboard
{user?.email ?? 'Admin'}
{user?.role ?? 'admin'}