import type { ErrorInfo } from "react"; import { Suspense, useState } from "react"; import { cn } from "@/lib/utils"; import type { CoreLayoutProps } from "ra-core"; import { ErrorBoundary } from "react-error-boundary"; import { SidebarProvider, SidebarTrigger } from "@/components/ui/sidebar"; import { UserMenu } from "@/components/admin/user-menu"; import { ThemeModeToggle } from "@/components/admin/theme-mode-toggle"; import { Notification } from "@/components/admin/notification"; import { AppSidebar } from "@/components/admin/app-sidebar"; import { RefreshButton } from "@/components/admin/refresh-button"; import { LocalesMenuButton } from "@/components/admin/locales-menu-button"; import { Error } from "@/components/admin/error"; import { Loading } from "@/components/admin/loading"; /** * The main application layout with sidebar, header, and content area. * * Renders the app structure with a collapsible sidebar, header with breadcrumb navigation, * theme toggle, user menu, and main content area. Includes error boundary and loading states. * * @see {@link https://marmelab.com/shadcn-admin-kit/docs/layout/ Layout documentation} */ export const Layout = (props: CoreLayoutProps) => { const [errorInfo, setErrorInfo] = useState(undefined); const handleError = (_: Error, info: ErrorInfo) => { setErrorInfo(info); }; return (
( )} > }>
{props.children}
); };