"use client"; import { useState } from "react"; import { Link, usePathname } from "@/i18n/navigation"; export interface NavItem { href: string; label: string } export interface NavGroup { title: string; items: NavItem[] } export function AdminShell({ groups, brand, back, children, }: { groups: NavGroup[]; brand: string; back: string; children: React.ReactNode; }) { const pathname = usePathname() ?? ""; // next-intl: already without the locale prefix const [open, setOpen] = useState(false); const isActive = (href: string) => pathname === href || pathname.startsWith(href + "/"); const current = groups.flatMap((g) => g.items).find((i) => isActive(i.href)); return (
{/* Sidebar — pinned to the right (admin is RTL-primary). lg:translate-x-0 keeps it visible on desktop; on mobile it slides off the right edge. (Avoid rtl:/ltr: translate variants — their [dir] selector out-specifies lg: and would keep the panel off-screen.) */} {/* Mobile overlay */} {open &&
setOpen(false)} />} {/* Main column */}

{current?.label ?? brand}

{back}
{children}
); }