diff --git a/apps/web/src/lib/components/Header.svelte b/apps/web/src/lib/components/Header.svelte index e5e7e3e..e9dece8 100644 --- a/apps/web/src/lib/components/Header.svelte +++ b/apps/web/src/lib/components/Header.svelte @@ -2,6 +2,8 @@ import { resolve } from '$app/paths'; import logo from '$lib/assets/logo_governo_PE.png'; import type { Snippet } from 'svelte'; + import { onMount } from 'svelte'; + import { aplicarTemaDaisyUI } from '$lib/utils/temas'; type HeaderProps = { left?: Snippet; @@ -9,6 +11,43 @@ }; const { left, right }: HeaderProps = $props(); + + let themeSelectEl: HTMLSelectElement | null = null; + + function safeGetThemeLS(): string | null { + try { + const t = localStorage.getItem('theme'); + return t && t.trim() ? t : null; + } catch { + return null; + } + } + + onMount(() => { + const persisted = safeGetThemeLS(); + if (persisted) { + // Sincroniza UI + HTML com o valor persistido (evita select ficar "aqua" indevido) + if (themeSelectEl && themeSelectEl.value !== persisted) { + themeSelectEl.value = persisted; + } + aplicarTemaDaisyUI(persisted); + } + }); + + function onThemeChange(e: Event) { + const nextValue = (e.currentTarget as HTMLSelectElement | null)?.value ?? null; + + // Se o theme-change não atualizar (caso comum após login/logout), + // garantimos aqui a persistência + aplicação imediata. + if (nextValue) { + try { + localStorage.setItem('theme', nextValue); + } catch { + // ignore + } + aplicarTemaDaisyUI(nextValue); + } + }
+ + +
+ + +
+ +
+ + +
+ +
+ + +
+ + +
+
+ {atas.length} de {atasTotal.length} +
+ +
+ + {#if loadingAtas} -

Carregando...

+
+ +
{:else if errorAtas} -

{errorAtas}

+
+ {errorAtas} +
{:else} -
- - - - - - - - - - - - {#each atas as ata (ata._id)} - - - - - - + + + + + + {#if atas.length === 0} + + + + {:else} + {#each atas as ata (ata._id)} + + + + + + + + {/each} + {/if} + +
NúmeroSEIEmpresaVigênciaAções
{ata.numero}{ata.numeroSei} - {getEmpresaNome(ata.empresaId)} - - {ata.dataInicio || '-'} a {ata.dataFim || '-'} - - EmpresaVigênciaAções
+
+ {#if atasTotal.length === 0} +

Nenhuma ata cadastrada

+

Clique em “Nova Ata” para cadastrar.

+ {:else} +

Nenhum resultado encontrado

+

Ajuste ou limpe os filtros para ver resultados.

+ {/if} +
+
{ata.numero}{ata.numeroSei} + {getEmpresaNome(ata.empresaId)} + + {ata.dataInicio ? formatarDataBR(ata.dataInicio) : '-'} a + {ata.dataFim ? formatarDataBR(ata.dataFim) : '-'} + {#if ata.dataProrrogacao} + + (prorrogação: {formatarDataBR(ata.dataProrrogacao)}) + {/if} + +
+ + +
+
+
+ {/if} {#if showModal} -
-
+