import { BarChart3, Bell, BookOpen, CircleAlert, ClipboardList, LayoutDashboard, LogOut, Shield, UserCircle2, Users, Users2, X, } from "lucide-react" import { type ComponentType, useEffect, useState } from "react" import { NavLink } from "react-router-dom" import { cn } from "../../lib/utils" import { BrandLogo } from "../brand/BrandLogo" import { getUnreadCount } from "../../api/notifications.api" type NavItem = { label: string to: string icon: ComponentType<{ className?: string }> } const navItems: NavItem[] = [ { label: "Dashboard", to: "/dashboard", icon: LayoutDashboard }, { label: "User Management", to: "/users", icon: Users }, { label: "Role Management", to: "/roles", icon: Shield }, { label: "Content Management", to: "/content", icon: BookOpen }, { label: "Notifications", to: "/notifications", icon: Bell }, { label: "User Log", to: "/user-log", icon: ClipboardList }, { label: "Issue Reports", to: "/issues", icon: CircleAlert }, { label: "Analytics", to: "/analytics", icon: BarChart3 }, { label: "Team Management", to: "/team", icon: Users2 }, { label: "Profile", to: "/profile", icon: UserCircle2 }, ] type SidebarProps = { isOpen: boolean onClose: () => void } export function Sidebar({ isOpen, onClose }: SidebarProps) { const [unreadCount, setUnreadCount] = useState(0) useEffect(() => { const fetchUnread = async () => { try { const res = await getUnreadCount() setUnreadCount(res.data.unread) } catch { // silently fail } } fetchUnread() window.addEventListener("notifications-updated", fetchUnread) return () => window.removeEventListener("notifications-updated", fetchUnread) }, []) return ( <> {/* Mobile overlay */}
{/* Sidebar panel */} > ) }