"use client"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { useAuth } from "@/hooks/useAuth"; import { cn } from "@/lib/utils"; import { LayoutDashboard, Calendar, FileText, Shield, Tag, Users, Radio, Settings, Wrench, LogOut, ArrowLeft, Inbox, ImageIcon, HelpCircle, MessageSquare, Building2, KeyRound, } from "lucide-react"; // Each item is shown when the user holds any of its permissions. Items with no // permissions are always visible. SuperAdmin sees everything via can(). const navItems: { href: string; label: string; icon: typeof LayoutDashboard; permissions?: string[]; }[] = [ { href: "/admin/overview", label: "Overview", icon: LayoutDashboard }, { href: "/admin/events", label: "Events", icon: Calendar, permissions: ["events.create", "events.edit", "events.delete"] }, { href: "/admin/organizers", label: "Organizers", icon: Building2, permissions: ["organizers.manage"] }, { href: "/admin/gallery", label: "Gallery", icon: ImageIcon, permissions: ["gallery.upload", "gallery.delete"] }, { href: "/admin/blog", label: "Blog", icon: FileText, permissions: ["blog.draft", "blog.publish", "blog.delete"] }, { href: "/admin/faq", label: "FAQ", icon: HelpCircle, permissions: ["faq.manage"] }, { href: "/admin/submissions", label: "Submissions", icon: Inbox, permissions: ["submissions.review"] }, { href: "/admin/messages", label: "Board", icon: MessageSquare, permissions: ["board.manage"] }, { href: "/admin/moderation", label: "Moderation", icon: Shield, permissions: ["moderation.act"] }, { href: "/admin/categories", label: "Categories", icon: Tag, permissions: ["categories.manage"] }, { href: "/admin/users", label: "Users", icon: Users, permissions: ["users.assign_role", "nip05.assign"] }, { href: "/admin/roles", label: "Roles", icon: KeyRound, permissions: ["roles.edit_permissions"] }, { href: "/admin/relays", label: "Relays", icon: Radio, permissions: ["relays.manage"] }, { href: "/admin/settings", label: "Settings", icon: Settings, permissions: ["settings.edit"] }, { href: "/admin/nostr", label: "Nostr Tools", icon: Wrench, permissions: ["nostr_tools.use"] }, ]; export function AdminSidebar() { const pathname = usePathname(); const { user, logout, can } = useAuth(); const shortPubkey = user?.pubkey ? `${user.pubkey.slice(0, 8)}...${user.pubkey.slice(-8)}` : ""; return ( ); }