/** * 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; // Mode immersif : on cache le header pour donner 100dvh aux Reels if (pathname === "/decouvrir" || pathname.startsWith("/decouvrir/")) return null; return ; }