2025-08-04 17:45:44 +02:00
|
|
|
"use client";
|
|
|
|
|
import { usePathname } from "next/navigation";
|
|
|
|
|
import { useState } from "react";
|
|
|
|
|
import { UserHeaderSection } from "~/components/navbar/login-button";
|
2025-08-28 18:27:07 +02:00
|
|
|
import { MainNav } from "~/components/navbar/main-nav";
|
|
|
|
|
import { MobileNav } from "~/components/navbar/mobile-nav";
|
2025-08-04 17:45:44 +02:00
|
|
|
import { RicercaCommand } from "~/components/navbar/ricerca_command";
|
2025-08-28 18:27:07 +02:00
|
|
|
import { SettingsPopover } from "~/components/navbar/settings-modal";
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
export function SiteHeader() {
|
2025-08-28 18:27:07 +02:00
|
|
|
const pathname = usePathname();
|
|
|
|
|
const [openSidebar, setOpenSidebar] = useState(false);
|
|
|
|
|
const [openUserMenu, setOpenUserMenu] = useState(false);
|
|
|
|
|
const [openUserMenuSidebar, setOpenUserMenuSidebar] = useState(false);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
2025-08-28 18:27:07 +02:00
|
|
|
const handleOpenMenu = (status: boolean) => {
|
|
|
|
|
setOpenUserMenu(status);
|
|
|
|
|
};
|
2025-08-04 17:45:44 +02:00
|
|
|
|
2025-08-28 18:27:07 +02:00
|
|
|
const handleOpenSidebar = (status: boolean) => {
|
|
|
|
|
setOpenSidebar(status);
|
|
|
|
|
};
|
|
|
|
|
return (
|
2025-10-10 16:18:43 +02:00
|
|
|
<header className="sticky top-0 z-50 w-full border-border/40 border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60">
|
2025-08-28 18:27:07 +02:00
|
|
|
<div className="mx-auto flex h-14 w-full items-center pr-3 pl-4 md:pr-4 md:pl-8">
|
|
|
|
|
<MainNav pathname={pathname} />
|
|
|
|
|
<MobileNav
|
|
|
|
|
open={openSidebar}
|
2025-08-29 16:18:32 +02:00
|
|
|
pathname={pathname}
|
2025-08-28 18:27:07 +02:00
|
|
|
setOpen={setOpenSidebar}
|
|
|
|
|
setUserOpen={setOpenUserMenuSidebar}
|
2025-08-29 16:18:32 +02:00
|
|
|
userOpen={openUserMenuSidebar}
|
2025-08-28 18:27:07 +02:00
|
|
|
/>
|
2025-08-04 17:45:44 +02:00
|
|
|
|
2025-08-28 18:27:07 +02:00
|
|
|
<div className="float-end flex flex-1 items-center justify-end gap-0.5">
|
|
|
|
|
<RicercaCommand />
|
2025-08-04 17:45:44 +02:00
|
|
|
|
2025-08-28 18:27:07 +02:00
|
|
|
<div className="hidden md:block">
|
|
|
|
|
<SettingsPopover />
|
|
|
|
|
</div>
|
|
|
|
|
<UserHeaderSection
|
|
|
|
|
key={pathname}
|
|
|
|
|
open={openUserMenu}
|
|
|
|
|
setOpen={handleOpenMenu}
|
|
|
|
|
setSidebar={handleOpenSidebar}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</header>
|
|
|
|
|
);
|
2025-08-04 17:45:44 +02:00
|
|
|
}
|