"use client"; import { useEffect, useState } from 'react'; import Link from 'next/link'; import Image from 'next/image'; import { useLocale } from '@/contexts/LocaleContext'; import { PartnerBadge } from './PartnerBadge'; type ContactSettings = { address?: string | null; phone?: string | null; email?: string | null; instagram?: string | null; linkedin?: string | null; facebook?: string | null; whatsapp?: string | null; logo?: string | null; }; export default function Footer() { const { locale, t } = useLocale(); const [contact, setContact] = useState({}); // Prefixo para links const prefix = locale === 'pt' ? '' : `/${locale}`; useEffect(() => { const fetchSettings = async () => { try { const response = await fetch('/api/settings'); if (response.ok) { const data = await response.json(); setContact({ address: data.address, phone: data.phone, email: data.email, instagram: data.instagram, linkedin: data.linkedin, facebook: data.facebook, whatsapp: data.whatsapp, logo: data.logo }); } } catch (error) { console.error('Erro ao carregar configurações:', error); } }; fetchSettings(); // Atualizar quando settings mudar const handleRefresh = () => fetchSettings(); window.addEventListener('settings:refresh', handleRefresh); return () => window.removeEventListener('settings:refresh', handleRefresh); }, []); return ( ); }