import { useState } from "react"; import { cn } from "~/lib/utils"; import { Sidebar } from "./sidebar"; import { Header } from "./header"; import { StrategicAlignmentPopup } from "./strategic-alignment-popup"; import apiService from "~/lib/api"; 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 | 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;