"use client" import { useState, useRef, useEffect } from "react" import { Icon, addCollection } from "@iconify/react" import { icons as mdiIcons } from "@iconify-json/mdi" import { Menu, Search, SlidersHorizontal, Pencil } from "lucide-react" import { Button } from "@/components/ui/button" addCollection(mdiIcons) import { Input } from "@/components/ui/input" import { UltiMailLogo } from "@/components/ultimail-logo" import { cn } from "@/lib/utils" interface HeaderProps { onToggleSidebar: () => void /** Match `
` horizontal offset (same width as sidebar rail spacer). */ sidebarCollapsed: boolean isXs?: boolean } const googleApps = [ { name: "Compte", icon: "/compte-mark.svg" }, { name: "Agenda", icon: "/agenda-mark.svg" }, { name: "Photos", icon: "/photos-mark.svg" }, { name: "Ultimail", icon: "/brand/ultimail-header-icon.png" }, { name: "UltiDrive", icon: "/ultidrive-mark.svg" }, { name: "UltiMeet", icon: "/ultimeet-mark.svg" }, { name: "Administration", icon: "/admin-mark.svg" }, { name: "OpenMaps", icon: "/openstreetmap-mark.svg" }, { name: "Mistral", icon: "/mistral-mark.svg" }, { name: "Qwant", icon: "/qwant-mark.svg" }, { name: "Ground News", icon: "/ground-news-mark.svg" }, ] export function Header({ onToggleSidebar, sidebarCollapsed, isXs = false, }: HeaderProps) { const [appsMenuOpen, setAppsMenuOpen] = useState(false) const menuRef = useRef(null) useEffect(() => { function handleClickOutside(event: MouseEvent) { if (menuRef.current && !menuRef.current.contains(event.target as Node)) { setAppsMenuOpen(false) } } document.addEventListener("mousedown", handleClickOutside) return () => document.removeEventListener("mousedown", handleClickOutside) }, []) return (
{/* Rail width = page spacer so search left edge lines up with `
`. */}
{!sidebarCollapsed && !isXs && (
)}
{sidebarCollapsed && (
)} {/* Google Apps Menu */}
{appsMenuOpen && (
Vos favoris
{googleApps.map((app) => ( ))}
)}
) }