@nanocollective/roster 0.1.0-beta.21 → 0.1.0-beta.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/cli.js +10 -1
  2. package/dist/worker/assets/assets/css/astryx.css +948 -0
  3. package/dist/worker/assets/assets/css/base.css +47 -112
  4. package/dist/worker/assets/assets/css/brain.css +15 -11
  5. package/dist/worker/assets/assets/css/graph.css +9 -12
  6. package/dist/worker/assets/assets/css/health.css +4 -7
  7. package/dist/worker/assets/assets/css/home.css +27 -29
  8. package/dist/worker/assets/assets/css/layout.css +10 -20
  9. package/dist/worker/assets/assets/css/markdown.css +1 -1
  10. package/dist/worker/assets/assets/css/runs.css +5 -3
  11. package/dist/worker/assets/assets/css/search.css +3 -6
  12. package/dist/worker/assets/assets/css/setup.css +3 -15
  13. package/dist/worker/assets/assets/js/app.js +2 -0
  14. package/dist/worker/assets/assets/js/astryx-ui.js +34 -0
  15. package/dist/worker/assets/assets/js/homesort.js +43 -4
  16. package/dist/worker/assets/assets/js/icons.js +2 -0
  17. package/dist/worker/assets/assets/js/select.js +362 -0
  18. package/dist/worker/assets/assets/js/views/graph.js +67 -28
  19. package/dist/worker/assets/assets/js/views/home.js +98 -112
  20. package/dist/worker/assets/assets/js/views/people.js +8 -2
  21. package/dist/worker/assets/assets/js/views/runs.js +3 -1
  22. package/dist/worker/assets/docs-images/brain.jpg +0 -0
  23. package/dist/worker/assets/docs-images/home.jpg +0 -0
  24. package/dist/worker/assets/docs-images/org.jpg +0 -0
  25. package/dist/worker/assets/docs-images/prompt.jpg +0 -0
  26. package/dist/worker/assets/docs-images/setup-org.jpg +0 -0
  27. package/dist/worker/assets/docs-images/setup-plan.jpg +0 -0
  28. package/dist/worker/assets/docs-images/staff.jpg +0 -0
  29. package/dist/worker/assets/index.html +11 -3
  30. package/dist/worker/index.js +28 -4
  31. package/docs/getting-started.md +1 -1
  32. package/docs/images/brain.jpg +0 -0
  33. package/docs/images/home.jpg +0 -0
  34. package/docs/images/org.jpg +0 -0
  35. package/docs/images/prompt.jpg +0 -0
  36. package/docs/images/setup-org.jpg +0 -0
  37. package/docs/images/setup-plan.jpg +0 -0
  38. package/docs/images/staff.jpg +0 -0
  39. package/docs/portal.md +16 -11
  40. package/package.json +7 -1
  41. package/templates/portal/css/astryx.css +948 -0
  42. package/templates/portal/css/base.css +47 -112
  43. package/templates/portal/css/brain.css +15 -11
  44. package/templates/portal/css/graph.css +9 -12
  45. package/templates/portal/css/health.css +4 -7
  46. package/templates/portal/css/home.css +27 -29
  47. package/templates/portal/css/layout.css +10 -20
  48. package/templates/portal/css/markdown.css +1 -1
  49. package/templates/portal/css/runs.css +5 -3
  50. package/templates/portal/css/search.css +3 -6
  51. package/templates/portal/css/setup.css +3 -15
  52. package/templates/portal/index.html +11 -3
  53. package/templates/portal/js/app.js +2 -0
  54. package/templates/portal/js/astryx-ui.js +34 -0
  55. package/templates/portal/js/homesort.js +43 -4
  56. package/templates/portal/js/icons.js +2 -0
  57. package/templates/portal/js/select.js +362 -0
  58. package/templates/portal/js/views/graph.js +67 -28
  59. package/templates/portal/js/views/home.js +98 -112
  60. package/templates/portal/js/views/people.js +8 -2
  61. package/templates/portal/js/views/runs.js +3 -1
@@ -53,8 +53,13 @@ function drawGraph(canvas, wrap, s) {
53
53
  }
54
54
  const groups = [...members.keys()].sort((a, b) => members.get(b).length - members.get(a).length);
55
55
 
