fix(hub): answered decision cards close, typed answers survive redraws, clicked cards show what they wait for
🧪 Test / 🧪 Lock + lint (push) Canceled after 0s
🧪 Test / 🧪 Lock + lint (push) Canceled after 0s
A decision answer now goes through the signed approve batch like every other grant, so the hub stores it and the card leaves the inbox and its counts once the answer is recorded. The Other text field keeps focus, caret and draft across the inbox and Match redraws. A clicked card greys out, shows a spinner and names on hover what it waits for: the passkey, the undo window or the Grant of a Select pick. 🎯 Fix: 86 % 💥 Break: 5 % 💸 Tokens: – ⏱️ Velocity: – 🛡️ Security: 100 % 🏆 Score: 82 🚦 Gate: ⛔ fix 86 % < 90 Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8332631b7e
commit
edf53982c8
10 files changed
+125
-43
No files matched your search
@@ -2,6 +2,23 @@
|
||||
const ALLOW = "Yes";
|
||||
const TELL = "Tell Claude what to do instead";
|
||||
const askDialog = (id) => ({id, options: [{label: ALLOW, description: "allow this one call"}, {label: "No", description: "deny it"}], recommended: "", multi: false});
|
||||
const drafts = new Map();
|
||||
const forgetDraft = (id) => drafts.delete(id);
|
||||
|
||||
/**
|
||||
* @param {HTMLElement} root the element draw() rebuilds.
|
||||
* @param {Function} draw replaces root's children; the text field the operator types in keeps focus and caret when draw() rebuilds it under the same aria-label.
|
||||
*/
|
||||
function keepTyping(root, draw) {
|
||||
const field = document.activeElement;
|
||||
const held = field && field.tagName === "INPUT" && root.contains(field) && field.getAttribute("aria-label") ? [field.getAttribute("aria-label"), field.selectionStart, field.selectionEnd] : null;
|
||||
draw();
|
||||
const again = held && [...root.querySelectorAll("input")].find((node) => node.getAttribute("aria-label") === held[0]);
|
||||
if (again && document.activeElement !== again) {
|
||||
again.focus({preventScroll: true});
|
||||
again.setSelectionRange(held[1], held[2]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Object} item a decision, a decision row, a decision card or a permission ask: id, options [{label, description, preview}], recommended (labels joined by PICKED), multi.
|
||||
@@ -40,7 +57,8 @@
|
||||
send.addEventListener("click", () => how.pick(item.options.filter((option) => how.toggled.has(option.label)).map((option) => option.label).join(PICKED), false));
|
||||
}
|
||||
const typed = chosen.length === 1 && !item.options.some((option) => option.label === chosen[0]) ? chosen[0] : null;
|
||||
const input = h("input", {class: "field", type: "text", maxlength: OTHER_LIMIT, placeholder: how.other, "aria-label": `Other answer to ${item.id}`, value: typed, disabled: how.locked});
|
||||
const input = h("input", {class: "field", type: "text", maxlength: OTHER_LIMIT, placeholder: how.other, "aria-label": `Other answer to ${item.id}`, value: typed || drafts.get(item.id) || null, disabled: how.locked});
|
||||
input.addEventListener("input", () => drafts.set(item.id, input.value));
|
||||
const other = h("form", {class: "option other"}, input,
|
||||
h("button", {type: "submit", class: "btn small", disabled: how.locked, ...named("Send", revealed(`Send this text: ${how.hint}`))}, icon("bi-send"), "Send"));
|
||||
other.addEventListener("submit", (event) => {
|
||||
|
||||
Reference in new issue
Block a user