diff --git a/shared/media-backend/README.md b/shared/media-backend/README.md index 3c3a21a..cf59241 100644 --- a/shared/media-backend/README.md +++ b/shared/media-backend/README.md @@ -1,6 +1,6 @@ # MediaCollection Go backend -The backend is one Go module. Set `MEDIA_SERVICE` to `viewer`, `tools`, `analyzer`, `config`, `moderator`, `kiosk`, `servant`, or `desktop` to select the route set while keeping the same auth, database, migration, file-safety, and worker implementation. +The backend is one Go module. Set `MEDIA_SERVICE` to `viewer`, `tools`, `analyzer`, `config`, `moderator`, `kiosk`, or `servant` to select the route set while keeping the same auth, database, migration, file-safety, and worker implementation. From this directory: diff --git a/shared/media-backend/internal/auth/auth.go b/shared/media-backend/internal/auth/auth.go index ffca852..da52081 100644 --- a/shared/media-backend/internal/auth/auth.go +++ b/shared/media-backend/internal/auth/auth.go @@ -131,6 +131,7 @@ import ( "golang.org/x/crypto/bcrypt" sharedauth "repos.gfranz.ch/Gabriel20xx/shared/backend/auth" authclient "repos.gfranz.ch/Gabriel20xx/shared/backend/authclient" + "repos.gfranz.ch/Gabriel20xx/shared/backend/authproxy" ) // User is this service's own /auth/... response shape - UNCHANGED from @@ -222,25 +223,14 @@ func UserFromContext(ctx context.Context) *User { // sessionToken reads the AuthGuard session cookie off the incoming request. // See the top-of-file doc comment's "Session cookie / token model" section. func (s *Service) sessionToken(r *http.Request) string { - cookie, err := r.Cookie(authclient.DefaultCookieName) - if err != nil || cookie.Value == "" { - return "" - } - return cookie.Value + return authproxy.SessionToken(r) } // clearSessionCookies clears both the AuthGuard cookie (as a fallback - // normally AuthGuard's own Set-Cookie, forwarded via authclient.ForwardCookies, // already does this) and the pre-migration cookie name. func (s *Service) clearSessionCookies(w http.ResponseWriter) { - http.SetCookie(w, &http.Cookie{ - Name: authclient.DefaultCookieName, Value: "", Path: "/", HttpOnly: true, - Secure: s.secureCookies, SameSite: http.SameSiteLaxMode, MaxAge: -1, - }) - http.SetCookie(w, &http.Cookie{ - Name: s.cookieName, Value: "", Path: "/", HttpOnly: true, - Secure: s.secureCookies, SameSite: http.SameSiteLaxMode, MaxAge: -1, - }) + authproxy.ClearSessionCookies(w, s.cookieName, s.secureCookies) } // toUser translates AuthGuard's PublicUser into this service's own User @@ -1144,9 +1134,8 @@ func (s *Service) SetPassword(ctx context.Context, id int64, password string) er // non-APIError (a transport failure actually reaching AuthGuard) falls back // to a generic 500 with fallbackMessage. func writeAuthGuardError(w http.ResponseWriter, err error, fallbackMessage string) { - var apiErr *authclient.APIError - if errors.As(err, &apiErr) { - writeError(w, apiErr.StatusCode, apiErr.Message) + if statusCode, message, ok := authproxy.APIErrorResponse(err); ok { + writeError(w, statusCode, message) return } writeError(w, http.StatusInternalServerError, fallbackMessage) diff --git a/shared/media-backend/internal/config/config.go b/shared/media-backend/internal/config/config.go index 2f7a183..06a23ef 100644 --- a/shared/media-backend/internal/config/config.go +++ b/shared/media-backend/internal/config/config.go @@ -18,7 +18,6 @@ const ( Moderator Service = "moderator" Kiosk Service = "kiosk" Servant Service = "servant" - Desktop Service = "desktop" ) type Config struct { @@ -137,8 +136,6 @@ func normalizeService(value string) Service { return Kiosk case "servant", "mediaservant": return Servant - case "desktop", "mediadesktop": - return Desktop default: return "" } @@ -160,8 +157,6 @@ func serviceName(service Service) string { return "MediaKiosk" case Servant: return "MediaServant" - case Desktop: - return "MediaDesktop" default: return "MediaCollection" } diff --git a/shared/media-backend/internal/server/admin_storage.go b/shared/media-backend/internal/server/admin_storage.go index db08f38..7370fbe 100644 --- a/shared/media-backend/internal/server/admin_storage.go +++ b/shared/media-backend/internal/server/admin_storage.go @@ -1060,12 +1060,6 @@ func (s *Server) kioskStatus(w http.ResponseWriter, r *http.Request) { writeJSON(w, http.StatusOK, map[string]any{"ok": true, "latestImage": latest, "queueLength": 0}) } -func (s *Server) mountDesktopRoutes(r chi.Router) { - r.Get("/status", func(w http.ResponseWriter, _ *http.Request) { - writeJSON(w, http.StatusOK, map[string]any{"ok": true, "service": "MediaDesktop", "native": true}) - }) -} - func (s *Server) mountKioskSocket(r chi.Router) { r.Get("/ws", s.kioskWebsocket) } diff --git a/shared/media-backend/internal/server/server.go b/shared/media-backend/internal/server/server.go index 96d127f..e0b7c9f 100644 --- a/shared/media-backend/internal/server/server.go +++ b/shared/media-backend/internal/server/server.go @@ -223,8 +223,6 @@ func (s *Server) mountServiceRoutes(r chi.Router) { s.mountKioskRoutes(r) case config.Servant: s.mountServantRoutes(r) - case config.Desktop: - s.mountDesktopRoutes(r) } } diff --git a/shared/media-webui/package.json b/shared/media-webui/package.json index 961f011..10711cf 100644 --- a/shared/media-webui/package.json +++ b/shared/media-webui/package.json @@ -14,7 +14,6 @@ "build:moderator": "node scripts/build-all.mjs moderator", "build:kiosk": "node scripts/build-all.mjs kiosk", "build:servant": "node scripts/build-all.mjs servant", - "build:desktop": "node scripts/build-all.mjs desktop", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "lint": "eslint .", "format": "prettier --write .", diff --git a/shared/media-webui/project-icons.json b/shared/media-webui/project-icons.json index efa1845..dbab482 100644 --- a/shared/media-webui/project-icons.json +++ b/shared/media-webui/project-icons.json @@ -5,6 +5,5 @@ "config": { "name": "MediaConfig", "icon": "settings-2" }, "moderator": { "name": "MediaModerator", "icon": "shield-check" }, "kiosk": { "name": "MediaKiosk", "icon": "image" }, - "servant": { "name": "MediaServant", "icon": "server" }, - "desktop": { "name": "MediaViewer Desktop", "icon": "monitor-play" } + "servant": { "name": "MediaServant", "icon": "server" } } diff --git a/shared/media-webui/scripts/build-all.mjs b/shared/media-webui/scripts/build-all.mjs index c6ee349..9346b96 100644 --- a/shared/media-webui/scripts/build-all.mjs +++ b/shared/media-webui/scripts/build-all.mjs @@ -12,7 +12,6 @@ const targets = { moderator: 'MediaModerator', kiosk: 'MediaKiosk', servant: 'MediaServant', - desktop: 'MediaDesktop', } const requested = process.argv.slice(2) diff --git a/shared/media-webui/src/lib/app-config.ts b/shared/media-webui/src/lib/app-config.ts index 0427f4b..6a19e61 100644 --- a/shared/media-webui/src/lib/app-config.ts +++ b/shared/media-webui/src/lib/app-config.ts @@ -238,29 +238,6 @@ const configs: Record = { }, ], }, - desktop: { - id: 'desktop', - name: 'MediaViewer Desktop', - icon: projectIcon('desktop'), - eyebrow: 'Connected player', - description: 'Control playback, funscripts, and connected devices from your desktop.', - nav: [ - { - label: 'Player', - panel: 'player', - path: '/', - icon: 'monitor-play', - description: 'Control playback and connected desktop devices.', - }, - { - label: 'Devices', - panel: 'devices', - path: '/devices', - icon: 'box', - description: 'Manage connected playback and funscript devices.', - }, - ], - }, } export function getAppConfig(id: string): AppConfig { diff --git a/shared/media-webui/src/lib/components/AnalyzerHistory.svelte b/shared/media-webui/src/lib/components/AnalyzerHistory.svelte index 6928301..b8dfbf8 100644 --- a/shared/media-webui/src/lib/components/AnalyzerHistory.svelte +++ b/shared/media-webui/src/lib/components/AnalyzerHistory.svelte @@ -1,11 +1,7 @@ - -
- -
-

