"use client"; import Link from "next/link"; import { usePathname, useRouter } from "next/navigation"; import { createClient } from "@/utils/supabase/client"; interface AdminSidebarProps { role: string; } const navItems = [ { label: "Dashboard", href: "/admin", minRole: "editor" }, { label: "Posts", href: "/admin/posts", minRole: "editor" }, { label: "Comments", href: "/admin/comments", minRole: "editor" }, { label: "Subscriptions", href: "/admin/subscriptions", minRole: "admin" }, { label: "Authors", href: "/admin/authors", minRole: "admin" }, { label: "Admin Users", href: "/admin/users", minRole: "super_admin" }, ]; const roleHierarchy: Record = { editor: 1, admin: 2, super_admin: 3, }; export default function AdminSidebar({ role }: AdminSidebarProps) { const pathname = usePathname(); const router = useRouter(); const supabase = createClient(); const handleLogout = async () => { await supabase.auth.signOut(); router.push("/admin/login"); router.refresh(); }; const userLevel = roleHierarchy[role] || 0; return ( ); }