feat: global SiteHeader avec user menu (login/inscription, Mes réservations, Espace hôte, Admin)
All checks were successful
CI / test (pull_request) Successful in 2m9s
All checks were successful
CI / test (pull_request) Successful in 2m9s
This commit is contained in:
parent
4e8b88ab34
commit
3bc52b2b60
5 changed files with 149 additions and 0 deletions
26
src/components/SiteHeaderGuard.tsx
Normal file
26
src/components/SiteHeaderGuard.tsx
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/**
|
||||
* N'affiche le SiteHeader QUE sur les pages publiques.
|
||||
* Sur /admin, le shell admin a déjà sa propre TopBar + Sidebar.
|
||||
* Sur /connexion et /inscription, on garde la page nue.
|
||||
*/
|
||||
|
||||
import { headers } from "next/headers";
|
||||
|
||||
import { SiteHeader } from "./SiteHeader";
|
||||
|
||||
export async function SiteHeaderGuard() {
|
||||
const h = await headers();
|
||||
// Next.js 16 expose le pathname via le header x-pathname si on l'a posé,
|
||||
// sinon on retombe sur next-url ou referer. On utilise une heuristique simple :
|
||||
// pathname depuis x-invoke-path (Next internal) ou x-next-url-path-prefix.
|
||||
const pathname =
|
||||
h.get("x-pathname") ??
|
||||
h.get("x-invoke-path") ??
|
||||
h.get("next-url") ??
|
||||
"";
|
||||
|
||||
if (pathname.startsWith("/admin")) return null;
|
||||
if (pathname === "/connexion" || pathname === "/inscription") return null;
|
||||
|
||||
return <SiteHeader />;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue