"use client"; import { useState } from "react"; import { usePathname } from "next/navigation"; import { useNotificationStore } from "@/store/notificationStore"; import Sidebar from "../Sidebar"; import Header from "../Header"; function getToastStyle(type) { if (type === "success") { return { wrapper: "border-green-500/30 bg-green-500/10 text-green-600 dark:text-green-400", icon: "check_circle", }; } if (type === "error") { return { wrapper: "border-red-500/30 bg-red-500/10 text-red-600 dark:text-red-400", icon: "error", }; } if (type === "warning") { return { wrapper: "border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400", icon: "warning", }; } return { wrapper: "border-blue-500/30 bg-blue-500/10 text-blue-600 dark:text-blue-400", icon: "info", }; } export default function DashboardLayout({ children }) { const [sidebarOpen, setSidebarOpen] = useState(false); const pathname = usePathname(); const notifications = useNotificationStore((state) => state.notifications); const removeNotification = useNotificationStore((state) => state.removeNotification); return (
{notifications.map((n) => { const style = getToastStyle(n.type); return (
{style.icon}
{n.title ?

{n.title}

: null}

{n.message}

{n.dismissible ? ( ) : null}
); })}
{/* Mobile sidebar overlay */} {sidebarOpen && (
setSidebarOpen(false)} /> )} {/* Sidebar - Desktop */}
{/* Sidebar - Mobile */}
setSidebarOpen(false)} />
{/* Main content */}
{/* Faint grid background */}
); }