Fix page with lint errors #18

Merged
killer-cf merged 5 commits from fix-page-with-lint-errors into master 2025-11-13 11:55:10 +00:00
4 changed files with 40 additions and 27 deletions
Showing only changes of commit a2451baafc - Show all commits

23
AGENTS.md Normal file
View File

@@ -0,0 +1,23 @@
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.

View File

@@ -2,6 +2,7 @@
import { useQuery, useConvexClient } from 'convex-svelte'; import { useQuery, useConvexClient } from 'convex-svelte';
import { api } from '@sgse-app/backend/convex/_generated/api'; import { api } from '@sgse-app/backend/convex/_generated/api';
import { goto } from '$app/navigation'; import { goto } from '$app/navigation';
import { resolve } from '$app/paths';
import type { Id } from '@sgse-app/backend/convex/_generated/dataModel'; import type { Id } from '@sgse-app/backend/convex/_generated/dataModel';
import ProtectedRoute from '$lib/components/ProtectedRoute.svelte'; import ProtectedRoute from '$lib/components/ProtectedRoute.svelte';
@@ -9,18 +10,6 @@
const roles = useQuery(api.roles.listar, {}); const roles = useQuery(api.roles.listar, {});
const funcionarios = useQuery(api.funcionarios.getAll, {}); const funcionarios = useQuery(api.funcionarios.getAll, {});
// Debug - Remover após teste
$effect(() => {
console.log('=== DEBUG PERFIS ===');
console.log('roles:', roles);
console.log('roles?.data:', roles?.data);
console.log('É array?', Array.isArray(roles?.data));
if (roles?.data) {
console.log('Quantidade de perfis:', roles.data.length);
console.log('Perfis:', roles.data);
}
});
// Estados do formulário // Estados do formulário
let nome = $state(''); let nome = $state('');
let email = $state(''); let email = $state('');
@@ -75,19 +64,20 @@
`Usuário criado! SENHA TEMPORÁRIA: ${senhaGerada} - Anote esta senha, ela não será exibida novamente!` `Usuário criado! SENHA TEMPORÁRIA: ${senhaGerada} - Anote esta senha, ela não será exibida novamente!`
); );
setTimeout(() => { setTimeout(() => {
goto('/ti/usuarios'); goto(resolve('/ti/usuarios'));
}, 5000); }, 5000);
} else { } else {
mostrarMensagem('success', 'Usuário criado com sucesso!'); mostrarMensagem('success', 'Usuário criado com sucesso!');
setTimeout(() => { setTimeout(() => {
goto('/ti/usuarios'); goto(resolve('/ti/usuarios'));
}, 2000); }, 2000);
} }
} else { } else {
mostrarMensagem('error', resultado.erro); mostrarMensagem('error', resultado.erro);
} }
} catch (error: any) { } catch (error: unknown) {
mostrarMensagem('error', error.message || 'Erro ao criar usuário'); const message = error instanceof Error ? error.message : String(error);
mostrarMensagem('error', message || 'Erro ao criar usuário');
} finally { } finally {
processando = false; processando = false;
} }
@@ -99,7 +89,7 @@
// Auto-completar ao selecionar funcionário // Auto-completar ao selecionar funcionário
$effect(() => { $effect(() => {
if (funcionarioId && funcionarios?.data) { if (funcionarioId && funcionarios?.data) {
const funcSelecionado = funcionarios.data.find((f: any) => f._id === funcionarioId); const funcSelecionado = funcionarios.data.find((f) => f._id === funcionarioId);
if (funcSelecionado) { if (funcSelecionado) {
email = funcSelecionado.email || email; email = funcSelecionado.email || email;
nome = funcSelecionado.nome || nome; nome = funcSelecionado.nome || nome;
@@ -154,7 +144,7 @@
<p class="text-base-content/60 mt-1">Cadastre um novo usuário no sistema</p> <p class="text-base-content/60 mt-1">Cadastre um novo usuário no sistema</p>
</div> </div>
</div> </div>
<a href="/ti/usuarios" class="btn btn-outline btn-primary gap-2"> <a href={resolve('/ti/usuarios')} class="btn btn-outline btn-primary gap-2">
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
class="h-5 w-5" class="h-5 w-5"
@@ -177,8 +167,8 @@
<!-- Breadcrumbs --> <!-- Breadcrumbs -->
<div class="breadcrumbs mb-6 text-sm"> <div class="breadcrumbs mb-6 text-sm">
<ul> <ul>
<li><a href="/ti/painel-administrativo">Dashboard TI</a></li> <li><a href={resolve('/ti/painel-administrativo')}>Dashboard TI</a></li>
<li><a href="/ti/usuarios">Usuários</a></li> <li><a href={resolve('/ti/usuarios')}>Usuários</a></li>
<li>Criar Usuário</li> <li>Criar Usuário</li>
</ul> </ul>
</div> </div>
@@ -254,7 +244,7 @@
> >
<option value="">Selecione um funcionário para auto-completar dados</option> <option value="">Selecione um funcionário para auto-completar dados</option>
{#if funcionarios?.data} {#if funcionarios?.data}
{#each funcionarios.data as func} {#each funcionarios.data as func (func._id)}
<option value={func._id}>{func.nome} - Mat: {func.matricula}</option> <option value={func._id}>{func.nome} - Mat: {func.matricula}</option>
{/each} {/each}
{/if} {/if}
@@ -312,7 +302,7 @@
> >
<option value="">Selecione um perfil</option> <option value="">Selecione um perfil</option>
{#if roles?.data && Array.isArray(roles.data)} {#if roles?.data && Array.isArray(roles.data)}
{#each roles.data as role} {#each roles.data as role (role._id)}
<option value={role._id}> <option value={role._id}>
{role.descricao} ({role.nome}) {role.descricao} ({role.nome})
</option> </option>
@@ -484,7 +474,7 @@
<li>O usuário deverá alterar a senha no primeiro acesso</li> <li>O usuário deverá alterar a senha no primeiro acesso</li>
<li>As credenciais devem ser repassadas manualmente (por enquanto)</li> <li>As credenciais devem ser repassadas manualmente (por enquanto)</li>
<li> <li>
Configure o SMTP em <a href="/ti/configuracoes-email" class="link" Configure o SMTP em <a href={resolve('/ti/configuracoes-email')} class="link"
>Configurações de Email</a >Configurações de Email</a
> para envio automático > para envio automático
</li> </li>
@@ -493,7 +483,7 @@
</div> </div>
<div class="card-actions border-base-300 mt-8 justify-end border-t pt-6"> <div class="card-actions border-base-300 mt-8 justify-end border-t pt-6">
<a href="/ti/usuarios" class="btn gap-2" class:btn-disabled={processando}> <a href={resolve('/ti/usuarios')} class="btn gap-2" class:btn-disabled={processando}>
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
class="h-5 w-5" class="h-5 w-5"