no-intro
This commit is contained in:
@@ -10,11 +10,9 @@
|
||||
// Behaviour:
|
||||
// - On first load, if no consent decision is stored, the banner appears.
|
||||
// - "ACK" stores `novarix-cookie-consent = "ack"` in localStorage and the
|
||||
// banner closes. The site then behaves as before (intro animation
|
||||
// remembers it has played using sessionStorage).
|
||||
// banner closes.
|
||||
// - "RST" stores `novarix-cookie-consent = "rst"` in localStorage and the
|
||||
// banner closes. We also clear the intro-seen flag so we don't keep any
|
||||
// non-consent storage around.
|
||||
// banner closes.
|
||||
// - The footer "Cookie preferences" link dispatches a window event that
|
||||
// re-opens this banner so users can change their mind.
|
||||
//
|
||||
@@ -26,9 +24,7 @@ import { useEffect, useLayoutEffect, useState } from "react";
|
||||
import { site } from "@/content";
|
||||
|
||||
const CONSENT_KEY = "novarix-cookie-consent";
|
||||
const INTRO_SEEN_KEY = "novarix-intro-seen";
|
||||
const REOPEN_EVENT = "novarix:open-cookie-banner";
|
||||
const INTRO_EVENT = "novarix:start-intro";
|
||||
|
||||
type Consent = "unknown" | "ack" | "rst";
|
||||
|
||||
@@ -61,12 +57,6 @@ export default function CookieBanner() {
|
||||
function decide(choice: "ack" | "rst") {
|
||||
try {
|
||||
window.localStorage.setItem(CONSENT_KEY, choice);
|
||||
if (choice === "rst") {
|
||||
// Honour the rejection by clearing any non-consent storage.
|
||||
window.sessionStorage.removeItem(INTRO_SEEN_KEY);
|
||||
} else {
|
||||
window.dispatchEvent(new Event(INTRO_EVENT));
|
||||
}
|
||||
} catch {
|
||||
/* storage unavailable — nothing to do */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user