"use client"; import { ReactNode } from "react"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { clearTokens, loginWithRedirect } from "@/lib/auth"; const NAV_ITEMS: { href: string; label: string; icon: string }[] = [ { href: "/admin", label: "نمای کلی", icon: "▦" }, { href: "/admin/tenants", label: "Tenantها", icon: "🏢" }, { href: "/admin/users", label: "کاربران", icon: "👤" }, { href: "/admin/plans", label: "پلنها", icon: "📦" }, { href: "/admin/features", label: "قابلیتها", icon: "🧩" }, { href: "/admin/services", label: "سرویسها", icon: "🛠" }, { href: "/admin/settings", label: "حساب کاربری", icon: "⚙" }, ]; function isActive(pathname: string, href: string): boolean { if (href === "/admin") return pathname === "/admin"; return pathname === href || pathname.startsWith(`${href}/`); } export function AdminShell({ children }: { children: ReactNode }) { const pathname = usePathname(); const handleLogout = () => { clearTokens(); void loginWithRedirect("/admin"); }; return (