feat(dashboard): unified design system + persistent per-app tab bar

Addresses two interrelated UX complaints:

1. Browser-default controls leaking through the dark theme
   (native <select> chevrons, OS checkbox/radio look, date-picker
   icons, <details> triangle marker, number input spinners).
2. Subroute pages dropping the main app's tab bar in favor of a back
   link, breaking navigation continuity across users/files/queues/
   dead-letters/queues-[name].

Design tokens (dashboard/src/routes/+layout.svelte):

- Token vocabulary expanded with 18 new variables covering
  text-strong, accent + accent-fg, danger/success/warning bg/fg/border
  triplets, bg-elevated-hover, radii (sm/md/lg/pill), shadow-elev-2,
  and z scale (popover/modal/toast). 7 alias tokens (--muted,
  --link, --text, --color-error, --color-border, --chip-bg,
  --code-bg) absorb the orphan references the F-U-004 remediation
  partially renamed.
- Global :global(...) resets for <select>, <input type='checkbox'>,
  <input type='radio'>, <input type='number'>, <input type='date'>,
  and <details>/<summary> ensure native controls track the dark
  palette out of the box. No per-page edits needed.

Tab consistency:

- New dashboard/src/lib/AppTabBar.svelte renders all 11 per-app
  tabs (Scripts, Domains, Members, Triggers, Topics, Secrets,
  Settings, Users, Files, Queues, Dead letters) as <a> links with
  an active highlight derived from the URL. Tabs that switch
  in-page panels go to ?tab=<id>; tabs that switch routes go to
  the subroute. Admin-only tabs are hidden when canAdmin is false.
- New dashboard/src/routes/apps/[slug]/+layout.svelte loads the
  app once, handles the historical-slug redirect, exposes the
  shared app + canAdmin + canWrite + dead-letter-count state via
  Svelte context, and renders the breadcrumb + AppTabBar above
  every per-app page. The 5 subroute pages drop their own "← back"
  headers since the layout owns them now.
- apps/[slug]/+page.svelte's local-state activeTab becomes URL-
  driven via $page.url.searchParams.get('tab'). Defense-in-depth
  redirect for non-admin viewers landing on admin-only tabs uses
  goto({replaceState:true}) instead of mutating state.

Light-theme leftovers swept on 5 subroute pages:

- dead-letters: error banner, badge, pre/code blocks all swap to
  --color-danger-*, --bg-elevated, --text-primary