{title}

-

{message}

-
-
diff --git a/shared/media-webui/src/lib/components/PipelineFlowDiagram.svelte b/shared/media-webui/src/lib/components/PipelineFlowDiagram.svelte index 23b40bd..31de7f9 100644 --- a/shared/media-webui/src/lib/components/PipelineFlowDiagram.svelte +++ b/shared/media-webui/src/lib/components/PipelineFlowDiagram.svelte @@ -1,6 +1,6 @@ - -
-
-

{title}

- {#if description}

{description}

{/if} -
-
diff --git a/shared/media-webui/src/lib/components/SettingsDialog.svelte b/shared/media-webui/src/lib/components/SettingsDialog.svelte index 9381092..83ba014 100644 --- a/shared/media-webui/src/lib/components/SettingsDialog.svelte +++ b/shared/media-webui/src/lib/components/SettingsDialog.svelte @@ -1,6 +1,6 @@ -{#if open} - -{/if} + + + diff --git a/shared/media-webui/src/lib/components/StatusDialog.svelte b/shared/media-webui/src/lib/components/StatusDialog.svelte deleted file mode 100644 index 8660f0a..0000000 --- a/shared/media-webui/src/lib/components/StatusDialog.svelte +++ /dev/null @@ -1,102 +0,0 @@ - - -{#if open} - -{/if} diff --git a/shared/media-webui/src/lib/components/StatusWidget.svelte b/shared/media-webui/src/lib/components/StatusWidget.svelte deleted file mode 100644 index 5373b99..0000000 --- a/shared/media-webui/src/lib/components/StatusWidget.svelte +++ /dev/null @@ -1,97 +0,0 @@ - - - - - diff --git a/shared/media-webui/src/lib/components/WorkspacePage.svelte b/shared/media-webui/src/lib/components/WorkspacePage.svelte index b82d6e4..e6eb851 100644 --- a/shared/media-webui/src/lib/components/WorkspacePage.svelte +++ b/shared/media-webui/src/lib/components/WorkspacePage.svelte @@ -3,7 +3,6 @@ import { getAppConfig, getPanelForPath, getPathForPanel } from '$lib/app-config' import AnalyzerWorkspace from '$lib/features/AnalyzerWorkspace.svelte' import ConfigWorkspace from '$lib/features/ConfigWorkspace.svelte' - import DesktopWorkspace from '$lib/features/DesktopWorkspace.svelte' import FeedWorkspace from '$lib/features/FeedWorkspace.svelte' import KioskWorkspace from '$lib/features/KioskWorkspace.svelte' import MediaTypePipeline from '$lib/features/MediaTypePipeline.svelte' @@ -82,6 +81,4 @@ {:else if app.id === 'servant'} -{:else} - {/if} diff --git a/shared/media-webui/src/lib/components/ui/badge.svelte b/shared/media-webui/src/lib/components/ui/badge.svelte deleted file mode 100644 index 3283d6d..0000000 --- a/shared/media-webui/src/lib/components/ui/badge.svelte +++ /dev/null @@ -1,32 +0,0 @@ - - - - {@render children?.()} - diff --git a/shared/media-webui/src/lib/components/ui/button.svelte b/shared/media-webui/src/lib/components/ui/button.svelte deleted file mode 100644 index f789b46..0000000 --- a/shared/media-webui/src/lib/components/ui/button.svelte +++ /dev/null @@ -1,43 +0,0 @@ - - - diff --git a/shared/media-webui/src/lib/components/ui/card.svelte b/shared/media-webui/src/lib/components/ui/card.svelte deleted file mode 100644 index 260ac67..0000000 --- a/shared/media-webui/src/lib/components/ui/card.svelte +++ /dev/null @@ -1,14 +0,0 @@ - - -
- {@render children?.()} -
diff --git a/shared/media-webui/src/lib/components/ui/metric.svelte b/shared/media-webui/src/lib/components/ui/metric.svelte deleted file mode 100644 index f8a9e8c..0000000 --- a/shared/media-webui/src/lib/components/ui/metric.svelte +++ /dev/null @@ -1,32 +0,0 @@ - - -
-

{label}

-

- {value} -

- {#if detail}

{detail}

{/if} -
diff --git a/shared/media-webui/src/lib/features/AnalyzerWorkspace.svelte b/shared/media-webui/src/lib/features/AnalyzerWorkspace.svelte index 595c755..06e9a68 100644 --- a/shared/media-webui/src/lib/features/AnalyzerWorkspace.svelte +++ b/shared/media-webui/src/lib/features/AnalyzerWorkspace.svelte @@ -2,17 +2,11 @@ import { AlertTriangle, Play, Plus, RefreshCw, Trash2 } from '@lucide/svelte' import { onMount } from 'svelte' import { SvelteSet } from 'svelte/reactivity' - import { notify } from '@gabriel20xx/web-ui' + import { Badge, Button, Card, EmptyState, Metric, notify, SectionTitle } from '@gabriel20xx/web-ui' import { del, get, post } from '$lib/api' import AnalyzerHistory from '$lib/components/AnalyzerHistory.svelte' import AnalyzerLiveStatus from '$lib/components/AnalyzerLiveStatus.svelte' import AnalyzerPipelineBreakdown from '$lib/components/AnalyzerPipelineBreakdown.svelte' - import SectionTitle from '$lib/components/SectionTitle.svelte' - import Card from '$lib/components/ui/card.svelte' - import Button from '$lib/components/ui/button.svelte' - import Badge from '$lib/components/ui/badge.svelte' - import Metric from '$lib/components/ui/metric.svelte' - import EmptyState from '$lib/components/EmptyState.svelte' import { cn } from '$lib/utils/cn' type Json = Record @@ -407,18 +401,18 @@ label="Pending" value={numeric('queued', numeric('queueLength'))} detail="Waiting for a worker" - tone="warning" + variant="warning" /> + variant="success" + />
@@ -476,18 +470,18 @@ label="Pending" value={numeric('queued', numeric('queueLength'))} detail="Waiting for a worker" - tone="warning" + variant="warning" /> + variant="success" + />
{/if}
- {schedule.enabled === false ? 'Paused' : 'Enabled'} - type StatusTone = 'neutral' | 'primary' | 'success' | 'warning' | 'danger' + type StatusTone = 'default' | 'primary' | 'success' | 'warning' | 'danger' type ConnectionStatus = { label: string; tone: StatusTone; title?: string } type MountEntry = { type: string; path: string } type TransferLimit = { uploadKbps: string; downloadKbps: string } @@ -584,7 +579,7 @@ } function statusFor(key: string): ConnectionStatus { - return statuses[key] || { label: 'Unknown', tone: 'neutral' } + return statuses[key] || { label: 'Unknown', tone: 'default' } } async function checkTarget(key: string, rawUrl: string, project: string | null, id: string) { @@ -593,7 +588,7 @@ urls = { ...urls, [id]: url } } if (!url) { - statuses = { ...statuses, [key]: { label: 'No URL', tone: 'neutral' } } + statuses = { ...statuses, [key]: { label: 'No URL', tone: 'default' } } return } @@ -845,7 +840,7 @@

The image-generation service used by MediaTools.

- {statusFor('comfyui').label} @@ -883,7 +878,7 @@ {connection.label || `External Connection ${index + 1}`}

{statusFor(`external:${connection.id}`).label} @@ -1007,13 +1002,13 @@

{labels.mediaconfig || 'MediaConfig'}

{#if labels.mediaconfig}(MediaConfig){/if} - {statusFor('mediaconfig').label}
- Self + Self
@@ -1068,7 +1063,7 @@ {#if labels[projectKey(project)]}({getInstanceLabel(project)}){/if} - {statusFor(projectKey(project)).label}
@@ -1167,7 +1162,7 @@

{labels[key] || getInstanceLabel(project)}

{#if labels[key]}({getInstanceLabel(project)}){/if} - {statusFor(key).label} + {statusFor(key).label}
diff --git a/shared/media-webui/src/lib/features/DesktopWorkspace.svelte b/shared/media-webui/src/lib/features/DesktopWorkspace.svelte deleted file mode 100644 index cf3f0dc..0000000 --- a/shared/media-webui/src/lib/features/DesktopWorkspace.svelte +++ /dev/null @@ -1,99 +0,0 @@ - - -
- {#if panel === 'devices'} -
- -
-
- -
-

Serial / TCode

-

Waiting for a local driver

-
- Offline -
-
- -
-

Bluetooth devices

-

Native discovery is available after launch

-
- Offline -
-
-
- -

- No device is currently receiving output. Connect a driver from the native controls to enable playback - synchronization. -

-
-
- {:else if panel === 'settings'} - -
- -
-
- {:else} -
- -
- -
-
-
- -
-

No active media

-

Player status will appear after connection.

-
-
- -
-
- {/if} -
diff --git a/shared/media-webui/src/lib/features/FeedWorkspace.svelte b/shared/media-webui/src/lib/features/FeedWorkspace.svelte index 2126853..ea07413 100644 --- a/shared/media-webui/src/lib/features/FeedWorkspace.svelte +++ b/shared/media-webui/src/lib/features/FeedWorkspace.svelte @@ -2,10 +2,7 @@ import { page } from '$app/state' import { Film, Music2, Play } from '@lucide/svelte' import { get } from '$lib/api' - import EmptyState from '$lib/components/EmptyState.svelte' - import Badge from '$lib/components/ui/badge.svelte' - import Button from '$lib/components/ui/button.svelte' - import Card from '$lib/components/ui/card.svelte' + import { Badge, Button, Card, EmptyState } from '@gabriel20xx/web-ui' interface FeedItem { mediaKey?: string @@ -104,7 +101,7 @@ {item.title || item.name || item.filename || 'Untitled media'}

- {#if item.mediaType}{item.mediaType}{/if} + {#if item.mediaType}{item.mediaType}{/if} {#if item.category}{item.category}{/if} {#if item.filename}{item.filename}{/if}
diff --git a/shared/media-webui/src/lib/features/KioskWorkspace.svelte b/shared/media-webui/src/lib/features/KioskWorkspace.svelte index b73aa88..2e9f098 100644 --- a/shared/media-webui/src/lib/features/KioskWorkspace.svelte +++ b/shared/media-webui/src/lib/features/KioskWorkspace.svelte @@ -2,11 +2,7 @@ import { Maximize2, Pause, Play, Settings2, Wifi, WifiOff } from '@lucide/svelte' import { onMount } from 'svelte' import { get } from '$lib/api' - import SectionTitle from '$lib/components/SectionTitle.svelte' - import Card from '$lib/components/ui/card.svelte' - import Button from '$lib/components/ui/button.svelte' - import Badge from '$lib/components/ui/badge.svelte' - import Metric from '$lib/components/ui/metric.svelte' + import { Badge, Button, Card, Metric, SectionTitle } from '@gabriel20xx/web-ui' type KioskConfig = { defaultDisplayDuration?: number @@ -126,7 +122,7 @@ class="flex flex-wrap justify-end gap-2" aria-label={panel === 'kiosk' ? 'Kiosk controls' : 'Kiosk display controls'} > - {#if connected}Connected{:else}Waiting{/if}
{/if}
- sum + stage.errors, 0)} detail="Needs attention" - tone="danger" + variant="danger" />
diff --git a/shared/media-webui/src/lib/features/ModeratorWorkspace.svelte b/shared/media-webui/src/lib/features/ModeratorWorkspace.svelte index 114f06d..ce9a6aa 100644 --- a/shared/media-webui/src/lib/features/ModeratorWorkspace.svelte +++ b/shared/media-webui/src/lib/features/ModeratorWorkspace.svelte @@ -1,14 +1,8 @@ - + {@render children?.()} diff --git a/shared/packages/web-ui/src/lib/components/Button.svelte b/shared/packages/web-ui/src/lib/components/Button.svelte index 6c8e91d..992bf90 100644 --- a/shared/packages/web-ui/src/lib/components/Button.svelte +++ b/shared/packages/web-ui/src/lib/components/Button.svelte @@ -1,8 +1,9 @@ + +
+
diff --git a/shared/packages/web-ui/src/lib/components/Metric.svelte b/shared/packages/web-ui/src/lib/components/Metric.svelte new file mode 100644 index 0000000..cc843f3 --- /dev/null +++ b/shared/packages/web-ui/src/lib/components/Metric.svelte @@ -0,0 +1,21 @@ + + +
+

{label}

+

{value}

+ {#if detail}

{detail}

{/if} +
diff --git a/shared/packages/web-ui/src/lib/components/SectionTitle.svelte b/shared/packages/web-ui/src/lib/components/SectionTitle.svelte new file mode 100644 index 0000000..8317997 --- /dev/null +++ b/shared/packages/web-ui/src/lib/components/SectionTitle.svelte @@ -0,0 +1,8 @@ + + +
+

{title}

+ {#if description}

{description}

{/if} +
diff --git a/shared/packages/web-ui/src/lib/components/StatusDialog.svelte b/shared/packages/web-ui/src/lib/components/StatusDialog.svelte new file mode 100644 index 0000000..d730e70 --- /dev/null +++ b/shared/packages/web-ui/src/lib/components/StatusDialog.svelte @@ -0,0 +1,71 @@ + + + +
+ {#if status.loading && status.level === 'checking'} +
+ +
+ {#each [{ label: 'Liveness', probe: status.health }, { label: 'Readiness / database', probe: status.readiness }] as item (item.label)} +
+ {item.label} + {probeLabel(item.probe)} +
+ {/each} +
+ + {#if status.health?.service || status.readiness?.service} +

Service: {status.health?.service || status.readiness?.service}

+ {/if} + + {#snippet footer()} + + + {/snippet} +
diff --git a/shared/packages/web-ui/src/lib/components/StatusWidget.svelte b/shared/packages/web-ui/src/lib/components/StatusWidget.svelte new file mode 100644 index 0000000..2340ee0 --- /dev/null +++ b/shared/packages/web-ui/src/lib/components/StatusWidget.svelte @@ -0,0 +1,103 @@ + + + + + diff --git a/shared/packages/web-ui/src/lib/index.ts b/shared/packages/web-ui/src/lib/index.ts index 8f92ccc..42599a5 100644 --- a/shared/packages/web-ui/src/lib/index.ts +++ b/shared/packages/web-ui/src/lib/index.ts @@ -6,12 +6,17 @@ export { default as Badge } from './components/Badge.svelte'; export { default as Button } from './components/Button.svelte'; export { default as Card } from './components/Card.svelte'; export { default as Dialog } from './components/Dialog.svelte'; +export { default as EmptyState } from './components/EmptyState.svelte'; export { default as Header } from './components/Header.svelte'; +export { default as Metric } from './components/Metric.svelte'; export { default as NotificationStack } from './components/NotificationStack.svelte'; export { default as PageHeader } from './components/PageHeader.svelte'; export { default as Pagination } from './components/Pagination.svelte'; export { default as ProfileDialog } from './components/ProfileDialog.svelte'; +export { default as SectionTitle } from './components/SectionTitle.svelte'; export { default as SettingsDialog } from './components/SettingsDialog.svelte'; +export { default as StatusDialog } from './components/StatusDialog.svelte'; +export { default as StatusWidget } from './components/StatusWidget.svelte'; export { default as TotpSettings } from './components/TotpSettings.svelte'; export { default as UserManagement } from './components/UserManagement.svelte'; export { notifications, notify } from './notifications.svelte'; @@ -27,6 +32,9 @@ export type { NavItem, ProfileUpdateInput, ManagedUser, + StatusLevel, + StatusProbe, + StatusSnapshot, UserCreateInput, UserCreateRequest, UserDeleteRequest, diff --git a/shared/packages/web-ui/src/lib/styles.css b/shared/packages/web-ui/src/lib/styles.css index 38e0b5a..47ce953 100644 --- a/shared/packages/web-ui/src/lib/styles.css +++ b/shared/packages/web-ui/src/lib/styles.css @@ -285,6 +285,12 @@ font-weight: 650; } +.sc-badge[data-variant="primary"] { + color: var(--sc-primary-fg); + background: var(--sc-primary); + border-color: transparent; +} + .sc-badge[data-variant="success"] { color: var(--sc-success-fg); background: var(--sc-success); @@ -380,6 +386,16 @@ background: var(--sc-danger-hover); } +.sc-button-outline { + color: var(--sc-fg); + background: transparent; + border-color: var(--sc-border); +} + +.sc-button-outline:hover:not(:disabled) { + background: var(--sc-surface-hover); +} + .sc-button-sm { min-height: 2rem; padding: 0.45rem 0.75rem; @@ -391,6 +407,187 @@ padding: 0.75rem 1.25rem; } +.sc-button-icon { + min-height: 2.5rem; + width: 2.5rem; + padding: 0; +} + +.sc-empty-state { + display: flex; + min-height: 10rem; + flex-direction: column; + align-items: center; + justify-content: center; + gap: 0.75rem; + padding: 2rem 1.25rem; + text-align: center; + border: 1px dashed var(--sc-border); + border-radius: var(--sc-radius-lg); + background: color-mix(in srgb, var(--sc-surface) 50%, transparent); +} + +.sc-empty-state-icon { + color: var(--sc-muted-fg); +} + +.sc-empty-state-title { + margin: 0; + font-size: 0.9rem; + font-weight: 600; + color: var(--sc-fg); +} + +.sc-empty-state-message { + margin: 0.25rem 0 0; + max-width: 24rem; + font-size: 0.8125rem; + color: var(--sc-muted-fg); +} + +.sc-section-title { + display: flex; + align-items: flex-start; + justify-content: space-between; + gap: 0.75rem; +} + +.sc-section-title h2 { + margin: 0; + font-size: 0.9rem; + font-weight: 650; + color: var(--sc-fg); +} + +.sc-section-title p { + margin: 0.25rem 0 0; +} + +.sc-metric { + padding: 1rem; + border: 1px solid var(--sc-border); + border-radius: var(--sc-radius-lg); + background: var(--sc-surface); +} + +.sc-metric-label { + margin: 0; + font-size: 0.6875rem; + font-weight: 650; + letter-spacing: 0.06em; + text-transform: uppercase; + color: var(--sc-muted-fg); +} + +.sc-metric-value { + margin: 0.5rem 0 0; + font-size: 1.5rem; + font-weight: 650; + letter-spacing: -0.01em; + color: var(--sc-fg); +} + +.sc-metric-value[data-variant="primary"] { + color: var(--sc-primary); +} + +.sc-metric-value[data-variant="success"] { + color: var(--sc-success); +} + +.sc-metric-value[data-variant="warning"] { + color: var(--sc-warning); +} + +.sc-metric-value[data-variant="danger"] { + color: var(--sc-danger); +} + +.sc-metric-detail { + margin: 0.25rem 0 0; + font-size: 0.8125rem; + color: var(--sc-muted-fg); +} + +.sc-status-icon { + color: var(--sc-muted-fg); +} + +.sc-status-summary[data-level="healthy"] .sc-status-icon, +.sc-status-summary[data-level="healthy"] .sc-status-summary-label { + color: var(--sc-success); +} + +.sc-status-summary[data-level="degraded"] .sc-status-icon, +.sc-status-summary[data-level="degraded"] .sc-status-summary-label { + color: var(--sc-warning); +} + +.sc-status-summary[data-level="offline"] .sc-status-icon, +.sc-status-summary[data-level="offline"] .sc-status-summary-label { + color: var(--sc-danger); +} + +.sc-status-spin { + animation: sc-spin 900ms linear infinite; +} + +@keyframes sc-spin { + to { + transform: rotate(360deg); + } +} + +.sc-status-summary { + display: flex; + align-items: center; + gap: 0.75rem; + margin-bottom: 1.25rem; + padding: 0.75rem; + border: 1px solid var(--sc-border); + border-radius: var(--sc-radius-md); + background: var(--sc-surface); +} + +.sc-status-summary-label { + font-weight: 650; +} + +.sc-status-summary-time { + margin-left: auto; + font-size: 0.75rem; + color: var(--sc-muted-fg); +} + +.sc-status-probes { + display: flex; + flex-direction: column; + gap: 0.5rem; + font-size: 0.875rem; +} + +.sc-status-probe { + display: flex; + align-items: center; + justify-content: space-between; + gap: 1rem; + padding: 0.5rem 0.75rem; + border: 1px solid var(--sc-border); + border-radius: var(--sc-radius-sm); +} + +.sc-status-probe span[data-ok="true"] { + color: var(--sc-success); +} + +.sc-status-probe span[data-ok="false"] { + color: var(--sc-danger); +} + +.sc-status-service { + margin-top: 1rem; +} + .sc-button-full { width: 100%; } diff --git a/shared/packages/web-ui/src/lib/types.ts b/shared/packages/web-ui/src/lib/types.ts index 0ab2f73..fed9cda 100644 --- a/shared/packages/web-ui/src/lib/types.ts +++ b/shared/packages/web-ui/src/lib/types.ts @@ -91,3 +91,21 @@ export interface AboutLink { } export type ContentSnippet = Snippet; + +export type StatusLevel = "checking" | "healthy" | "degraded" | "offline"; + +export interface StatusProbe { + path: string; + ok: boolean; + httpStatus: number | null; + service: string | null; + error: string | null; +} + +export interface StatusSnapshot { + level: StatusLevel; + health: StatusProbe | null; + readiness: StatusProbe | null; + checkedAt: string | null; + loading: boolean; +}