feat: Implement global badge system with Settings model and global PartnerBadge component

This commit is contained in:
Erik
2025-11-29 14:07:47 -03:00
parent 53495de904
commit 70f1541ec0
5 changed files with 163 additions and 32 deletions

View File

@@ -1,28 +1,14 @@
"use client";
import Link from 'next/link';
import { useEffect } from 'react';
import { useLocale } from '@/contexts/LocaleContext';
import { usePageContent } from '@/hooks/usePageContent';
import { PartnerBadge } from './PartnerBadge';
export default function Footer() {
const { locale, t } = useLocale();
const { content } = usePageContent('home', locale);
// Prefixo para links
const prefix = locale === 'pt' ? '' : `/${locale}`;
// Badge do hero (dinâmica)
const badge = content?.hero?.badge || { text: 'Coca-Cola', show: false };
// Recarregar quando conteúdo mudar
useEffect(() => {
const handleRefresh = () => {
window.location.reload();
};
window.addEventListener('translation:refresh', handleRefresh);
return () => window.removeEventListener('translation:refresh', handleRefresh);
}, []);
return (
<footer className="bg-secondary text-white pt-16 pb-8">
@@ -41,12 +27,9 @@ export default function Footer() {
{t('footer.description')}
</p>
{badge?.show && (
<div className="inline-flex items-center gap-2 bg-white/5 border border-white/10 rounded-lg px-3 py-2 mb-6">
<i className="ri-verified-badge-fill text-primary"></i>
<span className="text-xs font-bold text-gray-300 uppercase tracking-wide">{t('home.officialProvider')} <span className="text-primary">{badge.text}</span></span>
</div>
)}
<div className="mb-6">
<PartnerBadge />
</div>
<div className="flex gap-4">
<a href="#" className="w-10 h-10 rounded-full bg-white/10 flex items-center justify-center hover:bg-primary transition-colors">