"use client"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { useAuth } from "@/hooks/use-auth"; import { LogOut, Menu, Settings as SettingsIcon, User } from "lucide-react"; import { Avatar, AvatarFallback, AvatarImage, } from "@/components/ui/avatar"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import { ModeToggle } from "@/components/layout/mode-toggle"; const pageTitles: Record = { "/dashboard": "Dashboard", "/inbox": "Inbox", "/notifications": "Notifications", "/contacts": "Contacts", "/pipelines": "Pipelines", "/broadcasts": "Broadcasts", "/automations": "Automations", "/settings": "Settings", }; function getPageTitle(pathname: string): string { if (pageTitles[pathname]) return pageTitles[pathname]; const match = Object.entries(pageTitles).find(([path]) => pathname.startsWith(path), ); return match ? match[1] : "Dashboard"; } interface HeaderProps { /** Wired to the shell's drawer state. Used only on mobile — the * hamburger button is hidden on lg+. */ onOpenSidebar?: () => void; } export function Header({ onOpenSidebar }: HeaderProps) { const pathname = usePathname(); const { profile, signOut } = useAuth(); const title = getPageTitle(pathname); const initial = profile?.full_name?.charAt(0)?.toUpperCase() ?? profile?.email?.charAt(0)?.toUpperCase() ?? "U"; return (
{/* Hamburger — mobile only. 44×44 hit target per Apple HIG. */}

{title}

{profile?.avatar_url ? ( ) : null} {initial} {profile?.full_name ?? "User"}

{profile?.full_name ?? "User"}

{profile?.email ?? ""}

} > Profile } > Settings Sign out
); }