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 DocReviewAlertButton from "@/features/bookingWindows/DocReviewAlertButton"; 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; /** Hide the mobile burger when the shell has no sidebar to open. */ hideSidebarBurger?: boolean; } // 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, hideSidebarBurger = false, }: 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. */} {!hideSidebarBurger && ( )} Search bookings, trains… {/* Right: actions + avatar. The doc-review alarm leads the group — it only renders in the last half of a review phase that still has undecided requests, so it never competes for space otherwise. */} {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;