import { useState } from "react"; import { cn } from "~/lib/utils"; import { Header } from "./header"; import { Sidebar } from "./sidebar"; import { StrategicAlignmentPopup } from "./strategic-alignment-popup"; interface DashboardLayoutProps { children: React.ReactNode; className?: string; title?: string; } export function DashboardLayout({ children, className, title, }: DashboardLayoutProps) { const [isSidebarCollapsed, setIsSidebarCollapsed] = useState(false); const [isMobileSidebarOpen, setIsMobileSidebarOpen] = useState(false); const [isStrategicAlignmentPopupOpen, setIsStrategicAlignmentPopupOpen] = useState(false); const [currentTitle, setCurrentTitle] = useState( title ?? "صفحه اول" ); const [currentTitleIcon, setCurrentTitleIcon] = useState< React.ComponentType<{ className?: string }> | null | undefined >(undefined); const toggleSidebarCollapse = () => { setIsSidebarCollapsed(!isSidebarCollapsed); }; const toggleMobileSidebar = () => { setIsMobileSidebarOpen(!isMobileSidebarOpen); }; return (
{/* Gradient overlay */}
{/* Mobile sidebar overlay */} {isMobileSidebarOpen && (
setIsMobileSidebarOpen(false)} >
)} {/* Sidebar */}
setIsStrategicAlignmentPopupOpen(true) } onTitleChange={(info) => { setCurrentTitle(info.title); setCurrentTitleIcon(info.icon ?? null); }} />
{/* Main content area */}
{/* Header */}
{/* Main content */}
{children}
); } export default DashboardLayout;