"use client"; import { BadgeCheck, Cat, ChevronDown, ClipboardCheck, Copy, Dumbbell, FileX2, Image as ImageIcon, type LucideIcon, Puzzle, RefreshCw, Shirt, Upload, Wrench, } from "lucide-react"; import { usePathname } from "next/navigation"; import { useTranslations } from "next-intl"; import { useState } from "react"; import { CatalogManagerDialog } from "@/app/admin/catalog/catalog-manager-dialog-wrapper"; import { OrganizeImportsLauncher } from "@/components/admin/studio/organize-imports-launcher"; import Link from "@/components/link"; import { Popover, PopoverContent, PopoverTrigger, } from "@/components/ui/popover"; import { cn } from "@/lib/utils"; type StudioLink = { href: string; labelKey: string; icon: LucideIcon }; const assets: StudioLink[] = [ { href: "/admin/studio/furni", labelKey: "furniture", icon: Puzzle }, { href: "/admin/studio/badges", labelKey: "badges", icon: BadgeCheck }, { href: "/admin/studio/clothing", labelKey: "clothing", icon: Shirt }, { href: "/admin/studio/effects", labelKey: "effects", icon: Dumbbell }, { href: "/admin/studio/pets", labelKey: "pets", icon: Cat }, ]; const imports: StudioLink[] = [ { href: "/admin/studio/upload", labelKey: "uploadFiles", icon: Upload }, { href: "/admin/studio/clone", labelKey: "importFromSource", icon: Copy }, { href: "/admin/studio/sync", labelKey: "syncRepository", icon: RefreshCw }, ]; const maintenance: StudioLink[] = [ { href: "/admin/studio/audit", labelKey: "catalogAudit", icon: ClipboardCheck, }, { href: "/admin/studio/repair-icons", labelKey: "repairIcons", icon: ImageIcon, }, { href: "/admin/studio/maintenance", labelKey: "catalogMaintenance", icon: Wrench, }, { href: "/admin/studio/nitro-cleanup", labelKey: "nitroCleanup", icon: FileX2, }, ]; const activePath = (path: string, href: string) => path === href || path.startsWith(`${href}/`); function StudioMenu({ label, links, pathname, }: { label: string; links: StudioLink[]; pathname: string; }) { const t = useTranslations("admin.studio"); const [open, setOpen] = useState(false); const active = links.find((link) => activePath(pathname, link.href)); return ( {label} {links.map(({ href, labelKey, icon: Icon }) => ( setOpen(false)} aria-current={activePath(pathname, href) ? "page" : undefined} className="flex min-h-11 items-center gap-3 rounded-md px-3 text-sm hover:bg-[var(--admin-accent)]/10 aria-[current=page]:bg-[var(--admin-accent)]/15" > {t(`nav.${labelKey}`)} ))} ); } export function StudioLayoutClient({ canEditCatalog, children, }: { canEditCatalog: boolean; children: React.ReactNode; }) { const pathname = usePathname() ?? ""; const t = useTranslations("admin.studio"); return (
{children}
); }