"use client"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { useEffect, useState, type ReactNode } from "react"; import { ChevronRight } from "lucide-react"; import type { WorkspaceGroup } from "@/components/group-switcher"; import { DoubleSidebarNavigation } from "@/components/double-sidebar-navigation"; import { activeNavigationItem, adminWorkspaces, albumWorkspaces } from "@/lib/workspace-navigation"; import { cn } from "@/lib/utils"; export function BackendShell({ children, area, groups, activeGroupId }: { children: ReactNode; area: "workspace" | "platform"; groups: WorkspaceGroup[]; activeGroupId: string | null; showAdmin?: boolean; }) { const pathname = usePathname(); const [collapsed, setCollapsed] = useState(false); useEffect(() => { try { setCollapsed(localStorage.getItem("manyangles-sidebar-collapsed") === "true"); } catch {} }, []); function togglePanel() { const next = !collapsed; setCollapsed(next); try { localStorage.setItem("manyangles-sidebar-collapsed", String(next)); } catch {} } const workspaces = area === "platform" ? adminWorkspaces : albumWorkspaces; const applicationLabel = area === "platform" ? "Administration" : "Albums"; const activeItem = activeNavigationItem(workspaces, pathname); const activeWorkspace = workspaces.find((workspace) => workspace.items.includes(activeItem!)) ?? workspaces[0]!; const activeGroup = groups.find((group) => group.id === activeGroupId) ?? groups[0]; const signEventId = pathname.match(/^\/dashboard\/events\/([^/]+)\/sign$/)?.[1]; return (