mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-23 10:08:38 +02:00
44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
"use client";
|
|
|
|
import type { ReactNode } from "react";
|
|
import { SidebarProvider, SidebarInset } from "@multica/ui/components/ui/sidebar";
|
|
import { ModalRegistry } from "../modals/registry";
|
|
import { AppSidebar } from "./app-sidebar";
|
|
import { DashboardGuard } from "./dashboard-guard";
|
|
|
|
interface DashboardLayoutProps {
|
|
children: ReactNode;
|
|
/** Rendered inside SidebarInset (e.g. ChatWindow, ChatFab — absolute-positioned overlays) */
|
|
extra?: ReactNode;
|
|
/** Rendered inside sidebar header as a search trigger */
|
|
searchSlot?: ReactNode;
|
|
/** Loading indicator */
|
|
loadingIndicator?: ReactNode;
|
|
}
|
|
|
|
export function DashboardLayout({
|
|
children,
|
|
extra,
|
|
searchSlot,
|
|
loadingIndicator,
|
|
}: DashboardLayoutProps) {
|
|
return (
|
|
<DashboardGuard
|
|
loadingFallback={
|
|
<div className="flex h-svh items-center justify-center">
|
|
{loadingIndicator}
|
|
</div>
|
|
}
|
|
>
|
|
<SidebarProvider className="h-svh">
|
|
<AppSidebar searchSlot={searchSlot} />
|
|
<SidebarInset className="relative overflow-hidden">
|
|
{children}
|
|
<ModalRegistry />
|
|
{extra}
|
|
</SidebarInset>
|
|
</SidebarProvider>
|
|
</DashboardGuard>
|
|
);
|
|
}
|