diff --git a/CHANGELOG.md b/CHANGELOG.md index d9b3bac..08f7929 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,8 @@ All notable changes to Plan2Code will be documented in this file. ### šŸ› Fixed +- **web console**: on the dashboard, canceling one spec's Delete and quickly opening another's no longer leaves **Delete it** doing nothing; the first dialog's late close cleared the second dialog's spec. +- **web console**: a handoff's **Copy** button keeps showing **Copied** (or **Copy was refused**) when the dashboard redraws while the clipboard answers, instead of the word landing on a button that was already replaced. - **web console**: a finished screen's press (**Commit it now**, **Update CHANGELOG first**, **Back to the dashboard**, **Continue here**, a review) that nothing picks up, because the agent's turn ended while the screen waited, no longer says "Opening Changelog…" forever. After a minute of silence the line beside Planny says Plan2Code is not running and the choice is saved, with **continue** to type in the terminal (a button that types it there, under the app). - **desktop app**: under Claude Code, the console's **continue** button also sends Claude Code's send-now chord (ctrl+x ctrl+s), so a `continue` it held as a queued message behind a stuck turn is delivered in one press instead of waiting in the terminal. - **desktop app**: links that leave the console (**Open pull request**, links in documents, the feedback button) open in the default browser instead of doing nothing; when no browser can be started, the page shows the link with a **Copy** button to paste into one. diff --git a/scripts/test-web-console-page-workspace.mjs b/scripts/test-web-console-page-workspace.mjs index f0520dc..953ffc7 100644 --- a/scripts/test-web-console-page-workspace.mjs +++ b/scripts/test-web-console-page-workspace.mjs @@ -73,6 +73,10 @@ test("an @ in a note offers the workspace's folders, and picking one writes its await addFolderFromDialog(s, datasetsFolder()); await s.page.locator("#workspace-done").click(); await s.page.locator("#workspace-modal[open]").waitFor({ state: "detached" }); + // The @ list is the page's workspace frame, which can land after the + // dialog closes; typed before then, the @ has nothing to offer. The footer + // reads the same frame. + await s.page.waitForFunction(() => (document.getElementById("footer-where").dataset.key || "").includes("+ 1 folder")); const note = s.page.locator("#aside #thread-q1"); await note.click(); diff --git a/src/web-console/public/screens/dashboard.js b/src/web-console/public/screens/dashboard.js index c385455..5164f47 100644 --- a/src/web-console/public/screens/dashboard.js +++ b/src/web-console/public/screens/dashboard.js @@ -559,13 +559,15 @@ function renderHandoffPreview(h) { read.type = "button"; read.addEventListener("click", () => readHandoff(h)); const copyLabel = page.inApp ? "Copy for another session" : "Copy for a new conversation"; - const copy = el("button", "btn", copyLabel); + const shown = handoffCopied && handoffCopied.id === h.id && Date.now() < handoffCopied.until ? handoffCopied.word : copyLabel; + const copy = el("button", "btn", shown); copy.type = "button"; + copy.dataset.handoffCopy = h.id; copy.addEventListener("click", () => { const dir = (scan() && scan().handoffsDir) || ""; const sep = dir.includes("\\") ? "\\" : "/"; const file = dir ? dir.replace(/[\\/]+$/, "") + sep + h.id + ".md" : h.id + ".md"; - copyHandoffText(handoffCopyText(file), copy, copyLabel); + copyHandoffText(handoffCopyText(file), h.id, copyLabel); }); const del = el("button", "btn danger", "Delete"); del.type = "button"; @@ -578,14 +580,29 @@ function renderHandoffPreview(h) { // The prompt that sends a new conversation to the handoff. A refused // clipboard gets a plain word on the button instead of a silent nothing. -async function copyHandoffText(text, button, label) { +// A redraw while the clipboard answers rebuilds the button, so the word is +// kept in handoffCopied (which the rebuilt button reads) and put on whichever +// button is on the page when the answer comes. +let handoffCopied = null; +const handoffCopyButton = (id) => document.querySelector(`button[data-handoff-copy="${CSS.escape(id)}"]`); +async function copyHandoffText(text, id, label) { + let word; try { await navigator.clipboard.writeText(text); - button.textContent = "Copied"; + word = "Copied"; } catch { - button.textContent = "Copy was refused"; + word = "Copy was refused"; } - setTimeout(() => (button.textContent = label), 1500); + const mark = { id, word, until: Date.now() + 1500 }; + handoffCopied = mark; + const shown = handoffCopyButton(id); + if (shown) shown.textContent = word; + setTimeout(() => { + if (handoffCopied !== mark) return; + handoffCopied = null; + const live = handoffCopyButton(id); + if (live) live.textContent = label; + }, 1500); } // Pick it up here: a hop like a card launch. The page sends only the id; the @@ -1004,7 +1021,9 @@ export function wireDashboard() { deleteStep(); } }); + // `close` is queued, so it can land after the dialog was opened again for + // another spec; that new target must survive it. $("delete-modal").addEventListener("close", () => { - deleteTarget = null; + if (!$("delete-modal").open) deleteTarget = null; }); }