'use client'; import { useState, useEffect } from 'react'; import { t, getLocaleFromPath } from '@/lib/i18n'; import { usePathname } from 'next/navigation'; import { Card, CardBody, CardFooter } from '@/components/ui'; import { Button } from '@/components/ui'; export function CookieConsent() { const [showBanner, setShowBanner] = useState(false); const [isMounted, setIsMounted] = useState(false); const [isAnimating, setIsAnimating] = useState(false); const pathname = usePathname(); const locale = getLocaleFromPath(pathname); useEffect(() => { setIsMounted(true); const consent = localStorage.getItem('cookie-consent'); if (!consent) { // Small delay to ensure smooth entrance animation setTimeout(() => { setShowBanner(true); setIsAnimating(true); }, 500); } }, []); const handleAccept = () => { localStorage.setItem('cookie-consent', 'accepted'); setIsAnimating(false); setTimeout(() => setShowBanner(false), 300); }; const handleDecline = () => { localStorage.setItem('cookie-consent', 'declined'); setIsAnimating(false); setTimeout(() => setShowBanner(false), 300); }; if (!isMounted || !showBanner) { return null; } return (

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

); }