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:
@@ -132,17 +132,24 @@ export default function ContatoPage() {
|
|||||||
items: [] as ContactInfo[]
|
items: [] as ContactInfo[]
|
||||||
};
|
};
|
||||||
|
|
||||||
// Montar items dinamicamente baseado nas configurações
|
// Montar items dinamicamente baseado nas configurações (Settings)
|
||||||
const contactItems: ContactInfo[] = [];
|
const contactItems: ContactInfo[] = [];
|
||||||
|
|
||||||
if (settings.whatsapp || settings.phone) {
|
if (settings.whatsapp) {
|
||||||
const phoneNumber = settings.whatsapp || settings.phone;
|
|
||||||
contactItems.push({
|
contactItems.push({
|
||||||
icon: 'ri-whatsapp-line',
|
icon: 'ri-whatsapp-line',
|
||||||
|
title: 'WhatsApp',
|
||||||
|
description: '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: 'Telefone',
|
title: 'Telefone',
|
||||||
description: 'Atendimento de segunda a sexta, das 8h às 18h',
|
description: 'Atendimento de segunda a sexta, das 8h às 18h',
|
||||||
link: settings.whatsapp ? `https://wa.me/55${settings.whatsapp.replace(/\D/g, '')}` : `tel:${phoneNumber?.replace(/\D/g, '')}`,
|
link: `tel:${settings.phone.replace(/\D/g, '')}`,
|
||||||
linkText: phoneNumber || ''
|
linkText: settings.phone
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,7 +157,7 @@ export default function ContatoPage() {
|
|||||||
contactItems.push({
|
contactItems.push({
|
||||||
icon: 'ri-mail-send-line',
|
icon: 'ri-mail-send-line',
|
||||||
title: 'E-mail',
|
title: 'E-mail',
|
||||||
description: 'Responderemos em até 24 horas úteis',
|
description: 'Envie sua mensagem',
|
||||||
link: `mailto:${settings.email}`,
|
link: `mailto:${settings.email}`,
|
||||||
linkText: settings.email
|
linkText: settings.email
|
||||||
});
|
});
|
||||||
@@ -166,8 +173,8 @@ export default function ContatoPage() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Usar items do CMS se existir, senão usar os dinâmicos
|
// Sempre usar os dados das Settings (contactItems)
|
||||||
const displayItems = info.items?.length > 0 ? info.items : contactItems;
|
const displayItems = contactItems;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="bg-white dark:bg-secondary transition-colors duration-300">
|
<main className="bg-white dark:bg-secondary transition-colors duration-300">
|
||||||
|
|||||||
@@ -131,17 +131,24 @@ export default function ContatoPage() {
|
|||||||
items: [] as ContactInfo[]
|
items: [] as ContactInfo[]
|
||||||
};
|
};
|
||||||
|
|
||||||
// Montar items dinamicamente baseado nas configurações
|
// Montar items dinamicamente baseado nas configurações (Settings)
|
||||||
const contactItems: ContactInfo[] = [];
|
const contactItems: ContactInfo[] = [];
|
||||||
|
|
||||||
if (settings.whatsapp || settings.phone) {
|
if (settings.whatsapp) {
|
||||||
const phoneNumber = settings.whatsapp || settings.phone;
|
|
||||||
contactItems.push({
|
contactItems.push({
|
||||||
icon: 'ri-whatsapp-line',
|
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'),
|
title: t('contact.phone'),
|
||||||
description: t('contact.phoneDescription'),
|
description: t('contact.phoneDescription'),
|
||||||
link: settings.whatsapp ? `https://wa.me/55${settings.whatsapp.replace(/\D/g, '')}` : `tel:${phoneNumber?.replace(/\D/g, '')}`,
|
link: `tel:${settings.phone.replace(/\D/g, '')}`,
|
||||||
linkText: phoneNumber || ''
|
linkText: settings.phone
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,7 +156,7 @@ export default function ContatoPage() {
|
|||||||
contactItems.push({
|
contactItems.push({
|
||||||
icon: 'ri-mail-send-line',
|
icon: 'ri-mail-send-line',
|
||||||
title: t('contact.email'),
|
title: t('contact.email'),
|
||||||
description: t('contact.emailDescription'),
|
description: t('contact.emailDescription') || 'Envie sua mensagem',
|
||||||
link: `mailto:${settings.email}`,
|
link: `mailto:${settings.email}`,
|
||||||
linkText: 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
|
// Sempre usar os dados das Settings (contactItems)
|
||||||
const displayItems = info.items?.length > 0 ? info.items : contactItems;
|
const displayItems = contactItems;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="bg-white dark:bg-secondary transition-colors duration-300">
|
<main className="bg-white dark:bg-secondary transition-colors duration-300">
|
||||||
|
|||||||
Reference in New Issue
Block a user