diff --git a/apps/web/src/lib/utils/temas.ts b/apps/web/src/lib/utils/temas.ts
index 4b7975e..9e9d43e 100644
--- a/apps/web/src/lib/utils/temas.ts
+++ b/apps/web/src/lib/utils/temas.ts
@@ -192,3 +192,89 @@ export function obterTemaPadrao(): Tema {
return temasDisponiveis[0]; // Purple
}
+/**
+ * Obter cores CSS do tema atual para usar em gráficos e componentes
+ */
+export function obterCoresDoTema(): {
+ primary: string;
+ success: string;
+ error: string;
+ warning: string;
+ info: string;
+ baseContent: string;
+ base100: string;
+ base200: string;
+ base300: string;
+} {
+ if (typeof window === 'undefined' || typeof document === 'undefined') {
+ // Valores padrão para SSR
+ return {
+ primary: '#667eea',
+ success: '#10b981',
+ error: '#ef4444',
+ warning: '#f59e0b',
+ info: '#3b82f6',
+ baseContent: '#1f2937',
+ base100: '#ffffff',
+ base200: '#f3f4f6',
+ base300: '#e5e7eb'
+ };
+ }
+
+ const htmlElement = document.documentElement;
+ const getComputedStyle = (varName: string): string => {
+ return getComputedStyle(htmlElement).getPropertyValue(varName).trim() || '';
+ };
+
+ // Tentar obter variáveis CSS do DaisyUI
+ const primary = getComputedStyle('--p') || '#667eea';
+ const success = getComputedStyle('--suc') || '#10b981';
+ const error = getComputedStyle('--er') || '#ef4444';
+ const warning = getComputedStyle('--wa') || '#f59e0b';
+ const info = getComputedStyle('--in') || '#3b82f6';
+ const baseContent = getComputedStyle('--bc') || '#1f2937';
+ const base100 = getComputedStyle('--b1') || '#ffffff';
+ const base200 = getComputedStyle('--b2') || '#f3f4f6';
+ const base300 = getComputedStyle('--b3') || '#e5e7eb';
+
+ return {
+ primary: primary || '#667eea',
+ success: success || '#10b981',
+ error: error || '#ef4444',
+ warning: warning || '#f59e0b',
+ info: info || '#3b82f6',
+ baseContent: baseContent || '#1f2937',
+ base100: base100 || '#ffffff',
+ base200: base200 || '#f3f4f6',
+ base300: base300 || '#e5e7eb'
+ };
+}
+
+/**
+ * Converter cor hex para rgba
+ */
+export function hexToRgba(hex: string, alpha: number = 1): string {
+ const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
+ if (!result) return `rgba(102, 126, 234, ${alpha})`;
+
+ const r = parseInt(result[1], 16);
+ const g = parseInt(result[2], 16);
+ const b = parseInt(result[3], 16);
+
+ return `rgba(${r}, ${g}, ${b}, ${alpha})`;
+}
+
+/**
+ * Converter cor hex para rgb
+ */
+export function hexToRgb(hex: string): string {
+ const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
+ if (!result) return 'rgb(102, 126, 234)';
+
+ const r = parseInt(result[1], 16);
+ const g = parseInt(result[2], 16);
+ const b = parseInt(result[3], 16);
+
+ return `rgb(${r}, ${g}, ${b})`;
+}
+
diff --git a/apps/web/src/routes/(dashboard)/ti/notificacoes/+page.svelte b/apps/web/src/routes/(dashboard)/ti/notificacoes/+page.svelte
index 703ce53..498b105 100644
--- a/apps/web/src/routes/(dashboard)/ti/notificacoes/+page.svelte
+++ b/apps/web/src/routes/(dashboard)/ti/notificacoes/+page.svelte
@@ -1467,9 +1467,8 @@
+ class="bg-base-200 text-base-content max-h-64 overflow-y-auto rounded-lg p-4 font-mono text-sm border border-base-300"
+ >
{#if logsEnvio.length === 0}
Aguardando envio de notificação...
{:else}
diff --git a/apps/web/src/routes/+layout.svelte b/apps/web/src/routes/+layout.svelte
index ccab3a2..2115aba 100644
--- a/apps/web/src/routes/+layout.svelte
+++ b/apps/web/src/routes/+layout.svelte
@@ -18,19 +18,30 @@
// Aplicar tema quando o usuário for carregado
$effect(() => {
- if (currentUser?.data?.temaPreferido) {
- // Usuário logado com tema preferido - aplicar tema salvo
- aplicarTema(currentUser.data.temaPreferido);
- } else if (currentUser?.data === null || (currentUser !== undefined && !currentUser.data)) {
- // Usuário não está logado - aplicar tema padrão (roxo)
- aplicarTemaPadrao();
- }
+ if (typeof document === 'undefined') return;
+
+ const htmlElement = document.documentElement;
+
+ // Aguardar um pouco para garantir que o DOM está pronto
+ const timeoutId = setTimeout(() => {
+ if (currentUser?.data?.temaPreferido) {
+ // Usuário logado com tema preferido - aplicar tema salvo
+ aplicarTema(currentUser.data.temaPreferido);
+ } else if (currentUser !== undefined) {
+ // Se a query terminou (mesmo que não haja usuário), aplicar tema padrão
+ if (!htmlElement.getAttribute('data-theme')) {
+ aplicarTemaPadrao();
+ }
+ }
+ }, 50);
+
+ return () => clearTimeout(timeoutId);
});
// Aplicar tema padrão imediatamente ao carregar (antes de verificar usuário)
$effect(() => {
if (typeof document !== 'undefined') {
- // Se não há tema aplicado ainda, aplicar o padrão
+ // Se não há tema aplicado ainda, aplicar o padrão imediatamente
const htmlElement = document.documentElement;
if (!htmlElement.getAttribute('data-theme')) {
aplicarTemaPadrao();