mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-16 20:45:33 -08:00
Show each helper's strength and effort as colored level badges
AI Assisted
This commit is contained in:
1 parent
b99a1a701f
commit
765d2b3536
7 files changed
+100
-7
No files matched your search
@@ -724,7 +724,24 @@ export function renderSubagents(main) {
|
||||
head.appendChild(pill);
|
||||
item.appendChild(head);
|
||||
item.appendChild(el("p", "sa-ask", row.ask));
|
||||
if (row.strengthLine) item.appendChild(el("p", "sa-strength", row.strengthLine));
|
||||
if (row.strengthLine) {
|
||||
// Badges for the eye, the plain line for screen readers and the tooltip.
|
||||
const strength = el("p", "sa-strength");
|
||||
strength.setAttribute("aria-label", row.strengthLine);
|
||||
strength.title = row.strengthLine;
|
||||
for (const badge of row.badges) {
|
||||
const chip = el("span", `sa-badge is-${badge.kind} lvl-${badge.level}`);
|
||||
chip.setAttribute("aria-hidden", "true");
|
||||
if (badge.level) {
|
||||
const bars = el("span", "sa-bars");
|
||||
for (let i = 1; i <= 3; i++) bars.appendChild(el("i", i <= badge.level ? "on" : null));
|
||||
chip.appendChild(bars);
|
||||
}
|
||||
chip.appendChild(document.createTextNode(badge.label));
|
||||
strength.appendChild(chip);
|
||||
}
|
||||
item.appendChild(strength);
|
||||
}
|
||||
if (row.result) item.appendChild(el("p", "sa-result", row.result));
|
||||
list.appendChild(item);
|
||||
}
|
||||
|
||||
@@ -161,7 +161,33 @@
|
||||
margin: 4px 0 0; color: var(--ink-2); font-size: 13.5px;
|
||||
display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
|
||||
}
|
||||
.sa-strength { margin: 4px 0 0; color: var(--ink-3); font-size: 12.5px; }
|
||||
.sa-strength { margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
|
||||
/* A helper's strength and effort, coloured by rank: calm teal, amber, violet. */
|
||||
.sa-badge {
|
||||
--b: var(--ink-2);
|
||||
--b-soft: var(--panel);
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 11.5px;
|
||||
font-weight: 600;
|
||||
line-height: 1;
|
||||
padding: 4px 8px;
|
||||
border-radius: 99px;
|
||||
border: 1px solid color-mix(in srgb, var(--b) 35%, transparent);
|
||||
background: var(--b-soft);
|
||||
color: var(--b);
|
||||
white-space: nowrap;
|
||||
}
|
||||
.sa-badge.lvl-1 { --b: var(--lvl-1); --b-soft: var(--lvl-1-soft); }
|
||||
.sa-badge.lvl-2 { --b: var(--lvl-2); --b-soft: var(--lvl-2-soft); }
|
||||
.sa-badge.lvl-3 { --b: var(--lvl-3); --b-soft: var(--lvl-3-soft); }
|
||||
.sa-bars { display: inline-flex; align-items: flex-end; gap: 1.5px; height: 9px; }
|
||||
.sa-bars i { width: 2.5px; border-radius: 1px; background: currentColor; opacity: 0.25; }
|
||||
.sa-bars i:nth-child(1) { height: 4px; }
|
||||
.sa-bars i:nth-child(2) { height: 6.5px; }
|
||||
.sa-bars i:nth-child(3) { height: 9px; }
|
||||
.sa-bars i.on { opacity: 1; }
|
||||
.sa-result { margin: 8px 0 0; padding-top: 8px; border-top: 1px solid var(--rule); font-size: 13.5px; }
|
||||
.sa-pill { display: inline-flex; align-items: center; gap: 6px; flex: none; }
|
||||
.sa-pill.is-running { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
|
||||
|
||||
@@ -24,6 +24,13 @@
|
||||
--warn: #9c3327;
|
||||
--warn-soft: #fbe7e3;
|
||||
--focus: #1f6feb;
|
||||
/* Rank colours for low / mid / high badges (a helper's strength and effort). */
|
||||
--lvl-1: #23716a;
|
||||
--lvl-1-soft: #e1f1ee;
|
||||
--lvl-2: #9a6a12;
|
||||
--lvl-2-soft: #fbf0d8;
|
||||
--lvl-3: #7a3fa8;
|
||||
--lvl-3-soft: #f1e7f8;
|
||||
--shadow: 0 1px 2px rgba(29, 26, 23, 0.05), 0 8px 24px rgba(29, 26, 23, 0.06);
|
||||
/* A soft accent halo for the things that want noticing: the update banner
|
||||
and an enabled Send. Built from --accent, so a picked accent glows too. */
|
||||
@@ -64,6 +71,12 @@
|
||||
--stage-soft: #332a17;
|
||||
--warn: #f0897a;
|
||||
--warn-soft: #34201d;
|
||||
--lvl-1: #6cc4b8;
|
||||
--lvl-1-soft: #172b28;
|
||||
--lvl-2: #e0ab4c;
|
||||
--lvl-2-soft: #332a17;
|
||||
--lvl-3: #c49bea;
|
||||
--lvl-3-soft: #2a2035;
|
||||
--focus: #6aa3ff;
|
||||
--shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
|
||||
--glow: 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent), 0 0 14px color-mix(in srgb, var(--accent) 45%, transparent);
|
||||
@@ -89,6 +102,12 @@
|
||||
--stage-soft: #332a17;
|
||||
--warn: #f0897a;
|
||||
--warn-soft: #34201d;
|
||||
--lvl-1: #6cc4b8;
|
||||
--lvl-1-soft: #172b28;
|
||||
--lvl-2: #e0ab4c;
|
||||
--lvl-2-soft: #332a17;
|
||||
--lvl-3: #c49bea;
|
||||
--lvl-3-soft: #2a2035;
|
||||
--focus: #6aa3ff;
|
||||
--shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
|
||||
--glow: 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent), 0 0 14px color-mix(in srgb, var(--accent) 45%, transparent);
|
||||
|
||||
@@ -221,7 +221,8 @@ export function switchLabel(frame) {
|
||||
// in the order the agent reported them. A real helper supersedes the
|
||||
// working-alone marker, so the note only draws when no helper was ever
|
||||
// reported. A result shows once the helper ended, and a reported strength or
|
||||
// effort as one line ("Standard, medium effort").
|
||||
// effort as one line ("Standard, medium effort") plus a badge each, ranked 1-3
|
||||
// so the page can colour them (0 for the session's own model, which has no rank).
|
||||
export function helperRows(helpers) {
|
||||
const list = Array.isArray(helpers) ? helpers.filter(isPlainObject) : [];
|
||||
const real = list.filter((h) => h.alone !== true);
|
||||
@@ -240,13 +241,24 @@ export function helperRows(helpers) {
|
||||
stateLabel: STATE_LABELS[state] || STATE_LABELS.running,
|
||||
...((state === "done" || state === "failed") && typeof result === "string" && result ? { result } : {}),
|
||||
...ran,
|
||||
...(line ? { strengthLine: line } : {}),
|
||||
...(line ? { strengthLine: line, badges: strengthBadges(ran.strength, ran.effort) } : {}),
|
||||
};
|
||||
});
|
||||
return { alone: false, rows };
|
||||
}
|
||||
|
||||
const HELPER_STRENGTH_WORDS = Object.freeze({ light: "Light", standard: "Standard", strongest: "Strongest", inherit: "Session model" });
|
||||
// Each value's rank for its badge colour; the session's own model has none.
|
||||
const HELPER_STRENGTH_LEVELS = Object.freeze({ light: 1, standard: 2, strongest: 3, inherit: 0 });
|
||||
const HELPER_EFFORT_LEVELS = Object.freeze({ low: 1, medium: 2, high: 3 });
|
||||
|
||||
// One badge per reported value: its kind, its words and its rank.
|
||||
function strengthBadges(strength, effort) {
|
||||
const badges = [];
|
||||
if (strength) badges.push({ kind: "strength", label: HELPER_STRENGTH_WORDS[strength], level: HELPER_STRENGTH_LEVELS[strength] });
|
||||
if (effort) badges.push({ kind: "effort", label: `${effort[0].toUpperCase()}${effort.slice(1)} effort`, level: HELPER_EFFORT_LEVELS[effort] });
|
||||
return badges;
|
||||
}
|
||||
|
||||
// "Standard, medium effort", "Light", "Medium effort", or "" when neither was reported.
|
||||
function strengthLine(strength, effort) {
|
||||
|
||||
Reference in new issue
Block a user