'use client'; import { useState, useEffect } from 'react'; import { t, getLocaleFromPath } from '@/lib/i18n'; import { usePathname } from 'next/navigation'; export function CookieConsent() { const [showBanner, setShowBanner] = useState(false); const [isMounted, setIsMounted] = useState(false); const pathname = usePathname(); const locale = getLocaleFromPath(pathname); useEffect(() => { setIsMounted(true); const consent = localStorage.getItem('cookie-consent'); if (!consent) { setShowBanner(true); } }, []); const handleAccept = () => { localStorage.setItem('cookie-consent', 'accepted'); setShowBanner(false); }; const handleDecline = () => { localStorage.setItem('cookie-consent', 'declined'); setShowBanner(false); }; if (!isMounted || !showBanner) { return null; } return (

{t('cookieConsent.message', locale)} {t('cookieConsent.privacyPolicy', locale)}

); }