banner and intro fix
This commit is contained in:
+27
-2
@@ -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>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user