banner and intro fix

This commit is contained in:
Kismet Hasanaj
2026-05-03 01:06:11 +02:00
parent af798cc58c
commit d66c54088a
4 changed files with 106 additions and 32 deletions
+27 -2
View File
@@ -62,11 +62,36 @@ export default function RootLayout({
children,
}: Readonly<{ children: React.ReactNode }>) {
return (
<html lang="en-GB" suppressHydrationWarning>
<html lang="en-GB" suppressHydrationWarning data-ui-ready="0">
<head>
<script
dangerouslySetInnerHTML={{
__html: `
(function () {
var root = document.documentElement;
root.dataset.uiReady = "0";
try {
var consent = window.localStorage.getItem("novarix-cookie-consent");
var introSeen = window.sessionStorage.getItem("novarix-intro-seen");
var shouldShowBanner = consent !== "ack" && consent !== "rst";
var shouldPlayIntro = !shouldShowBanner && !introSeen;
root.dataset.showCookieBanner = shouldShowBanner ? "1" : "0";
root.dataset.showIntro = shouldPlayIntro ? "1" : "0";
} catch (error) {
root.dataset.showCookieBanner = "1";
root.dataset.showIntro = "0";
}
root.dataset.uiReady = "1";
})();
`,
}}
/>
</head>
<body>
{children}
<CookieBanner />
</body>
</html>
);
}
}