From 6d58178f68b0eb0a3686981fc5a0aef6aa98564b Mon Sep 17 00:00:00 2001 From: MechaCat02 Date: Sun, 7 Jun 2026 20:34:58 +0200 Subject: [PATCH] fix(dashboard): F-U-003 surface known collection patterns on the Files page The Files page could only list a collection if the operator already knew its name and typed it in. No "browse known collections" affordance, no backend endpoint listing collections. Closest approximation without new backend: pull registered files-trigger collection_globs from the existing triggers list and surface them as: - a on the collection input for autocomplete - chip buttons under the form that one-click set the input Empty state copy points the operator at the Triggers tab. Backend endpoint to list known collections directly is still a v1.1.10+ task. Styling uses the F-U-004 :root tokens so it inherits the dark theme. AUDIT.md anchor: F-U-003 (frontend-only; backend endpoint deferred). Co-Authored-By: Claude Opus 4.7 (1M context) --- .../src/routes/apps/[slug]/files/+page.svelte | 69 ++++++++++++++++++- 1 file changed, 66 insertions(+), 3 deletions(-) diff --git a/dashboard/src/routes/apps/[slug]/files/+page.svelte b/dashboard/src/routes/apps/[slug]/files/+page.svelte index da058c7..0a37797 100644 --- a/dashboard/src/routes/apps/[slug]/files/+page.svelte +++ b/dashboard/src/routes/apps/[slug]/files/+page.svelte @@ -14,6 +14,11 @@ let error = $state(null); let fileToRemove = $state(null); let removing = $state(false); + /// F-U-003: hints derived from registered `files` triggers. No + /// backend endpoint lists known collections; this is the next-best + /// approximation — operators see "we've heard about these patterns" + /// instead of having to guess. + let collectionHints = $state([]); async function loadApp() { try { @@ -23,9 +28,25 @@ } } + async function loadCollectionHints() { + try { + const r = await api.triggers.list(slug); + const seen = new Set(); + for (const t of r.triggers) { + if (t.details.kind === 'files' && t.details.collection_glob) { + seen.add(t.details.collection_glob); + } + } + collectionHints = Array.from(seen).sort(); + } catch { + collectionHints = []; + } + } + $effect(() => { void slug; void loadApp(); + void loadCollectionHints(); }); async function loadFiles(cursor?: string) { @@ -102,12 +123,36 @@ > + + {#each collectionHints as h} + + {/each} + + {#if collectionHints.length > 0} +

+ Known collection patterns from registered files triggers: + {#each collectionHints as h, i} + {#if i > 0}, {/if} + + {/each} +

+ {:else} +

+ No files triggers registered yet. Once you register a files trigger from the Triggers tab, + its collection glob will appear here as a suggestion. +

+ {/if} {#if error}
{error}
@@ -217,10 +262,28 @@ font-size: 0.78rem; } .muted { - color: var(--muted, #666); + color: var(--text-muted); + } + .hint { + color: var(--text-muted); + font-size: 0.85rem; + margin: 0.5rem 0 1rem; + } + .hint-chip { + background: var(--bg-elevated); + color: var(--text-primary); + border: 1px solid var(--border); + border-radius: 0.25rem; + padding: 0.1rem 0.4rem; + font-size: 0.8rem; + cursor: pointer; + font-family: monospace; + } + .hint-chip:hover { + border-color: var(--color-link); } .error { - color: #b00020; + color: var(--color-danger); margin: 0.5rem 0; } button.danger {