56
- const PALETTE = ["#30d158","#0a84ff","#bf5af2","#ff9f0a","#64d2ff","#ff453a","#ffcc00","#ff375f","#5e5ce6","#ac8e68"];
57
- const colour = new Map(groups.map((g, i) => [g, PALETTE[i % PALETTE.length]]));
56
+ // Astryx's categorical colours, one per group. They are theme tokens, so a group keeps its
57
+ // hue in both themes at the strength each theme wants.
58
+ const PALETTE = ["blue", "green", "purple", "orange", "cyan", "red", "yellow", "pink", "teal", "gray"]
59
+ .map((c) => `--color-icon-${c}`);
60
+ const token = new Map(groups.map((g, i) => [g, PALETTE[i % PALETTE.length]]));
61
+ // For markup, which can take the token as it is.
62
+ const colour = new Map(groups.map((g) => [g, `var(${token.get(g)})`]));
58
63
 
59
64
  // The ring grows with the number of groups so they never crowd, and each group keeps its
60
65
  // angle for the life of the view. That angle is also the direction its members fan out in.
@@ -69,6 +74,9 @@ function drawGraph(canvas, wrap, s) {
69
74
  }));
70
75
 
71
76
  const radius = (n) => n.isGroup ? 16 + Math.sqrt(n.count) * 3.6 : 5.5;
77
+ /* What is drawn and clicked: never smaller on screen than a dot you can read a count in or
78
+ hit with a pointer, however far out the picture is fitted. The layout keeps `radius`. */
79
+ const seen = (n) => Math.max(radius(n), (n.isGroup ? 11 + Math.sqrt(n.count) * 1.4 : 4) / scale);
72
80
 
73
81
  /* Fan a group's members outward along its own angle, in shells, so a big group becomes a
74
82
  wedge pointing away from the middle rather than a ball sitting on its neighbours. */
@@ -148,7 +156,37 @@ function drawGraph(canvas, wrap, s) {
148
156
  recompute();
149
157
  }
150
158
 
151
- const css = (v) => getComputedStyle(document.documentElement).getPropertyValue(v).trim();
159
+ /* A canvas takes colours, not tokens, and the theme's tokens are light-dark() pairs that it
160
+ cannot parse: handed one, it keeps whatever colour it had before, which painted every label
161
+ in the last group's colour. So each token is resolved by an element that wears it, and the
162
+ answers are kept until the theme changes. */
163
+ const probe = el("span", { hidden: true });
164
+ wrap.append(probe);
165
+ const resolved = new Map();
166
+ const css = (v) => {
167
+ if (!resolved.has(v)) {
168
+ probe.style.color = `var(${v})`;
169
+ resolved.set(v, getComputedStyle(probe).color);
170
+ }
171
+ return resolved.get(v);
172
+ };
173
+ const hue = (g) => css(token.get(g) ?? "--ink-faint");
174
+ const forget = () => resolved.clear();
175
+ globalThis.MutationObserver &&
176
+ new MutationObserver(forget).observe(document.documentElement, { attributes: true, attributeFilter: ["data-theme"] });
177
+ globalThis.matchMedia?.("(prefers-color-scheme: dark)").addEventListener?.("change", forget);
178
+ const SANS = getComputedStyle(probe).fontFamily || "system-ui, sans-serif";
179
+
180
+ /** Text over the picture: a halo in the card's colour first, so no edge runs through it. */
181
+ function label(text, x, y, ink, weight, px) {
182
+ ctx.font = `${weight} ${px / scale}px ${SANS}`;
183
+ ctx.lineJoin = "round";
184
+ ctx.lineWidth = 4 / scale;
185
+ ctx.strokeStyle = css("--panel");
186
+ ctx.strokeText(text, x, y);
187
+ ctx.fillStyle = css(ink);
188
+ ctx.fillText(text, x, y);
189
+ }
152
190
  let tx = 0, ty = 0, scale = 0.8;
153
191
  let selected = null, hover = null, drag = null, panning = false, lx = 0, ly = 0, moved = 0;
154
192
  const ctx = canvas.getContext("2d");
@@ -166,9 +204,9 @@ function drawGraph(canvas, wrap, s) {
166
204
  };
