import React from "react"; import { cn } from "@app/lib/cn"; import { ListUserOrgsResponse } from "@server/routers/org"; import type { SidebarNavSection } from "@app/app/navigation"; import { LayoutSidebar } from "@app/components/LayoutSidebar"; import { LayoutHeader } from "@app/components/LayoutHeader"; import { LayoutMobileMenu } from "@app/components/LayoutMobileMenu"; import { cookies } from "next/headers"; interface LayoutProps { children: React.ReactNode; orgId?: string; orgs?: ListUserOrgsResponse["orgs"]; navItems?: SidebarNavSection[]; showSidebar?: boolean; showHeader?: boolean; showTopBar?: boolean; defaultSidebarCollapsed?: boolean; } export async function Layout({ children, orgId, orgs, navItems = [], showSidebar = true, showHeader = true, showTopBar = true, defaultSidebarCollapsed = false }: LayoutProps) { const allCookies = await cookies(); const sidebarStateCookie = allCookies.get("pangolin-sidebar-state")?.value; const initialSidebarCollapsed = sidebarStateCookie === "collapsed" || (sidebarStateCookie !== "expanded" && defaultSidebarCollapsed); return (
{/* Desktop Sidebar */} {showSidebar && ( )} {/* Main content area */}
{/* Mobile header */} {showHeader && ( )} {/* Desktop header */} {showHeader && } {/* Main content */}
{children}
); }