"use client"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { useEffect, useState } from "react"; import { IconClose, IconMenu } from "@/components/Icons"; /** Admin navigation: vertical list on desktop; on mobile a compact button opening a drawer. */ export function AdminNav({ items, mobileOnly = false, }: { items: Array<[string, string]>; mobileOnly?: boolean; }) { const pathname = usePathname(); const [open, setOpen] = useState(false); // biome-ignore lint/correctness/useExhaustiveDependencies: close on navigation useEffect(() => setOpen(false), [pathname]); useEffect(() => { if (!open) return; const onKey = (e: KeyboardEvent) => e.key === "Escape" && setOpen(false); document.addEventListener("keydown", onKey); const prev = document.body.style.overflow; document.body.style.overflow = "hidden"; return () => { document.removeEventListener("keydown", onKey); document.body.style.overflow = prev; }; }, [open]); const isCurrent = (href: string) => (href === "/admin" ? pathname === "/admin" : pathname.startsWith(href)); const list = ( ); if (!mobileOnly) return list; return (