fix: página de contato agora usa apenas dados das Settings
- Remove lógica que usava items do CMS antigo - Sempre usa dados dinâmicos das Settings (whatsapp, email, endereço) - Corrige ambas versões: (public) e [locale]
This commit is contained in:
@@ -131,17 +131,24 @@ export default function ContatoPage() {
|
||||
items: [] as ContactInfo[]
|
||||
};
|
||||
|
||||
// Montar items dinamicamente baseado nas configurações
|
||||
// Montar items dinamicamente baseado nas configurações (Settings)
|
||||
const contactItems: ContactInfo[] = [];
|
||||
|
||||
if (settings.whatsapp || settings.phone) {
|
||||
const phoneNumber = settings.whatsapp || settings.phone;
|
||||
if (settings.whatsapp) {
|
||||
contactItems.push({
|
||||
icon: 'ri-whatsapp-line',
|
||||
title: 'WhatsApp',
|
||||
description: t('contact.whatsappDescription') || 'Atendimento rápido e direto',
|
||||
link: `https://wa.me/55${settings.whatsapp.replace(/\D/g, '')}`,
|
||||
linkText: settings.whatsapp
|
||||
});
|
||||
} else if (settings.phone) {
|
||||
contactItems.push({
|
||||
icon: 'ri-phone-line',
|
||||
title: t('contact.phone'),
|
||||
description: t('contact.phoneDescription'),
|
||||
link: settings.whatsapp ? `https://wa.me/55${settings.whatsapp.replace(/\D/g, '')}` : `tel:${phoneNumber?.replace(/\D/g, '')}`,
|
||||
linkText: phoneNumber || ''
|
||||
link: `tel:${settings.phone.replace(/\D/g, '')}`,
|
||||
linkText: settings.phone
|
||||
});
|
||||
}
|
||||
|
||||
@@ -149,7 +156,7 @@ export default function ContatoPage() {
|
||||
contactItems.push({
|
||||
icon: 'ri-mail-send-line',
|
||||
title: t('contact.email'),
|
||||
description: t('contact.emailDescription'),
|
||||
description: t('contact.emailDescription') || 'Envie sua mensagem',
|
||||
link: `mailto:${settings.email}`,
|
||||
linkText: settings.email
|
||||
});
|
||||
@@ -165,8 +172,8 @@ export default function ContatoPage() {
|
||||
});
|
||||
}
|
||||
|
||||
// Usar items do CMS se existir, senão usar os dinâmicos
|
||||
const displayItems = info.items?.length > 0 ? info.items : contactItems;
|
||||
// Sempre usar os dados das Settings (contactItems)
|
||||
const displayItems = contactItems;
|
||||
|
||||
return (
|
||||
<main className="bg-white dark:bg-secondary transition-colors duration-300">
|
||||
|
||||
Reference in New Issue
Block a user