"use client"; import { usePathname } from "next/navigation"; import Link from "next/link"; import { SidebarProvider, Sidebar, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarMenu, SidebarMenuItem, SidebarMenuButton, SidebarHeader, SidebarInset, SidebarTrigger, } from "@/components/ui/sidebar"; import { ClipboardList, KeyRound, Server, LayoutDashboard, Upload, 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; disabled?: 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"), }, { href: "/admin/upload", label: "Upload", icon: Upload, isActive: (pathname) => pathname.startsWith("/admin/upload"), disabled: true, }, { href: "/admin/login", label: "Login", icon: KeyRound, isActive: (pathname) => pathname.startsWith("/admin/login"), }, ]; export function AdminShell({ children, userName, userImage, profile, }: { children: React.ReactNode; userName?: string; userImage?: string; profile?: DiscordMemberProfile | null; }) { const pathname = usePathname(); return (
Admin
{(userName || profile) && ( )}
{NAV_ITEMS.map(({ href, label, icon: Icon, isActive, disabled }) => ( {disabled ? ( {label} ) : ( {label} )} ))}
{children}
); }