import { AppShell, Avatar, Box, Burger, Divider, Group, Menu, Text, Tooltip, UnstyledButton, } from "@mantine/core"; import { ChevronDown, FileSignature, Languages, LogOut, Moon, Search, Sun, User, } from "lucide-react"; import { type ReactNode } from "react"; import { useNavigate } from "react-router-dom"; import NotificationBellContainer from "@/features/notifications/NotificationBellContainer"; import type { PageMeta } from "./types"; export interface FreightDashboardHeaderProps { pageMeta: PageMeta; headerRight?: ReactNode; enableThemeToggle?: boolean; userName?: string; userEmail?: string; userInitials?: string; onLogout?: () => void; theme: "light" | "dark"; onToggleTheme: () => void; mobileOpened: boolean; onToggleMobile: () => void; } // Every header control is a consistent 36px frosted chip — same language as the // portal AppLayout's floating "islands". const ISLAND = "flex size-9 shrink-0 items-center justify-center rounded-full border border-edr-border bg-white text-edr-text transition-colors hover:bg-[#F1F4F7]"; const FreightDashboardHeader = ({ headerRight, enableThemeToggle = false, userName = "User", userEmail, userInitials, onLogout, theme, onToggleTheme, mobileOpened, onToggleMobile, }: FreightDashboardHeaderProps) => { const navigate = useNavigate(); const initials = userInitials ?? (userName .split(" ") .filter(Boolean) .slice(0, 2) .map((n) => n[0].toUpperCase()) .join("") || "U"); return ( {/* Left: burger (mobile) + search — the search now occupies the slot the page title used to hold; each page owns its own title. */} Search bookings, trains… {/* Right: actions + avatar */} {enableThemeToggle && ( {theme === "dark" ? ( ) : ( )} )} {/* Avatar pill */} {initials} {userName} {userEmail ?? "Administrator"} {userName} {userEmail && ( {userEmail} )} } onClick={() => navigate("/dashboard/profile")} > Profile } onClick={() => navigate("/dashboard/profile#signature")} > My signature } color="red" onClick={() => onLogout?.()} > Logout {headerRight} ); }; export default FreightDashboardHeader;