aboutsummaryrefslogtreecommitdiffstats
path: root/static
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-11-10 18:12:25 +0100
committerDanilo M. <danix@danix.xyz>2026-11-10 18:12:25 +0100
commit9f6f909d696c2f8b1e1e8261431e3d815baf277e (patch)
treed29043cdf073f23113278f68cb54d0a2bfa0296a /static
parentb73b1ade23805be93e7e0cc056c258652b4a0db3 (diff)
downloaddeck-it-9f6f909d696c2f8b1e1e8261431e3d815baf277e.tar.gz
deck-it-9f6f909d696c2f8b1e1e8261431e3d815baf277e.zip
feat(assistant): tools grouped by the kind of file they take
Each section of the tools overlay lists its presets and ops under a label per kind (PDF, Text, Code, Images, Video, Archives, Several files, Any file); an item taking several kinds shows in each group. The tile rows get their own class, so the chat rows' style no longer reaches them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'static')
-rw-r--r--static/deck.css6
-rw-r--r--static/modules/assistant.js42
2 files changed, 33 insertions, 15 deletions
diff --git a/static/deck.css b/static/deck.css
index 48ec626..b322a11 100644
--- a/static/deck.css
+++ b/static/deck.css
@@ -658,7 +658,9 @@ select {
background: var(--udt-mantle); border: 1px solid var(--udt-surface1); border-radius: 12px; padding: 10px;
}
.assistant .as-strip[hidden], .assistant .as-picking[hidden] { display: none; }
-.assistant .as-row { display: flex; flex-wrap: wrap; gap: 8px; }
+.assistant .as-group { display: flex; align-items: center; gap: 12px; }
+.assistant .as-group small { flex: none; width: 96px; text-align: right; font-size: 0.786rem; color: var(--udt-overlay1); }
+.assistant .as-tiles { display: flex; flex-wrap: wrap; gap: 8px; }
.assistant .as-sec h3 { margin: 4px 0 0; font-size: 0.857rem; text-transform: uppercase; letter-spacing: .08em; color: var(--udt-subtext0); }
.assistant .as-sec p { margin: 2px 0 0; font-size: 0.786rem; color: var(--udt-overlay0); }
.assistant .as-tile {
@@ -666,7 +668,7 @@ select {
justify-content: center; gap: 4px; border-radius: 12px; font: inherit; cursor: pointer;
background: var(--udt-surface0); border: 1px solid var(--udt-surface1); color: var(--udt-text);
}
-.assistant .as-row.op .as-tile { background: var(--udt-surface1); }
+.assistant .as-group.op .as-tile { background: var(--udt-surface1); }
.assistant .as-tile i { font-size: 1.6rem; }
.assistant .as-tile span { font-size: 0.714rem; color: var(--udt-subtext0); max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assistant .as-picking { display: flex; align-items: center; gap: 12px; min-height: 72px; color: var(--udt-yellow); }
diff --git a/static/modules/assistant.js b/static/modules/assistant.js
index 3213aa6..e47fe4b 100644
--- a/static/modules/assistant.js
+++ b/static/modules/assistant.js
@@ -150,6 +150,11 @@ function renderPicking(box, st, el) {
box.append(cancel);
}
+const KIND_LABELS = {
+ pdf: "PDF", text: "Text", code: "Code", image: "Images", video: "Video",
+ archive: "Archives", many: "Several files", any: "Any file",
+};
+
// The presets and ops, in an overlay opened from the header, so the
// transcript keeps the screen.
function renderStrip(strip, st, el) {
@@ -174,20 +179,31 @@ function renderStrip(strip, st, el) {
head.firstElementChild.textContent = title;
head.lastElementChild.textContent = hint;
strip.append(head);
- const row = document.createElement("div");
- row.className = `as-row ${kind}`;
- for (const item of items) {
- const b = document.createElement("button");
- b.className = "as-tile";
- b.title = item.prompt ?? item.label;
- b.setAttribute("aria-label", item.label);
- b.innerHTML = `<i class="nf"></i><span></span>`;
- b.querySelector("i").textContent = item.icon || G.fallback;
- b.querySelector("span").textContent = item.label;
- b.onclick = () => { strip.hidden = true; act(el, "pick", { [kind]: item.label }); };
- row.append(b);
+ // One group per kind of file; an item taking several kinds is in each.
+ const groups = new Map(Object.keys(KIND_LABELS).map((k) => [k, []]));
+ for (const item of items) for (const k of item.kinds ?? ["any"]) {
+ if (!groups.has(k)) groups.set(k, []);
+ groups.get(k).push(item);
+ }
+ for (const [k, list] of groups) {
+ if (!list.length) continue;
+ const group = document.createElement("div");
+ group.className = `as-group ${kind}`;
+ group.innerHTML = `<small></small><div class="as-tiles"></div>`;
+ group.firstElementChild.textContent = KIND_LABELS[k] ?? k;
+ for (const item of list) {
+ const b = document.createElement("button");
+ b.className = "as-tile";
+ b.title = item.prompt ?? item.label;
+ b.setAttribute("aria-label", item.label);
+ b.innerHTML = `<i class="nf"></i><span></span>`;
+ b.querySelector("i").textContent = item.icon || G.fallback;
+ b.querySelector("span").textContent = item.label;
+ b.onclick = () => { strip.hidden = true; act(el, "pick", { [kind]: item.label }); };
+ group.lastElementChild.append(b);
+ }
+ strip.append(group);
}
- strip.append(row);
}
}