Add i18n to home sections, improve consent management and middleware asset handling

Co-authored-by: dennis <dennis@konkol.net>
This commit is contained in:
Cursor Agent
2026-01-12 15:57:28 +00:00
parent 6a4055500b
commit 683735cc63
11 changed files with 173 additions and 85 deletions

View File

@@ -38,9 +38,11 @@ function writeConsentCookie(value: ConsentState) {
const ConsentContext = createContext<{
consent: ConsentState | null;
setConsent: (next: ConsentState) => void;
resetConsent: () => void;
}>({
consent: null,
setConsent: () => {},
resetConsent: () => {},
});
export function ConsentProvider({ children }: { children: React.ReactNode }) {
@@ -55,7 +57,16 @@ export function ConsentProvider({ children }: { children: React.ReactNode }) {
writeConsentCookie(next);
}, []);
const value = useMemo(() => ({ consent, setConsent }), [consent, setConsent]);
const resetConsent = useCallback(() => {
setConsentState(null);
// expire cookie
document.cookie = `${COOKIE_NAME}=; path=/; max-age=0; samesite=lax`;
}, []);
const value = useMemo(
() => ({ consent, setConsent, resetConsent }),
[consent, setConsent, resetConsent],
);
return <ConsentContext.Provider value={value}>{children}</ConsentContext.Provider>;
}