add GDPR Banner

This commit is contained in:
achraf
2026-06-07 17:43:45 +02:00
parent 25b9f36686
commit 365b98c7dd
6 changed files with 206 additions and 74 deletions

View File

@@ -1,16 +1,20 @@
import { createContext, useContext } from "react";
export interface AnalyticsPreferenceValue {
enabled: boolean;
disableAnalytics: () => void;
enableAnalytics: () => void;
toggleAnalytics: () => void;
export type ConsentChoice = "pending" | "granted" | "denied";
export interface AnalyticsConsentValue {
choice: ConsentChoice;
isSettingsOpen: boolean;
accept: () => void;
reject: () => void;
openSettings: () => void;
closeSettings: () => void;
}
export const AnalyticsConsentContext =
createContext<AnalyticsPreferenceValue | null>(null);
createContext<AnalyticsConsentValue | null>(null);
export function useAnalyticsConsent(): AnalyticsPreferenceValue {
export function useAnalyticsConsent(): AnalyticsConsentValue {
const context = useContext(AnalyticsConsentContext);
if (!context) {
throw new Error(