From ce94eb53b363579a1c8d7a116e39013af7773722 Mon Sep 17 00:00:00 2001 From: killer-cf Date: Fri, 21 Nov 2025 14:02:22 -0300 Subject: [PATCH 1/4] generated file --- packages/backend/convex/_generated/api.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/backend/convex/_generated/api.d.ts b/packages/backend/convex/_generated/api.d.ts index 14944ae..eab189a 100644 --- a/packages/backend/convex/_generated/api.d.ts +++ b/packages/backend/convex/_generated/api.d.ts @@ -29,8 +29,8 @@ import type * as cursos from "../cursos.js"; import type * as dashboard from "../dashboard.js"; import type * as documentos from "../documentos.js"; import type * as email from "../email.js"; -import type * as enderecosMarcacao from "../enderecosMarcacao.js"; import type * as empresas from "../empresas.js"; +import type * as enderecosMarcacao from "../enderecosMarcacao.js"; import type * as ferias from "../ferias.js"; import type * as funcionarioEnderecos from "../funcionarioEnderecos.js"; import type * as funcionarios from "../funcionarios.js"; @@ -84,8 +84,8 @@ declare const fullApi: ApiFromModules<{ dashboard: typeof dashboard; documentos: typeof documentos; email: typeof email; - enderecosMarcacao: typeof enderecosMarcacao; empresas: typeof empresas; + enderecosMarcacao: typeof enderecosMarcacao; ferias: typeof ferias; funcionarioEnderecos: typeof funcionarioEnderecos; funcionarios: typeof funcionarios; -- 2.49.1 From b8a2e67f3a89253d90b83792140ca56ed46a5274 Mon Sep 17 00:00:00 2001 From: killer-cf Date: Sat, 22 Nov 2025 10:25:43 -0300 Subject: [PATCH 2/4] refactor: Update email configuration page to load data once and improve error handling, and add Svelte agent rules documentation. --- .agent/rules/svelte-rules.md | 28 + .../ti/configuracoes-email/+page.svelte | 1034 ++++++++--------- 2 files changed, 530 insertions(+), 532 deletions(-) create mode 100644 .agent/rules/svelte-rules.md diff --git a/.agent/rules/svelte-rules.md b/.agent/rules/svelte-rules.md new file mode 100644 index 0000000..30b100a --- /dev/null +++ b/.agent/rules/svelte-rules.md @@ -0,0 +1,28 @@ +--- +trigger: glob +globs: **/*.svelte.ts,**/*.svelte +--- + +You are able to use the Svelte MCP server, where you have access to comprehensive Svelte 5 and SvelteKit documentation. Here's how to use the available tools effectively: + +## Available MCP Tools: + +### 1. list-sections + +Use this FIRST to discover all available documentation sections. Returns a structured list with titles, use_cases, and paths. +When asked about Svelte or SvelteKit topics, ALWAYS use this tool at the start of the chat to find relevant sections. + +### 2. get-documentation + +Retrieves full documentation content for specific sections. Accepts single or multiple sections. +After calling the list-sections tool, you MUST analyze the returned documentation sections (especially the use_cases field) and then use the get-documentation tool to fetch ALL documentation sections that are relevant for the user's task. + +### 3. svelte-autofixer + +Analyzes Svelte code and returns issues and suggestions. +You MUST use this tool whenever writing Svelte code before sending it to the user. Keep calling it until no issues or suggestions are returned. + +### 4. playground-link + +Generates a Svelte Playground link with the provided code. +After completing the code, ask the user if they want a playground link. Only call this tool after user confirmation and NEVER if code was written to files in their project. diff --git a/apps/web/src/routes/(dashboard)/ti/configuracoes-email/+page.svelte b/apps/web/src/routes/(dashboard)/ti/configuracoes-email/+page.svelte index 15a7f1a..3e316e6 100644 --- a/apps/web/src/routes/(dashboard)/ti/configuracoes-email/+page.svelte +++ b/apps/web/src/routes/(dashboard)/ti/configuracoes-email/+page.svelte @@ -1,574 +1,544 @@ -
- -
-
-
- - - -
-
-

- Configurações de Email (SMTP) -

-

- Configurar servidor de email para envio de notificações -

-
-
-
+
+ +
+
+
+ + + +
+
+

Configurações de Email (SMTP)

+

+ Configurar servidor de email para envio de notificações +

+
+
+
- - {#if mensagem} -
- - {#if mensagem.tipo === "success"} - - {:else} - - {/if} - - {mensagem.texto} -
- {/if} + + {#if mensagem} +
+ + {#if mensagem.tipo === 'success'} + + {:else} + + {/if} + + {mensagem.texto} +
+ {/if} - - {#if isLoading} -
- - Carregando configurações... -
- {/if} + + {#if isLoading} +
+ + Carregando configurações... +
+ {/if} - - {#if !isLoading} -
- - {#if configAtual?.data?.ativo} - - {:else} - - {/if} - - - Status: - {statusConfig} - {#if configAtual?.data?.testadoEm} - - Última conexão testada em {new Date( - configAtual.data.testadoEm, - ).toLocaleString("pt-BR")} - {/if} - -
- {/if} + + {#if !isLoading} +
+ + {#if configAtual?.data?.ativo} + + {:else} + + {/if} + + + Status: + {statusConfig} + {#if configAtual?.data?.testadoEm} + - Última conexão testada em {new Date(configAtual.data.testadoEm).toLocaleString('pt-BR')} + {/if} + +
+ {/if} - - {#if !isLoading} -
-
-

Dados do Servidor SMTP

+ + {#if !isLoading} +
+
+

Dados do Servidor SMTP

-
- -
- - -
- Ex: smtp.gmail.com, smtp.office365.com -
-
+
+ +
+ + +
+ Ex: smtp.gmail.com, smtp.office365.com +
+
- -
- - -
- Comum: 587 (TLS), 465 (SSL), 25 -
-
+ +
+ + +
+ Comum: 587 (TLS), 465 (SSL), 25 +
+
- -
- - -
+ +
+ + +
- -
- - -
- - {#if configAtual?.data?.ativo} - Deixe em branco para manter a senha atual - {:else} - Digite a senha da conta de email - {/if} - -
-
+ +
+ + +
+ + {#if configAtual?.data?.ativo} + Deixe em branco para manter a senha atual + {:else} + Digite a senha da conta de email + {/if} + +
+
- -
- - -
+ +
+ + +
- -
- - -
-
+ +
+ + +
+
- -
-

Configurações de Segurança

+ +
+

Configurações de Segurança

-
-
- -
+
+
+ +
-
- -
-
+
+ +
+
- -
- + +
+ - -
-
-
- {/if} + +
+
+
+ {/if} - -
-
-

Exemplos de Configuração

+ +
+
+

Exemplos de Configuração

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ProvedorServidorPortaSegurança
Gmailsmtp.gmail.com587TLS
Outlook/Office365smtp.office365.com587TLS
Yahoosmtp.mail.yahoo.com465SSL
SendGridsmtp.sendgrid.net587TLS
-
-
-
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ProvedorServidorPortaSegurança
Gmailsmtp.gmail.com587TLS
Outlook/Office365smtp.office365.com587TLS
Yahoosmtp.mail.yahoo.com465SSL
SendGridsmtp.sendgrid.net587TLS
+
+
+
- -
- - - -
-

- Dica de Segurança: Para Gmail e outros provedores, você - pode precisar gerar uma "senha de app" específica em vez de usar sua senha - principal. -

-

- Gmail: Conta Google → Segurança → Verificação em duas etapas → Senhas de - app -

-
-
+ +
+ + + +
+

+ Dica de Segurança: Para Gmail e outros provedores, você pode precisar gerar + uma "senha de app" específica em vez de usar sua senha principal. +

+

+ Gmail: Conta Google → Segurança → Verificação em duas etapas → Senhas de app +

+
+
-- 2.49.1 From a3eab60fcd011a13745c3fc394c86564e973350c Mon Sep 17 00:00:00 2001 From: deyvisonwanderley Date: Sun, 23 Nov 2025 16:24:58 -0300 Subject: [PATCH 3/4] feat: enhance modal positioning and styling across components - Implemented dynamic positioning for modals in ErrorModal, ComprovantePonto, and RegistroPonto components to ensure they are centered based on the viewport and container dimensions. - Updated modal styles to improve visual consistency, including backdrop opacity adjustments and enhanced animations. - Refactored modal handling logic to include scroll and resize event listeners for better responsiveness during user interactions. --- apps/web/src/lib/components/ErrorModal.svelte | 96 +++++- .../components/ponto/ComprovantePonto.svelte | 291 ++++++++++++++---- .../lib/components/ponto/RegistroPonto.svelte | 118 ++++++- 3 files changed, 423 insertions(+), 82 deletions(-) diff --git a/apps/web/src/lib/components/ErrorModal.svelte b/apps/web/src/lib/components/ErrorModal.svelte index 8367d76..bbefe71 100644 --- a/apps/web/src/lib/components/ErrorModal.svelte +++ b/apps/web/src/lib/components/ErrorModal.svelte @@ -11,6 +11,92 @@ let { open = $bindable(false), title = 'Erro', message, details, onClose }: Props = $props(); + let modalPosition = $state<{ top: number; left: number } | null>(null); + + // Função para calcular a posição baseada no container central da página + function calcularPosicaoModal() { + // Procurar pelo elemento container-central + const containerCentral = document.getElementById('container-central'); + + if (containerCentral) { + const rect = containerCentral.getBoundingClientRect(); + const viewportWidth = window.innerWidth; + const viewportHeight = window.innerHeight; + + // Centralizar baseado na largura do container central + const containerCenterX = rect.left + (rect.width / 2); + const containerTop = rect.top; + + // Posicionar o modal centralizado verticalmente na viewport, mas respeitando o container + const top = Math.max(50, Math.min(containerTop + 100, viewportHeight / 2)); + + return { + top: top, + left: containerCenterX + }; + } + + // Se não encontrar, usar posição padrão (centro da tela) + return null; + } + + $effect(() => { + if (open) { + // Aguardar um pouco para garantir que o DOM está atualizado + setTimeout(() => { + modalPosition = calcularPosicaoModal(); + }, 10); + + // Adicionar listener de scroll para atualizar posição + const handleScroll = () => { + modalPosition = calcularPosicaoModal(); + }; + + window.addEventListener('scroll', handleScroll, true); + window.addEventListener('resize', handleScroll); + + return () => { + window.removeEventListener('scroll', handleScroll, true); + window.removeEventListener('resize', handleScroll); + }; + } + }); + + // Função para obter estilo do modal baseado na posição calculada + function getModalStyle() { + if (modalPosition) { + // Garantir que o modal não saia da viewport + const viewportWidth = window.innerWidth; + const viewportHeight = window.innerHeight; + const modalWidth = 700; // Aproximadamente max-w-2xl + const modalHeight = Math.min(viewportHeight * 0.9, 600); + + let left = modalPosition.left; + let top = modalPosition.top; + + // Ajustar se o modal sair da viewport à direita + if (left + (modalWidth / 2) > viewportWidth) { + left = viewportWidth - (modalWidth / 2) - 20; + } + // Ajustar se o modal sair da viewport à esquerda + if (left - (modalWidth / 2) < 20) { + left = (modalWidth / 2) + 20; + } + // Ajustar se o modal sair da viewport abaixo + if (top + modalHeight > viewportHeight) { + top = viewportHeight - modalHeight - 20; + } + // Ajustar se o modal sair da viewport acima + if (top < 20) { + top = 20; + } + + return `position: fixed; top: ${top}px; left: ${left}px; transform: translate(-50%, 0); max-width: ${Math.min(modalWidth, viewportWidth - 40)}px;`; + } + // Se não houver posição calculada, centralizar na tela + return 'position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);'; + } + // Verificar se details contém instruções ou apenas detalhes técnicos const temInstrucoes = $derived.by(() => { if (!details) return false; @@ -31,22 +117,22 @@ {#if open}