- files: button.danger, var(--muted,#666) → token-only
- queues + queues/[name]: bare hex fallbacks removed; .toolbar and
  .auto-refresh styled with tokens; data-testid for the queues
  empty state (already added by previous commit, reaffirmed here)
- users + users/invitations: badge-ok/badge-pending now use
  --color-success-bg/fg and --color-warning-bg/fg; chips use
  --bg-elevated + --text-strong; .create-form gets a token-styled
  surface; row-action buttons gain explicit dark-theme styling

E2E selector updates:

- members.spec.ts, integration.spec.ts, apps.spec.ts — the tab bar
  is now <a> elements (role=link) without a count suffix. Test
  selectors swap from getByRole('button', name: /^Scripts \(\d+\)$/)
  to getByRole('link', { name: 'Scripts' }), etc.
- New navigation/tabs.spec.ts still passes; existing 60+ tests
  unchanged except for the selector swap. Two pre-existing failures
  (routing.spec.ts:79, integration.spec.ts:89) untouched.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
MechaCat02
2026-06-09 20:55:22 +02:00
parent a1b7569d05
commit bce44769dd
13 changed files with 744 additions and 322 deletions

View File

@@ -77,11 +77,10 @@
<title>Dead letters · {slug} · PiCloud</title>
</svelte:head>
<div class="container">
<header>
<div class="panel">
<header class="panel-head">
<div>
<a href="{base}/apps/{slug}" class="back">&larr; back to {app?.name ?? slug}</a>
<h1>Dead letters</h1>
<h2>Dead letters</h2>
<p class="subtitle">
{#if unresolved > 0}
<strong class="badge">{unresolved}</strong> unresolved
@@ -95,7 +94,7 @@
<input type="checkbox" bind:checked={unresolvedOnly} />
Show unresolved only
</label>
<button onclick={load} disabled={loading}>Refresh</button>
<button class="secondary" onclick={load} disabled={loading}>Refresh</button>
</div>
</header>
@@ -178,40 +177,28 @@
</div>
<style>
.container {
max-width: 1200px;
margin: 0 auto;
padding: 2rem;
}
header {
.panel-head {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 1rem;
gap: 1rem;
}
.back {
font-size: 0.85rem;
color: var(--text-muted, #666);
text-decoration: none;
}
.back:hover {
text-decoration: underline;
}
h1 {
h2 {
margin: 0.25rem 0;
font-size: 1.125rem;
}
.subtitle {
color: var(--text-muted, #666);
color: var(--text-muted);
margin: 0;
}
.badge {
display: inline-block;
min-width: 1.5rem;
padding: 0.1rem 0.4rem;
background: #c00;
color: #fff;
border-radius: 999px;
background: var(--color-danger-bg);
color: var(--color-danger-fg);
border-radius: var(--radius-pill);
text-align: center;
font-weight: 600;
}
@@ -220,16 +207,23 @@
gap: 0.75rem;
align-items: center;
}
.controls label {
display: inline-flex;
gap: 0.4rem;
align-items: center;
font-size: 0.85rem;
color: var(--text-muted);
}
.error {
background: #fee;
border: 1px solid #fbb;
color: #900;
background: var(--color-danger-bg);
border: 1px solid var(--color-danger-border);
color: var(--color-danger-fg);
padding: 0.75rem 1rem;
border-radius: 4px;
border-radius: var(--radius-md);
margin-bottom: 1rem;
}
.empty {
color: var(--text-muted, #666);
color: var(--text-muted);
text-align: center;
padding: 2rem;
}
@@ -242,11 +236,11 @@
td {
text-align: left;
padding: 0.5rem 0.75rem;
border-bottom: 1px solid var(--border, #e0e0e0);
border-bottom: 1px solid var(--border);
vertical-align: top;
}
th {
background: var(--bg-secondary, #f5f5f5);
background: var(--bg-secondary);
font-weight: 600;
}
tr.resolved {
@@ -259,7 +253,7 @@
.err button.link {
background: none;
border: none;
color: var(--link, #06c);
color: var(--color-link);
text-decoration: underline;
cursor: pointer;
padding: 0;
@@ -272,18 +266,30 @@
display: flex;
gap: 0.4rem;
}
.actions button.secondary {
button.secondary {
background: transparent;
color: var(--text, #333);
border: 1px solid var(--border, #ccc);
color: var(--text-muted);
border: 1px solid var(--border);
padding: 0.35rem 0.75rem;
border-radius: var(--radius-md);
cursor: pointer;
font-size: 0.85rem;
}
button.secondary:hover:not(:disabled) {
background: var(--bg-elevated);
color: var(--text-primary);
}
button.secondary:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.resolution {
font-style: italic;
color: var(--text-muted, #666);
color: var(--text-muted);
font-size: 0.85rem;
}
tr.detail td {
background: var(--bg-secondary, #fafafa);
background: var(--bg-secondary);
padding: 0;
}
.detail-grid {
@@ -296,20 +302,21 @@
margin: 0 0 0.5rem 0;
font-size: 0.85rem;
text-transform: uppercase;
color: var(--text-muted, #666);
color: var(--text-muted);
}
.detail-grid pre {
background: #fff;
border: 1px solid var(--border, #e0e0e0);
background: var(--bg-elevated);
color: var(--text-primary);
border: 1px solid var(--border);
padding: 0.75rem;
border-radius: 4px;
border-radius: var(--radius-md);
font-size: 0.8rem;
overflow: auto;
max-height: 300px;
margin: 0;
}
code {
font-family: monospace;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 0.85rem;
}
</style>