import type { ReactNode } from "react"; import { ArrowLeft, FolderKanban, Globe2, ImageIcon, LayoutDashboard, LogOut, PlusSquare, ShieldAlert, SwatchBook, Tags, } from "lucide-react"; import Link from "next/link"; import { DashboardLayout } from "@/components/dashboard/dashboard-layout"; import { MotionFade } from "@/components/motion-fade"; import { FormSaveButton } from "@/components/root/form-save-button"; import { SidebarMaintenanceControl } from "@/components/root/sidebar-maintenance-control"; import { ThemeToggle } from "@/components/theme-toggle"; import { Button } from "@/components/ui/button"; import { getMaintenanceMode, getSiteSettingsMediaBindings } from "@/lib/app-config"; import { getLocalizedPath } from "@/lib/locale"; import { getRootNavigation } from "@/lib/root-navigation"; import { updateMaintenanceModeAction } from "@/app/root/maintenance/actions"; type RootDashboardCopy = { title: string; subtitle: string; overview: string; maintenance: string; uiKit: string; portfolio: string; media: string; siteSettings: string; logout: string; backToSite: string; }; type RootDashboardShellProps = { copy: RootDashboardCopy; active: "overview" | "maintenance" | "ui-kit" | "portfolio" | "media" | "site-settings"; portfolioChild?: "overview" | "projects" | "new-project" | "categories"; logoutAction: () => Promise; headerTitle: string; headerDescription: string; saveFormId?: string; saveFormSelector?: string; saveButtonLabel?: string; headerActions?: ReactNode; sidebarTopContent?: ReactNode; toolbar?: ReactNode; children: ReactNode; }; export async function RootDashboardShell({ copy, active, portfolioChild, logoutAction, headerTitle, headerDescription, saveFormId, saveFormSelector, saveButtonLabel, headerActions, sidebarTopContent, toolbar, children, }: RootDashboardShellProps) { const [mediaBindings, maintenanceEnabled] = await Promise.all([ getSiteSettingsMediaBindings(), getMaintenanceMode(), ]); const sidebarItems = getRootNavigation(copy, active, portfolioChild).filter( (item) => item.href !== "/root/maintenance" && item.href !== "/root/ui-kit", ); const headerIcon = active === "overview" ? LayoutDashboard : active === "maintenance" ? ShieldAlert : active === "ui-kit" ? SwatchBook : active === "site-settings" ? Globe2 : active === "media" ? ImageIcon : portfolioChild === "categories" ? Tags : portfolioChild === "new-project" ? PlusSquare : FolderKanban; const sharedActions = ( <> ); return ( {sidebarTopContent} } sidebarFooter={ <>
} headerActions={
{headerActions} {sharedActions}
} >
{toolbar ? {toolbar} : null} {children}
); }