diff --git a/internal/gui/assets/plugins/redact/page.js b/internal/gui/assets/plugins/redact/page.js index 3d54de88e..b9c96716a 100644 --- a/internal/gui/assets/plugins/redact/page.js +++ b/internal/gui/assets/plugins/redact/page.js @@ -251,12 +251,12 @@ function maskFlow(sum, move) { for (const r of rows) { const b = el("button", "mo-node" + (r.id && maskL[kind] === r.id ? " on" : "")); b.type = "button"; - // its logo on the side the lines are: an agent's after its name, a - // provider's before it; "N more" keeps the room so the names line up + // its logo first, then its name, on both sides; "N more" keeps the + // logo's room so the names line up const ic = r.id ? icon(r.icon || "generic") : el("span", "ic"); const tx = el("span", "tx"); tx.append(el("span", "nm", r.name), el("span", "ct", fmtN(r.n))); - b.append(...(kind === "agent" ? [tx, ic] : [ic, tx])); + b.append(ic, tx); if (r.id) { b.title = t("Show what {name} sent masked", { name: r.name }); b.onclick = () => maskNarrow({ [kind]: maskL[kind] === r.id ? "" : r.id }); diff --git a/internal/gui/assets/plugins/redact/redact.css b/internal/gui/assets/plugins/redact/redact.css index 7d4d6c888..130187ba2 100644 --- a/internal/gui/assets/plugins/redact/redact.css +++ b/internal/gui/assets/plugins/redact/redact.css @@ -38,10 +38,17 @@ .msk-fl { min-width: 0; } .mo-flow { position: relative; display: grid; grid-template-columns: minmax(0, 140px) minmax(80px, 1fr) minmax(0, 140px); gap: 14px; } .mo-col { display: flex; flex-direction: column; justify-content: center; min-width: 0; } -.mo-node { display: flex; align-items: center; justify-content: flex-end; gap: 8px; height: 34px; min-width: 0; padding: 0 10px; border: 0; border-radius: 9px; background: none; color: var(--fg); font: inherit; cursor: default; } -.mo-col.provider .mo-node { justify-content: flex-start; } -.mo-node .tx { display: flex; flex-direction: column; align-items: flex-end; min-width: 0; } -.mo-col.provider .mo-node .tx { align-items: flex-start; } +/* the agents' nodes as one block against the lines, as wide as the widest, + so their logos make one column and their names one edge, as the + providers' do */ +.mo-col.agent { display: grid; grid-template-columns: minmax(0, max-content); justify-content: end; align-content: center; } +.mo-node { display: flex; align-items: center; gap: 8px; height: 34px; min-width: 0; padding: 0 10px 0 6px; border: 0; border-radius: 9px; background: none; color: var(--fg); font: inherit; text-align: left; cursor: default; } +.mo-node .tx { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; } +/* each logo on the same disc: a logo's own drawing fills its box or not + (Pi's edge to edge, Codex's a tile of its own), and bare they read as + three sizes */ +.mo-node .ic { box-sizing: border-box; width: 24px; height: 24px; padding: 5px; border-radius: 50%; background: var(--card); box-shadow: 0 0 0 1px var(--line); } +.mo-node .ic > svg { width: 14px; height: 14px; } .mo-node:disabled .ic { visibility: hidden; } .mo-node:not(:disabled):hover { background: var(--pill); } .mo-node:disabled { color: var(--muted); } diff --git a/internal/gui/tests/masking-records.test.cjs b/internal/gui/tests/masking-records.test.cjs index 8ed2897a7..94ad4dcfe 100644 --- a/internal/gui/tests/masking-records.test.cjs +++ b/internal/gui/tests/masking-records.test.cjs @@ -188,11 +188,24 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", // to the ring's top left) const bird = await card.locator(".msk-hub svg").boundingBox(); assert(Math.abs(bird.x + bird.width / 2 - (hub.x + hub.width / 2)) < 1 && Math.abs(bird.y + bird.height / 2 - (hub.y + hub.height / 2)) < 1, "the bird in the middle of its ring"); - // each agent and provider with its logo, on the side the lines are + // each agent and provider with its logo assert.deepEqual(await card.locator(".mo-node .ic").evaluateAll((ns) => ns.map((n) => n.dataset.icon)), ["claudecode-color", "codex-color", "anthropic", "openai"]); - const agentNode = card.locator(".mo-col.agent .mo-node").first(), provNode = card.locator(".mo-col.provider .mo-node").first(); - assert((await agentNode.locator(".ic").boundingBox()).x > (await agentNode.locator(".nm").boundingBox()).x, "an agent's logo after its name"); - assert((await provNode.locator(".ic").boundingBox()).x < (await provNode.locator(".nm").boundingBox()).x, "a provider's logo before its name"); + // on both sides the logo first, then the name; a side's logos in one + // column and its names on one edge; every logo on a disc of one size + // (bare, a logo that fills its box and one that doesn't read as two + // sizes) + const nodes = await card.locator(".mo-node:not(:disabled)").evaluateAll((ns) => ns.map((b) => { + const ic = b.querySelector(".ic").getBoundingClientRect(), nm = b.querySelector(".nm").getBoundingClientRect(); + return { side: b.parentElement.classList.contains("agent") ? "agent" : "provider", ic: { x: ic.x, w: ic.width, h: ic.height, r: getComputedStyle(b.querySelector(".ic")).borderRadius }, nm: nm.x }; + })); + for (const n of nodes) { + assert(n.ic.x + n.ic.w <= n.nm, `the logo before the name: ${JSON.stringify(n)}`); + assert.deepEqual([n.ic.w, n.ic.h, n.ic.r], [24, 24, "50%"], `one disc for every logo: ${JSON.stringify(n)}`); + } + for (const side of ["agent", "provider"]) { + const of = nodes.filter((n) => n.side === side); + assert(of.every((n) => Math.abs(n.ic.x - of[0].ic.x) < 0.5 && Math.abs(n.nm - of[0].nm) < 0.5), `${side}s' logos in one column, names on one edge: ${JSON.stringify(of)}`); + } assert.match(await card.locator(".mo-cap").textContent(), /magpie/); assert.equal(await page.evaluate(() => [...document.querySelectorAll("#maskCard, #maskCard *")].some((n) => /gradient/.test(getComputedStyle(n).backgroundImage))), false, "flat: no gradient"); // short: the list starts in the first screen