"use client"; import { usePathname } from "next/navigation"; import Link from "next/link"; import { SidebarProvider, Sidebar, SidebarContent, SidebarGroup, SidebarGroupLabel, SidebarGroupContent, SidebarMenu, SidebarMenuItem, SidebarMenuButton, SidebarHeader, SidebarInset, SidebarTrigger, } from "@/components/ui/sidebar"; import { ClipboardList, Server, LayoutDashboard, LucideIcon } from "lucide-react"; import { ThemeToggle } from "@/components/theme-toggle"; import { DropdownMenuAvatar, DiscordMemberProfile } from "@/components/dropdown-menu-avatar"; interface NavItem { href: string; label: string; icon: LucideIcon; isActive: (pathname: string) => boolean; } const NAV_ITEMS: NavItem[] = [ { href: "/admin", label: "Dashboard", icon: LayoutDashboard, isActive: (pathname) => pathname === "/admin", }, { href: "/admin/form", label: "Form", icon: ClipboardList, isActive: (pathname) => pathname === "/admin/form", }, { href: "/admin/backend", label: "Backend", icon: Server, isActive: (pathname) => pathname.startsWith("/admin/backend"), }, ]; export function AdminShell({ children, userName, userImage, profile, }: { children: React.ReactNode; userName?: string; userImage?: string; profile?: DiscordMemberProfile | null; }) { const pathname = usePathname(); return (
Admin
{(userName || profile) && ( )}
Navigation {NAV_ITEMS.map(({ href, label, icon: Icon, isActive }) => ( {label} ))}
{children}
); }