From a4002cb9c074697f560894bd1fed40736259d7b5 Mon Sep 17 00:00:00 2001 From: Cleber Pereira Date: Wed, 10 Jun 2026 12:09:52 -0300 Subject: [PATCH] UEA-PRODEM --- GUIA-DEV.md | 235 ++++++++++++++++++++++ infra/releases/2026-06-10_11-39-21_HML.md | 45 ----- infra/releases/2026-06-10_12-09-52_HML.md | 22 ++ src/App.tsx | 1 + src/pages/Contato.tsx | 68 ++++--- 5 files changed, 298 insertions(+), 73 deletions(-) create mode 100644 GUIA-DEV.md delete mode 100644 infra/releases/2026-06-10_11-39-21_HML.md create mode 100644 infra/releases/2026-06-10_12-09-52_HML.md diff --git a/GUIA-DEV.md b/GUIA-DEV.md new file mode 100644 index 00000000..58004031 --- /dev/null +++ b/GUIA-DEV.md @@ -0,0 +1,235 @@ +# ============================================================================ +# GUIA - Como Subir o ZIP em Desenvolvimento (Dev) +# ============================================================================ + +## 1. DESCOMPACTAR O ZIP + +```bash +# No Mac/Linux: +cd ~/Documentos # ou onde voce guarda os projetos +unzip avanzato-site-v1.5.0-FINAL.zip -d avanzato-site + +# No Windows (PowerShell): +Expand-Archive -Path "avanzato-site-v1.5.0-FINAL.zip" -DestinationPath "avanzato-site" +``` + +--- + +## 2. ENTRAR NA PASTA + +```bash +cd avanzato-site +``` + +Estrutura que voce vera: +``` +avanzato-site/ + src/ ← Codigo fonte React + api/ ← Backend tRPC + Hono + db/ ← Schema do banco + dist/ ← Build pronto (frontend) + public/ ← Imagens, logos, favicon + package.json ← Dependencias + ... +``` + +--- + +## 3. INSTALAR DEPENDENCIAS + +```bash +npm install +``` + +Se der erro de esbuild: +```bash +npm config set allow-scripts true +npm rebuild esbuild --foreground-scripts +``` + +--- + +## 4. CONFIGURAR O BANCO DE DADOS (MySQL) + +O projeto precisa de MySQL rodando. Voce tem 2 opcoes: + +### OPCAO A - MySQL Local (se ja tem instalado) + +```bash +# Verificar se MySQL esta rodando +mysql -u root -p + +# Criar banco de dados +CREATE DATABASE avanzato CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +``` + +Editar o arquivo `.env`: +```bash +# Abrir .env e verificar DATABASE_URL +DATABASE_URL="mysql://root:SUA_SENHA@localhost:3306/avanzato" +``` + +### OPCAO B - Docker (mais facil) + +```bash +# Rodar MySQL em Docker +docker run -d \ + --name mysql-avanzato \ + -e MYSQL_ROOT_PASSWORD=senha123 \ + -e MYSQL_DATABASE=avanzato \ + -p 3306:3306 \ + mysql:8 + +# Esperar 30 segundos e verificar +docker logs mysql-avanzato +``` + +Editar `.env`: +``` +DATABASE_URL="mysql://root:senha123@localhost:3306/avanzato" +``` + +### OPCAO C - Sem banco (frontend apenas) + +Se quiser ver so o frontend, pule para o passo 6 e use: +```bash +npm run build +npx serve dist/ +``` + +--- + +## 5. SINCRONIZAR O BANCO + +```bash +npm run db:push +``` + +Isso cria todas as tabelas automaticamente. + +Para popular com dados iniciais (formulario UEA): +```bash +npx tsx db/seed.ts +``` + +--- + +## 6. INICIAR O SERVIDOR + +```bash +npm run dev +``` + +Acesse: **http://localhost:3000** + +--- + +## 7. COMANDOS UTEIS + +| Comando | O que faz | +|---------|-----------| +| `npm run dev` | Inicia servidor dev (porta 3000) | +| `npm run build` | Build para producao (gera dist/) | +| `npm run check` | Verifica erros de TypeScript | +| `npm run db:push` | Sincroniza schema com o banco | +| `npm start` | Inicia servidor de producao | + +--- + +## 8. PROBLEMAS COMUNS + +### "Cannot find module" +```bash +rm -rf node_modules package-lock.json +npm install +``` + +### "esbuild permission denied" +```bash +npm config set allow-scripts true +npm rebuild esbuild --foreground-scripts +``` + +### "Database connection refused" +```bash +# Verificar se MySQL esta rodando +mysql -u root -p -e "SHOW DATABASES;" + +# Ou com Docker +docker ps | grep mysql +``` + +### Tela branca no navegador +```bash +# Verificar console do navegador (F12) +# Verificar se o backend esta rodando +curl http://localhost:3000/api/trpc/ping +``` + +### Porta 3000 ocupada +```bash +# Mac/Linux +lsof -ti:3000 | xargs kill -9 + +# Windows +netstat -ano | findstr :3000 +taskkill /PID /F +``` + +--- + +## 9. ESTRUTURA DAS ROTAS + +``` +http://localhost:3000/ + / ← Site principal (Home) + /sobre ← Sobre nos + /servicos/* ← 10 paginas de servicos + /tecnologias ← Tecnologias + /ferramentas ← 7 ferramentas gratuitas + /avaliacao ← Avaliador de TI + /cases ← Cases de sucesso + /blog ← Blog + /contato ← Contato + /area-do-cliente ← Painel admin + /formulario/:codigo ← Formulario publico + /uea-prodem-angola ← Ambiente UEA-PRODEM + /status ← Pagina de status/versao +``` + +--- + +## 10. PARA PRODUCAO + +```bash +# 1. Build +npm run build + +# 2. O conteudo fica em dist/ +# 3. Copiar tudo de dist/ para o servidor +# 4. Configurar Nginx (ver nginx/avanzato.conf) +``` + +--- + +## RESUMO RAPIDO + +```bash +# 1x - Setup inicial +cd avanzato-site +npm install +npm config set allow-scripts true +npm rebuild esbuild --foreground-scripts + +# 1x - Banco (se usar MySQL) +npm run db:push +npx tsx db/seed.ts + +# Sempre que quiser rodar +npm run dev +# Acesse: http://localhost:3000 +``` + +--- + +Duvidas? Verifique o arquivo `.env` e confirme que DATABASE_URL esta correto. diff --git a/infra/releases/2026-06-10_11-39-21_HML.md b/infra/releases/2026-06-10_11-39-21_HML.md deleted file mode 100644 index 5950cf9a..00000000 --- a/infra/releases/2026-06-10_11-39-21_HML.md +++ /dev/null @@ -1,45 +0,0 @@ -# Release HML - -Data: qua 10 jun 2026 11:39:21 -03 - -Ambiente: -HML - -Descrição: -UEA-PRODEM - -Branch: -develop - -Arquivos alterados antes do commit: - D infra/releases/2026-06-08_23-50-57_HML.md - M src/App.tsx - M src/config/site.ts - M src/pages/Home.tsx - M src/sections/Navigation.tsx -?? infra/releases/2026-06-10_11-39-21_HML.md -?? public/uea-logo-1.jpg -?? public/uea-logo-2.jpg -?? src/pages/Status.tsx -?? src/pages/area-cliente/UeaProdem.tsx - -Status: -Preparado para publicação - -Commit: -d420d334 - -Arquivos no commit: -infra/releases/2026-06-08_23-50-57_HML.md -infra/releases/2026-06-10_11-39-21_HML.md -public/uea-logo-1.jpg -public/uea-logo-2.jpg -src/App.tsx -src/config/site.ts -src/pages/Home.tsx -src/pages/Status.tsx -src/pages/area-cliente/UeaProdem.tsx -src/sections/Navigation.tsx - -Status final: -Publicado no Gitea / aguardando pipeline HML diff --git a/infra/releases/2026-06-10_12-09-52_HML.md b/infra/releases/2026-06-10_12-09-52_HML.md new file mode 100644 index 00000000..f1658286 --- /dev/null +++ b/infra/releases/2026-06-10_12-09-52_HML.md @@ -0,0 +1,22 @@ +# Release HML + +Data: qua 10 jun 2026 12:09:52 -03 + +Ambiente: +HML + +Descrição: +UEA-PRODEM + +Branch: +develop + +Arquivos alterados antes do commit: + D infra/releases/2026-06-10_11-39-21_HML.md + M src/App.tsx + M src/pages/Contato.tsx +?? GUIA-DEV.md +?? infra/releases/2026-06-10_12-09-52_HML.md + +Status: +Preparado para publicação diff --git a/src/App.tsx b/src/App.tsx index e38707ed..3753560e 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -220,6 +220,7 @@ function App() { {/* UEA-PRODEM Ambiente Personalizado */} } /> + } /> {/* Contato */} } /> diff --git a/src/pages/Contato.tsx b/src/pages/Contato.tsx index 25794d51..a6cdcfc1 100644 --- a/src/pages/Contato.tsx +++ b/src/pages/Contato.tsx @@ -93,42 +93,54 @@ const Contato = () => { return () => ctx.revert(); }, []); - const handleSubmit = (e: React.FormEvent) => { + const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setIsSubmitting(true); - - // Enviar ao Mautic (Form ID 4) - sincrono via iframe - const mauticSuccess = sendLeadToMautic('contato', { - nome: formData.nome, - email: formData.email, - empresa: formData.empresa, - telefone: formData.telefone, - servico_interesse: formData.servico, - mensagem: formData.mensagem, - origem_lead: 'contato_site', - }); - if (!mauticSuccess) { + // Enviar ao Formspree + try { + const response = await fetch('https://formspree.io/f/xwvjqyrr', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Accept': 'application/json', + }, + body: JSON.stringify({ + nome: formData.nome, + email: formData.email, + empresa: formData.empresa, + telefone: formData.telefone, + servico: formData.servico, + mensagem: formData.mensagem, + }), + }); + + if (response.ok) { + setIsSubmitted(true); + setFormData({ nome: '', email: '', empresa: '', telefone: '', servico: '', mensagem: '' }); + + // Google Ads conversion tracking + trackConversion(); + + // Facebook Pixel - Lead + trackFacebookPixel('Lead', { + content_name: 'Formulario Contato', + content_category: 'lead_contato', + }); + + setTimeout(() => setIsSubmitted(false), 5000); + } else { + alert('Erro ao enviar. Tente novamente ou use o WhatsApp.'); + } + } catch { + // Fallback: enviar via mailto se Formspree falhar sendLeadViaMailto({ nome: formData.nome, email: formData.email, }); + } finally { + setIsSubmitting(false); } - - // Google Ads conversion tracking - trackConversion(); - - // Facebook Pixel - Lead - trackFacebookPixel('Lead', { - content_name: 'Formulario Contato', - content_category: 'lead_contato', - }); - - setIsSubmitting(false); - setIsSubmitted(true); - setFormData({ nome: '', email: '', empresa: '', telefone: '', servico: '', mensagem: '' }); - - setTimeout(() => setIsSubmitted(false), 5000); }; const handleChange = (e: React.ChangeEvent) => {