From eb461f40eef9323594bb5e9ceb298e99184e49a7 Mon Sep 17 00:00:00 2001 From: Robert Helewka Date: Thu, 16 Apr 2026 06:31:13 -0400 Subject: [PATCH] feat: add dark mode, telemetry, and curl to Docker image - Install `curl` in Dockerfile for healthcheck/tooling support - Add class-based dark mode via Tailwind `@custom-variant` and a pre-paint ` %sveltekit.head% diff --git a/dashboard/src/lib/api.ts b/dashboard/src/lib/api.ts index b3412ce..5c27744 100644 --- a/dashboard/src/lib/api.ts +++ b/dashboard/src/lib/api.ts @@ -1,5 +1,25 @@ import type { LogsResponse, RunResult, StatusResponse } from './types'; +interface TelemetryReport { + type: string; + message: string; + url?: string; + line?: number; + col?: number; + stack?: string; +} + +/** Fire-and-forget client-side error report. Never throws. */ +export function sendTelemetry(report: TelemetryReport): void { + fetch('/api/v1/telemetry', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(report), + }).catch(() => { + // telemetry is best-effort — swallow errors silently + }); +} + export async function fetchStatus(): Promise { const r = await fetch('/api/status'); if (!r.ok) throw new Error(`HTTP ${r.status}`); diff --git a/dashboard/src/routes/+layout.svelte b/dashboard/src/routes/+layout.svelte index 9af2b51..6923a69 100644 --- a/dashboard/src/routes/+layout.svelte +++ b/dashboard/src/routes/+layout.svelte @@ -1,21 +1,91 @@ -
-
+
+
- Nike + Nike
+
diff --git a/dashboard/src/routes/+page.svelte b/dashboard/src/routes/+page.svelte index 228edc0..50e50d5 100644 --- a/dashboard/src/routes/+page.svelte +++ b/dashboard/src/routes/+page.svelte @@ -83,16 +83,16 @@
-

System Status

+

System Status

{#if invalidateMsg} - {invalidateMsg} + {invalidateMsg} {/if} @@ -100,7 +100,7 @@
{#if loadError} -
+
{loadError}
{/if} @@ -109,65 +109,65 @@
-
+
- Database + Database
Host
-
{status.database.host ?? '—'}
+
{status.database.host ?? '—'}
Latency
-
{fmtMs(status.database.latency_ms)}
+
{fmtMs(status.database.latency_ms)}
{#if status.database.version}
Version
-
+
{status.database.version}
{/if} {#if status.database.error} -
{status.database.error}
+
{status.database.error}
{/if}
-
+
- TheSportsDB + TheSportsDB
Latency
-
{fmtMs(status.api.latency_ms)}
+
{fmtMs(status.api.latency_ms)}
{#if status.api.backend}
Backend
-
{status.api.backend}
+
{status.api.backend}
{/if} {#if status.api.error} -
{status.api.error}
+
{status.api.error}
{/if}
-
+
- MCP Server + MCP Server {#if status.mcp.premium} Premium @@ -176,19 +176,19 @@
Transport
-
{status.mcp.transport}
+
{status.mcp.transport}
Uptime
-
{status.mcp.uptime}
+
{status.mcp.uptime}
Tools
-
{status.mcp.tool_count}
+
{status.mcp.tool_count}
Endpoint
-
+
{status.mcp.endpoint}
@@ -199,7 +199,7 @@
-
+

Followed Teams

@@ -210,39 +210,39 @@ {#each status.data.followed as team}
  • - {team.team} - · - {team.league} + {team.team} + · + {team.league}
  • {/each} {/if} {#if status.data.last_cache} -

    +

    Last cache update: {relTime(status.data.last_cache)}

    {/if}
    -
    +

    MCP Tools

    - + {#each status.tools as tool} - + {/each} @@ -252,7 +252,7 @@ {#if Object.keys(status.data.table_counts).length > 0} -
    +

    Database Contents

    @@ -260,7 +260,7 @@ {#each Object.entries(status.data.table_counts) as [table, count]}
    {table}
    -
    {count.toLocaleString()}
    +
    {count.toLocaleString()}
    {/each}
    @@ -271,12 +271,12 @@ {/if} -
    +
    -

    Request Log

    - {logs.length} entries · auto-refreshes every 5 s +

    Request Log

    + {logs.length} entries · auto-refreshes every 5 s
    {#if logs.length === 0}

    No MCP requests yet.

    @@ -284,23 +284,23 @@
    - {tool.name} + {tool.name} {#if tool.premium} {/if} {tool.description}{tool.description}
    - + - + {#each logs as entry} - + -
    Time Tool Args Duration
    {relTime(entry.timestamp)} - {entry.tool} + {entry.tool} + {fmtArgs(entry.args)} diff --git a/dashboard/src/routes/tools/+page.svelte b/dashboard/src/routes/tools/+page.svelte index bf3634c..4a2fa9a 100644 --- a/dashboard/src/routes/tools/+page.svelte +++ b/dashboard/src/routes/tools/+page.svelte @@ -178,8 +178,8 @@
    -

    Tool Runner

    -

    +

    Tool Runner

    +

    Run MCP tools interactively and inspect raw API responses. Useful for spotting strange API results.

    @@ -189,7 +189,7 @@
    -
    +

    Select Tool

    {#each TOOLS as tool} @@ -198,11 +198,11 @@ class="px-3 py-1.5 rounded text-sm font-medium transition-colors {selectedTool.name === tool.name ? 'bg-green-700 text-white' - : 'bg-gray-800 text-gray-300 hover:bg-gray-700 border border-gray-700'}" + : 'bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 border border-gray-200 dark:border-gray-700'}" > {tool.name} {#if tool.premium} - + {/if} {/each} @@ -210,34 +210,34 @@
    -
    +
    -

    {selectedTool.name}

    +

    {selectedTool.name}

    {#if selectedTool.premium} Premium {/if}
    -

    {selectedTool.description}

    +

    {selectedTool.description}

    {#if selectedTool.params.length > 0}
    {#each selectedTool.params as param}
    -