"use client"; import React, { useState } from "react"; import Link from "next/link"; import { Calendar, User, LayoutDashboard, ShieldCheck, Globe, Menu, type LucideIcon } from "lucide-react"; import { useAuth } from "@/hooks/useAuth"; import { RoleBadge, type Role } from "@/components/shared/RoleBadge"; import { UserAvatar } from "@/components/shared/UserAvatar"; import { usePathname } from "next/navigation"; import { Sheet, SheetContent, SheetTrigger } from "@/components/ui/sheet"; const navLinks: { href: string; label: string; icon: LucideIcon; roles?: string[] }[] = [ { href: "/dashboard/user", label: "My Events", icon: Calendar, roles: ["user", "staff", "supervisor", "admin"] }, { href: "/dashboard/user/profile", label: "Profile & Security", icon: User, roles: ["user", "staff", "supervisor", "admin"] }, { href: "/dashboard/staff", label: "Staff", icon: LayoutDashboard, roles: ["staff"] }, { href: "/dashboard/supervisor", label: "Supervisor", icon: LayoutDashboard, roles: ["supervisor"] }, { href: "/dashboard/admin", label: "Admin", icon: ShieldCheck, roles: ["admin"] }, { href: "/dashboard/admin/settings", label: "Site Settings", icon: Globe, roles: ["admin"] }, ]; function SidebarNavContent({ onNavigate }: { onNavigate?: () => void }) { const { user } = useAuth(); const role = (user?.role || "user") as Role; const pathname = usePathname(); const links = navLinks.filter(l => !l.roles || l.roles.includes(role)); return (
{user && (
{user.name}
)}
); } /** Desktop sidebar — fixed/pinned, does not scroll with page content. */ export function Sidebar() { return ( ); } /** Mobile equivalent — a slim top strip with a hamburger that opens the same nav in a drawer. */ export function MobileSidebar() { const { user } = useAuth(); const role = (user?.role || "user") as Role; const [open, setOpen] = useState(false); return (
{user && (
{user.name}
)} setOpen(false)} />
); }