feat: atualizar URLs para octtoengenharia.com.br, adicionar SEO dinâmico em projetos e corrigir WhatsApp button

This commit is contained in:
Erik
2025-12-03 17:45:54 -03:00
parent 037072d297
commit 92f3798808
8 changed files with 139 additions and 146 deletions

View File

@@ -6,30 +6,38 @@ import { useState, useEffect } from 'react';
export default function WhatsAppButton() {
const { t } = useLanguage();
const [whatsappLink, setWhatsappLink] = useState('https://wa.me/5535988229445');
const [whatsappLink, setWhatsappLink] = useState('https://wa.me/5513998030036');
const [mounted, setMounted] = useState(false);
useEffect(() => {
// Busca o número do WhatsApp do CMS
fetch('/api/contact-info')
setMounted(true);
// Busca o número do WhatsApp das configurações
fetch('/api/settings')
.then(res => res.json())
.then(data => {
if (data.whatsappLink) {
setWhatsappLink(data.whatsappLink);
if (data.whatsapp) {
const cleanNumber = data.whatsapp.replace(/\D/g, '');
setWhatsappLink(`https://wa.me/${cleanNumber}`);
}
})
.catch(console.error);
}, []);
if (!mounted) {
return null;
}
return (
<Link
href={whatsappLink}
target="_blank"
rel="noopener noreferrer"
className="fixed bottom-6 right-6 z-40 flex flex-row-reverse items-center justify-center bg-[#25D366] text-white w-14 h-14 rounded-full shadow-lg hover:bg-[#20bd5a] transition-all hover:scale-110 group animate-in slide-in-from-bottom-4 duration-700 delay-1000 hover:w-auto hover:px-6"
className="fixed bottom-6 right-6 z-40 flex flex-row-reverse items-center justify-center bg-[#25D366] text-white w-14 h-14 rounded-full shadow-lg hover:bg-[#20bd5a] transition-all duration-300 group"
aria-label={t('whatsapp.label')}
>
<i className="ri-whatsapp-line text-3xl leading-none"></i>
<span className="font-bold max-w-0 overflow-hidden group-hover:max-w-xs group-hover:mr-3 transition-all duration-500 whitespace-nowrap">
<i className="ri-whatsapp-line text-3xl leading-none group-hover:scale-110 transition-transform duration-300"></i>
<span className="font-bold text-sm ml-0 group-hover:ml-2 max-w-0 overflow-hidden group-hover:max-w-xs transition-all duration-300 whitespace-nowrap">
{t('whatsapp.label')}
</span>
</Link>