diff --git a/frontend/app/(dashboard)/layout.tsx b/frontend/app/(dashboard)/layout.tsx index 6b8f386d..1348121f 100644 --- a/frontend/app/(dashboard)/layout.tsx +++ b/frontend/app/(dashboard)/layout.tsx @@ -4,6 +4,13 @@ import Link from "next/link"; import { usePathname } from "next/navigation"; import { cn } from "@/lib/utils"; import { ReactNode } from "react"; +import { useAuthStore } from "../../stores/auth.store"; +import { useShipmentSocket } from "../../hooks/useShipmentSocket"; +import { NotificationBell } from "../../components/notifications/notification-bell"; + +interface DashboardLayoutProps { + children: ReactNode; +} const SHIPPER_NAV = [ { href: '/dashboard', label: 'Dashboard' }, @@ -26,18 +33,37 @@ const ADMIN_NAV = [ { href: '/admin/shipments', label: 'Shipment Oversight' }, ]; +interface DashboardLayoutProps { + children: ReactNode; +} + export default function DashboardLayout({ children }: DashboardLayoutProps) { const pathname = usePathname(); + const user = useAuthStore((state) => state.user); + + // Initialize the WebSocket connection for real-time shipment updates + useShipmentSocket(); + + // Determine nav items based on user role + const getNavItems = () => { + if (!user) return SHIPPER_NAV; + if (user.role === 'admin') return ADMIN_NAV; + if (user.role === 'carrier') return CARRIER_NAV; + return SHIPPER_NAV; + }; + + const navItems = getNavItems(); return (
{/* Sidebar */}