167
205
  wrap.append(el("div", { className: "gtools" }, [
168
206
  search,
169
- el("button", { textContent: "open all", onclick: () => { for (const g of groups) if (!expanded.has(g)) toggle(g); } }),
170
- el("button", { textContent: "close all", onclick: () => { for (const g of [...expanded]) toggle(g); } }),
171
- el("button", { textContent: "fit", onclick: fit }),
207
+ el("button", { className: "ghbtn sm", textContent: "Open all", onclick: () => { for (const g of groups) if (!expanded.has(g)) toggle(g); } }),
208
+ el("button", { className: "ghbtn sm", textContent: "Close all", onclick: () => { for (const g of [...expanded]) toggle(g); } }),
209
+ el("button", { className: "ghbtn sm", textContent: "Fit", onclick: fit }),
172
210
  ]));
173
211
 
174
212
  const legend = el("div", { className: "legend" });
@@ -242,7 +280,8 @@ function drawGraph(canvas, wrap, s) {
242
280
  const xs = vis.map((n) => n.x), ys = vis.map((n) => n.y);
243
281
  const minx = Math.min(...xs), miny = Math.min(...ys);
244
282
  const w = Math.max(...xs) - minx || 1, h = Math.max(...ys) - miny || 1;
245
- scale = Math.min(1.6, Math.max(0.12, Math.min(rect.width / (w + 260), rect.height / (h + 260))));
283
+ // Room round the edge for the dots and the labels under them, which keep their size on screen.
284
+ scale = Math.min(1.6, Math.max(0.12, Math.min((rect.width - 200) / w, (rect.height - 110) / h)));
246
285
  tx = -(minx + w / 2) * scale;
247
286
  ty = -(miny + h / 2) * scale;
248
287
  }
