diff --git a/scripts/test-web-console-git-board.mjs b/scripts/test-web-console-git-board.mjs index 7d6eed4..6e00611 100644 --- a/scripts/test-web-console-git-board.mjs +++ b/scripts/test-web-console-git-board.mjs @@ -435,6 +435,25 @@ test("git board view: pins on its source and on a few states", () => { assert.ok(hint.textContent.startsWith("Next step is on Changes:")); }); +test("git board view: a working line carries the spinner, and only while running", () => { + const lines = (r) => walk(r.node).filter((n) => n.classes.has("git-activity")); + const spun = (n) => n.children.some((c) => c.classes.has("spinner") && c.classes.has("tiny")); + + const busy = lines(draw("cp-committing", { mode: "running", tab: "changes" })); + assert.equal(busy.length, 2, "the header and the step strip both say what is under way"); + for (const n of busy) { + assert.ok(spun(n), `"${n.textContent}" has a spinner`); + assert.equal(n.textContent, "Committing 3 files on feature/ABC-12001-export-csv"); + } + + const quiet = lines(draw("cp-dirty", { mode: "running", tab: "changes" })); + assert.equal(quiet.length, 1, "with no activity, only the step strip speaks"); + assert.ok(spun(quiet[0])); + assert.equal(quiet[0].textContent, "Plan2Code is working on it."); + + assert.equal(lines(draw("cp-committing", { mode: "idle", tab: "changes" })).length, 0, "idle shows no working line"); +}); + const click = (n) => n.listeners.click.forEach((fn) => fn()); const stepButtons = (r) => controls(walk(r.node).find((n) => n.classes.has("git-step"))); diff --git a/src/web-console/public/git-board-view.js b/src/web-console/public/git-board-view.js index 718b530..3f0fd3e 100644 --- a/src/web-console/public/git-board-view.js +++ b/src/web-console/public/git-board-view.js @@ -165,11 +165,20 @@ function header(ctx) { meta.appendChild(code); meta.appendChild(copy(ctx, cmd, "btn small", code)); } else meta.appendChild(h.el("span", "git-refreshed", refreshedLine(git, ctx.now))); - if (ctx.mode === "running" && ctx.activity) meta.appendChild(h.el("span", "git-activity", ctx.activity)); + if (ctx.mode === "running" && ctx.activity) meta.appendChild(activityLine(ctx, "span", ctx.activity)); box.appendChild(meta); return box; } +// A line saying what the agent is doing, with the console's small ring in +// front so a wait reads as work under way. +function activityLine(ctx, tag, text) { + const line = ctx.h.el(tag, "git-activity"); + line.appendChild(ctx.h.el("span", "spinner tiny")); + line.appendChild(ctx.h.el("span", null, text)); + return line; +} + function resultLine(ctx, notice) { const box = ctx.h.el("div", "git-result"); box.setAttribute("role", "status"); @@ -282,7 +291,7 @@ function stepStrip(ctx, id) { box.appendChild(held); } if (ctx.mode === "running") { - box.appendChild(h.el("p", "git-activity", ctx.activity || "Plan2Code is working on it.")); + box.appendChild(activityLine(ctx, "p", ctx.activity || "Plan2Code is working on it.")); return box; } const actions = h.el("div", "git-step-actions"); diff --git a/src/web-console/public/styles/git.css b/src/web-console/public/styles/git.css index 6c03e1c..fa99d98 100644 --- a/src/web-console/public/styles/git.css +++ b/src/web-console/public/styles/git.css @@ -145,7 +145,9 @@ .git-track { font-family: var(--mono); font-size: 14px; color: var(--ink-2); } .git-head-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 13.5px; color: var(--ink-2); } .git-noremote { font-weight: 600; color: var(--stage); } -.git-activity { color: var(--accent); } +/* The ring sits on the first line of a wrapped activity, as the dock's does. */ +.git-activity { display: flex; align-items: flex-start; gap: 8px; color: var(--accent); } +.git-activity .spinner.tiny { margin-top: 0.25em; } .git-pr { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 6px; border-top: 1px solid var(--rule); } .git-pr-open { text-decoration: none; } .git-pr-ask { font-size: 14px; color: var(--ink); }