@@ -311,7 +350,7 @@ function drawGraph(canvas, wrap, s) {
311
350
  for (const g of groups) {
312
351
  if (!expanded.has(g) || hidden.has(g)) continue;
313
352
  const gn = groupNodes.get(g);
314
- ctx.strokeStyle = colour.get(g); ctx.globalAlpha = 0.14;
353
+ ctx.strokeStyle = hue(g); ctx.globalAlpha = 0.18;
315
354
  ctx.lineWidth = 1 / scale;
316
355
  for (const id of members.get(g)) {
317
356
  const mn = memberNodes.get(id);
@@ -322,16 +361,18 @@ function drawGraph(canvas, wrap, s) {
322
361
 
323
362
  for (const e of edges) {
324
363
  const lit = !near || (near.has(e.a) && near.has(e.b));
325
- ctx.strokeStyle = near && lit ? css("--accent") : css("--line");
326
- ctx.globalAlpha = near ? (lit ? 0.95 : 0.07) : 0.62;
327
- ctx.lineWidth = Math.min(6, 0.8 + Math.log2(e.weight + 1) * 1.25) / Math.max(1, scale * 0.8);
364
+ // Hairlines, the same width on screen at any zoom; a link made many times is a little
365
+ // heavier, never a bar.
366
+ ctx.strokeStyle = near && lit ? css("--accent") : css("--border-strong");
367
+ ctx.globalAlpha = near ? (lit ? 0.9 : 0.08) : 0.9;
368
+ ctx.lineWidth = (1 + Math.min(1.5, Math.log2(e.weight) * 0.5)) / scale;
328
369
  ctx.beginPath(); ctx.moveTo(e.a.x, e.a.y); ctx.lineTo(e.b.x, e.b.y); ctx.stroke();
329
370
  }
330
371
  ctx.globalAlpha = 1;
331
372
 
332
373
  const painted = shown().sort((a, b) => (b.isGroup ? b.count : 0) - (a.isGroup ? a.count : 0));
333
374
  for (const n of painted) {
334
- const r = radius(n);
375
+ const r = seen(n);
335
376
  const dim = near && !near.has(n);
336
377
  ctx.globalAlpha = dim ? 0.13 : 1;
337
378
 
@@ -341,37 +382,35 @@ function drawGraph(canvas, wrap, s) {
341
382
  if (open) {
342
383
  // Hollow while open: the group is still here, and still the thing you click to fold.
343
384
  ctx.fillStyle = css("--panel"); ctx.fill();
344
- ctx.strokeStyle = colour.get(n.group); ctx.lineWidth = 2.4 / scale; ctx.stroke();
345
- ctx.fillStyle = colour.get(n.group);
385
+ ctx.strokeStyle = hue(n.group); ctx.lineWidth = 2 / scale; ctx.stroke();
386
+ ctx.fillStyle = hue(n.group);
346
387
  } else {
347
- ctx.fillStyle = colour.get(n.group); ctx.fill();
348
- ctx.fillStyle = css("--bg");
388
+ ctx.fillStyle = hue(n.group); ctx.fill();
389
+ ctx.fillStyle = css("--panel");
349
390
  }
350
- ctx.font = "600 " + Math.max(9, r * 0.6) + "px ui-monospace,monospace";
391
+ ctx.font = "600 " + Math.max(9, r * 0.62) + "px " + SANS;
351
392
  ctx.textAlign = "center"; ctx.textBaseline = "middle";
352
393
  ctx.fillText(String(n.count), n.x, n.y + 0.5);
353
394
  ctx.textBaseline = "alphabetic";
354
395
  const text = n.id.length > 24 ? n.id.slice(0, 23) + "..." : n.id;
355
- const fs = Math.max(10, 12 / scale);
356
- ctx.font = "600 " + fs + "px -apple-system,system-ui,sans-serif";
396
+ const fs = 12.5 / scale;
397
+ ctx.font = "600 " + fs + "px " + SANS;
357
398
  const w = ctx.measureText(text).width;
358
- const bx = n.x - w / 2, by = n.y + r + 6, bh = fs * 1.25;
399
+ const bx = n.x - w / 2, by = n.y + r + 6 / scale, bh = fs * 1.25;
359
400
  const clashes = labelBoxes.some((o) =>
360
401
  bx < o.x + o.w + 8 && bx + w + 8 > o.x && by < o.y + o.h + 4 && by + bh + 4 > o.y);
361
402
  if (!clashes || n === hover) {
362
403
  labelBoxes.push({ x: bx, y: by, w, h: bh });
363
404
  ctx.textAlign = "center";
364
- ctx.fillStyle = css(n === hover ? "--ink" : "--ink-dim");
365
- ctx.fillText(text, n.x, by + fs);
405
+ label(text, n.x, by + fs, n === hover ? "--ink" : "--ink", 600, 12.5);
366
406
  }
367
407
  ctx.textAlign = "left";
368
408
  } else {
369
- ctx.fillStyle = colour.get(n.group) ?? css("--ink-faint");
409
+ ctx.fillStyle = hue(n.group);
370
410
  ctx.beginPath(); ctx.arc(n.x, n.y, r, 0, 7); ctx.fill();
371
411
  if (n === selected || n === hover || scale > 1.05) {
372
- ctx.fillStyle = css(n === selected || n === hover ? "--ink" : "--ink-dim");
373
- ctx.font = Math.max(9, 10.5 / scale) + "px ui-monospace,monospace";
374
- ctx.fillText(n.id.length > 26 ? n.id.slice(0, 25) + "..." : n.id, n.x + r + 4, n.y + 3.5);
412
+ const text = n.id.length > 26 ? n.id.slice(0, 25) + "…" : n.id;
413
+ label(text, n.x + r + 5 / scale, n.y + 4 / scale, n === selected || n === hover ? "--ink" : "--ink-dim", 500, 11.5);
375
414
  }
376
415
  }
377
416
  if (n === selected || n === hover) {
@@ -396,8 +435,8 @@ function drawGraph(canvas, wrap, s) {
396
435
  const p = toWorld(ev);
397
436
  // Members first: an open group's node must never swallow a click meant for a fact.
398
437
  const vis = shown();
399
- return vis.filter((n) => !n.isGroup).find((n) => Math.hypot(n.x - p.x, n.y - p.y) < radius(n) + 6)
400
- ?? vis.filter((n) => n.isGroup).find((n) => Math.hypot(n.x - p.x, n.y - p.y) < radius(n) + 5);
438
+ return vis.filter((n) => !n.isGroup).find((n) => Math.hypot(n.x - p.x, n.y - p.y) < seen(n) + 6 / scale)
439
+ ?? vis.filter((n) => n.isGroup).find((n) => Math.hypot(n.x - p.x, n.y - p.y) < seen(n) + 5 / scale);
401
440
  };
402
441
 
403
442
  canvas.onpointerdown = (ev) => {
@@ -6,7 +6,7 @@
6
6
  * sheet, the same thread view Trackers has, with the reply box in it. */
7
7
 
8
8
  import { getLive, post } from "../api.js";
9
- import { sheet } from "../dialog.js";
9
+ import { askText, sheet } from "../dialog.js";
10
10
  import { ago, el, skeleton } from "../dom.js";
11
11
  import { daysUntil, isFor, sortHome } from "../homesort.js";
12
12
  import { mdlite } from "../md.js";
@@ -56,7 +56,6 @@ export function viewHome(m) {
56
56
 
57
57
  const page = el("div", { className: "home" });
58
58
  page.append(team(staff));
59
- page.append(askBox(staff));
60
59
 
61
60
  /* With more than one person, each sees what is on them, plus anything on nobody in
62
61
  particular. Everyone's is one click away, so nothing is hidden for good. */
@@ -75,12 +74,7 @@ export function viewHome(m) {
75
74
  );
76
75
  } else page.append(el("p", { className: "homeempty", textContent: "Nothing needs you." }));
77
76
 
78
- const reporters = staff.filter((x) => x.brain && x.statusIssue);
79
- if (reporters.length) {
80
- page.append(section("Progress"));
81
- page.append(el("div", { className: "homereports" }, reporters.map((s) => reportRow(s, h.reports))));
82
- }
83
-
77
+ // What is waiting on you, or was asked by you, comes before how the staff say it is going.
84
78
  if (h.unread.length) {
85
79
  page.append(section("Unread", h.unread.length));
86
80
  page.append(listBox(h.unread.map(unreadRow)));
@@ -91,6 +85,12 @@ export function viewHome(m) {
91
85
  page.append(listBox(h.requests.map(requestRow)));
92
86
  }
93
87
 
88
+ const reporters = staff.filter((x) => x.brain && x.statusIssue);
89
+ if (reporters.length) {
90
+ page.append(section("Progress"));
91
+ page.append(el("div", { className: "card homereports" }, reporters.map((s) => reportRow(s, h.reports))));
92
+ }
93
+
94
94
  if (h.closedToday.length) {
95
95
  page.append(section("Closed today", h.closedToday.length));
96
96
  page.append(listBox(h.closedToday.map(closedRow)));
@@ -109,15 +109,15 @@ const openReports = new Set();
109
109
  const STATUS_TONE = { "on track": "ok", "needs you": "warm", stuck: "hot", blocked: "hot" };
110
110
 
111
111
  /**
112
- * One staff member's report: the body of their status issue, which every run rewrites, as a
113
- * card. Its status and one line on how it is going, what got done and what is next, with the
114
- * rest a click away. There is a button to ask for a fresh one.
112
+ * One staff member's report, as a row: who, their status, and when it was written; then the
113
+ * one line on how it is going and what is next. What got done, and the rest of the report,
114
+ * open under it. Their status issue is rewritten by every run, so this is always the latest.
115
115
  */
116
116
  function reportRow(s, reports) {
117
117
  const r = reports.find((x) => x.staff.handle === s.handle);
118
118
  const item = r?.item ?? { repo: s.brain, number: s.statusIssue, kind: "issue" };
119
119
  const note = el("span", { className: "meta" });
120
- const ask = el("button", { className: "ghbtn", textContent: "Ask for an update" });
120
+ const ask = el("button", { className: "ghbtn sm", textContent: "Ask for an update" });
121
121
  ask.onclick = async () => {
122
122
  ask.disabled = true;
123
123
  note.className = "meta";
@@ -140,10 +140,12 @@ function reportRow(s, reports) {
140
140
  };
141
141
 
142
142
  const full = openReports.has(s.handle);
143
- const card = el("div", { className: "card homereport" + (full ? " full" : "") });
143
+ const row = el("div", { className: "homereport" + (full ? " full" : "") });
144
144
  const issue = el("button", { className: "homereportissue", textContent: "#" + item.number });
145
145
  issue.onclick = () => openThread(item);
146
146
  const p = r ? parseReport(r.body) : null;
147
+ const needs = p?.sections.needs?.length ?? 0;
148
+
147
149
  const head = el("div", { className: "homereporthead" }, [
148
150
  el("span", { className: "homewho2" }, [icon(staffIcon(s), "ic"), el("b", { textContent: s.name })]),
149
151
  ]);
@@ -151,7 +153,8 @@ function reportRow(s, reports) {
151
153
  head.append(
152
154
  el("span", {
153
155
  className: "chip homereportstatus " + (STATUS_TONE[p.status] ?? ""),
154
- textContent: cap(p.status),
156
+ textContent: cap(p.status) + (needs ? ` · ${needs}` : ""),
157
+ title: needs ? `Waiting on a person: ${needs} thing${needs === 1 ? "" : "s"}` : "",
155
158
  }),
156
159
  );
157
160
  }
@@ -161,48 +164,53 @@ function reportRow(s, reports) {
161
164
  issue,
162
165
  ]),
163
166
  );
164
- card.append(head);
167
+ const acts = el("span", { className: "homereportacts" }, [note]);
168
+ if (r) {
169
+ const more = el("button", { className: "ghbtn sm", textContent: full ? "Show less" : "Full report" });
170
+ more.onclick = () => {
171
+ if (openReports.has(s.handle)) openReports.delete(s.handle);
172
+ else openReports.add(s.handle);
173
+ repaintInPlace();
174
+ };
175
+ acts.append(more);
176
+ }
177
+ acts.append(ask);
178
+ head.append(acts);
179
+ row.append(head);
165
180
 
166
- if (p) {
167
- if (p.headline) {
168
- card.append(el("div", { className: "md homereportline", innerHTML: mdlite(p.headline, { repo: s.brain }) }));
169
- }
181
+ if (!p) return row;
182
+ if (p.headline) {
183
+ row.append(el("div", { className: "md homereportline", innerHTML: mdlite(p.headline, { repo: s.brain }) }));
184
+ }
185
+ const next = p.sections.next?.[0];
186
+ if (next && !full) {
187
+ row.append(
188
+ el("div", { className: "homereportnext" }, [
189
+ el("b", { textContent: "Next" }),
190
+ el("span", { className: "md", innerHTML: mdlite(next, { repo: s.brain }) }),
191
+ ]),
192
+ );
193
+ }
194
+ if (full) {
170
195
  const cols = [
171
196
  ["done", "Done"],
172
197
  ["next", "Next"],
198
+ ["needs", "Waiting on a person"],
173
199
  ].filter(([k]) => p.sections[k]?.length);
174
- if (cols.length && !full) {
175
- card.append(
200
+ if (cols.length) {
201
+ row.append(
176
202
  el(
177
203
  "div",
178
204
  { className: "homereportcols" },
179
- cols.map(([k, label]) => bullets(label, p.sections[k], s.brain, 3)),
205
+ cols.map(([k, label]) => bullets(label, p.sections[k], s.brain, 99)),
180
206
  ),
181
207
  );
208
+ } else {
209
+ // A report in the old shape has no sections, so the whole of it stands in.
210
+ row.append(el("div", { className: "md homereportbody", innerHTML: mdlite(r.body, { repo: s.brain }) }));
182
211
  }
183
- const needs = p.sections.needs?.length ?? 0;
184
- if (needs && !full) {
185
- card.append(
186
- el("p", {
187
- className: "homereportneeds",
188
- textContent: `Waiting on a person: ${needs} thing${needs === 1 ? "" : "s"}.`,
189
- }),
190
- );
191
- }
192
- // A report in the old shape has no sections to show, so its opening lines stand in.
193
- const body = el("div", { className: "md homereportbody", innerHTML: mdlite(r.body, { repo: s.brain }) });
194
- if (full || !cols.length) card.append(body);
195
- if (!cols.length && !full) body.classList.add("fade");
196
212
  }
197
-
198
- const more = el("button", { className: "ghbtn", textContent: full ? "Show less" : "Read the full report" });
199
- more.onclick = () => {
200
- if (openReports.has(s.handle)) openReports.delete(s.handle);
201
- else openReports.add(s.handle);
202
- repaintInPlace();
203
- };
204
- card.append(el("div", { className: "row homereportacts" }, [...(r ? [more] : []), ask, note]));
205
- return card;
213
+ return row;
206
214
  }
207
215
 
208
216
  /** A short list under a label, with how many more there are once it runs past `max`. */
@@ -219,72 +227,44 @@ function bullets(label, items, repo, max) {
219
227
 
220
228
  /* ------------------------------- asking -------------------------------- */
221
229
 
222
- /** What is in the ask box, kept across repaints. */
223
- const askDraft = { who: "", text: "" };
230
+ /** What each staff member is being asked, kept if the dialog is closed before sending. */
231
+ const askDrafts = {};
232
+ /** When each was last asked, so their card can say so until they pick it up. */
233
+ const askedAt = {};
224
234
 
225
- function askBox(staff) {
226
- const people = staff.filter((x) => x.brain);
227
- const who = el("select", { className: "homewho", id: "homewho" });
228
- for (const s of people) {
229
- who.append(el("option", { value: s.handle, textContent: s.name }));
230
- }
231
- if (askDraft.who && people.some((x) => x.handle === askDraft.who)) who.value = askDraft.who;
232
- const text = el("textarea", {
233
- className: "homeask",
234
- rows: 3,
235
- ariaLabel: "What you need",
235
+ /**
236
+ * Asking one staff member to do something: their card's button opens this, already addressed
237
+ * to them. It becomes a new issue on their tracker that mentions them, which starts a run.
238
+ */
239
+ async function askStaff(s, error = "") {
240
+ const said = await askText({
241
+ title: `Ask ${s.name}`,
242
+ hint: error,
243
+ value: askDrafts[s.handle] ?? "",
236
244
  placeholder: "What do you need? For example: write a post about the new pricing page.",
237
- value: askDraft.text,
238
- });
239
- // Home repaints as runs start and finish, and what you were typing must survive that.
240
- text.oninput = () => {
241
- askDraft.text = text.value;
242
- };
243
- const send = el("button", { className: "ghbtn primary" });
244
- const label = () => {
245
- const s = people.find((x) => x.handle === who.value);
246
- send.textContent = s ? `Send to ${s.name}` : "Send";
247
- };
248
- label();
249
- who.onchange = () => {
250
- askDraft.who = who.value;
251
- label();
252
- };
253
- const note = el("span", { className: "meta" });
254
- send.onclick = async () => {
255
- const s = staff.find((x) => x.handle === who.value);
256
- const said = text.value.trim();
257
- if (!s || !said) {
258
- text.focus();
259
- return;
260
- }
261
- send.disabled = true;
262
- note.className = "meta";
263
- note.textContent = "Sending…";
264
- try {
265
- await post({
266
- action: "create",
267
- repo: s.brain,
268
- title: titleOf(said),
269
- body: `${s.mention ?? "@" + s.handle} ${said}`,
245
+ confirm: "Send",
246
+ decorate: (ta) => {
247
+ ta.addEventListener("input", () => {
248
+ askDrafts[s.handle] = ta.value;
270
249
  });
271
- text.value = "";
272
- askDraft.text = "";
273
- note.textContent = `Sent. ${s.name} starts in about a minute.`;
274
- refreshSoon();
275
- } catch (e) {
276
- note.textContent = String(e.message || e);
277
- note.className = "meta err";
278
- } finally {
279
- send.disabled = false;
280
- }
281
- };
282
- return el("div", { className: "card homeaskcard" }, [
283
- el("h2", { className: "homeasktitle", textContent: "Ask a staff member to do something" }),
284
- el("div", { className: "row homeaskto" }, [el("label", { htmlFor: "homewho", textContent: "To" }), who]),
285
- text,
286
- el("div", { className: "row" }, [send, note]),
287
- ]);
250
+ },
251
+ });
252
+ if (!said) return;
253
+ try {
254
+ await post({
255
+ action: "create",
256
+ repo: s.brain,
257
+ title: titleOf(said),
258
+ body: `${s.mention ?? "@" + s.handle} ${said}`,
259
+ });
260
+ delete askDrafts[s.handle];
261
+ askedAt[s.handle] = Date.now();
262
+ repaintInPlace();
263
+ refreshSoon();
264
+ } catch (e) {
265
+ askDrafts[s.handle] = said;
266
+ await askStaff(s, String(e.message || e));
267
+ }
288
268
  }
289
269
 
290
270
  /** The first line, short enough to be an issue title. */
@@ -543,6 +523,10 @@ function team(staff) {
543
523
  } else if (last) {
544
524
  line = `Last finished ${ago(last.updatedAt)}`;
545
525
  }
526
+ // A run takes about a minute to start, and until then the card would say nothing happened.
527
+ if (!busy && !queued && Date.now() - (askedAt[s.handle] ?? 0) < 120_000) {
528
+ line = "Sent. Starts in about a minute";
529
+ }
546
530
 
547
531
  const issue = (busy || queued) && runs[0].issue && s.brain ? runs[0].issue : null;
548
532
  const card = el("div", {
@@ -567,10 +551,15 @@ function team(staff) {
567
551
  el("a", { className: "orblog", href: log, target: "_blank", rel: "noopener", textContent: "View log" }),
568
552
  );
569
553
  }
554
+ if (s.brain) {
555
+ const ask = el("button", { className: "ghbtn orbask", textContent: "Ask a question" });
556
+ ask.onclick = () => askStaff(s);
557
+ card.append(el("span", { className: "orbgap" }), ask);
558
+ }
570
559
  if (issue) {
571
560
  const open = () => openThread({ repo: s.brain, number: issue, kind: "issue" });
572
561
  card.onclick = (ev) => {
573
- if (!ev.target.closest("a")) open();
562
+ if (!ev.target.closest("a, button")) open();
574
563
  };
575
564
  card.onkeydown = (ev) => {
576
565
  if (ev.target === card && (ev.key === "Enter" || ev.key === " ")) {
@@ -619,10 +608,7 @@ function poll() {
619
608
  issuesAt = Date.now();
620
609
  refreshSoon(false);
621
610
  } else if (changed && S.view === "home" && !document.querySelector("dialog[open]")) {
622
- /* Typing in the ask box is not interrupted by a run starting: only the orbs move. */
623
- const row = document.querySelector(".hometeam");
624
- if (row && document.activeElement?.closest?.(".homeaskcard")) row.replaceWith(team(S.data.staff));
625
- else repaintInPlace();
611
+ repaintInPlace();
626
612
  }
627
613
  })
628
614
  .catch(() => {})
@@ -6,6 +6,7 @@
6
6
 
7
7
  import { post } from "../api.js";
8
8
  import { el } from "../dom.js";
9
+ import { icon } from "../icons.js";
9
10
  import { refreshAll } from "../refresh.js";
10
11
  import { S } from "../state.js";
11
12
 
@@ -36,7 +37,7 @@ export function peopleCard() {
36
37
  el("span", { textContent: "Name" }),
37
38
  el("span", { textContent: "GitHub login" }),
38
39
  el("span", { textContent: "Looks after" }),
39
- el("span", { textContent: "Read only" }),
40
+ el("span", { className: "peopleonlyhead", textContent: "Read only" }),
40
41
  el("span"),
41
42
  ]),
42
43
  ...rows.map((p, i) => row(p, i)),
@@ -58,7 +59,12 @@ export function peopleCard() {
58
59
  p.view_only = only.checked;
59
60
  stamp();
60
61
  };
61
- const remove = el("button", { className: "ghbtn danger", textContent: "Remove" });
62
+ // Quiet on purpose: one per row, and a column of red buttons outshouts the list it edits.
63
+ const remove = el("button", {
64
+ className: "iconbtn peopleremove",
65
+ title: "Remove",
66
+ ariaLabel: `Remove ${p.name || "this person"}`,
67
+ }, [icon("trash", "ic")]);
62
68
  remove.onclick = () => {
63
69
  rows.splice(i, 1);
64
70
  paint();
@@ -142,7 +142,9 @@ function row(r) {
142
142
  tr.innerHTML =
143
143
  '<td title="' + esc(r.createdAt) + '">' + esc(ago(r.createdAt)) + "</td>" +
144
144
  "<td>" + esc(r.kind) + "</td>" +
145
- '<td><span class="chip ' + out.tone + '">' + esc(out.word) + "</span></td>" +
145
+ (out.tone === "ok"
146
+ ? '<td><span class="runok"><i></i>' + esc(out.word) + "</span></td>"
147
+ : '<td><span class="chip ' + out.tone + '">' + esc(out.word) + "</span></td>") +
146
148
  "<td>" + (mins != null ? Math.round(mins) + "m" : "–") + "</td>" +
147
149
  "<td>" + (rec.turns ?? "–") + "</td>" +
148
150
  "<td>" + (typeof rec.cost_usd === "number" ? "$" + rec.cost_usd.toFixed(2) : "–") + "</td>" +