@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.
- package/dist/cli.js +10 -1
- package/dist/worker/assets/assets/css/astryx.css +948 -0
- package/dist/worker/assets/assets/css/base.css +47 -112
- package/dist/worker/assets/assets/css/brain.css +15 -11
- package/dist/worker/assets/assets/css/graph.css +9 -12
- package/dist/worker/assets/assets/css/health.css +4 -7
- package/dist/worker/assets/assets/css/home.css +27 -29
- package/dist/worker/assets/assets/css/layout.css +10 -20
- package/dist/worker/assets/assets/css/markdown.css +1 -1
- package/dist/worker/assets/assets/css/runs.css +5 -3
- package/dist/worker/assets/assets/css/search.css +3 -6
- package/dist/worker/assets/assets/css/setup.css +3 -15
- package/dist/worker/assets/assets/js/app.js +2 -0
- package/dist/worker/assets/assets/js/astryx-ui.js +34 -0
- package/dist/worker/assets/assets/js/homesort.js +43 -4
- package/dist/worker/assets/assets/js/icons.js +2 -0
- package/dist/worker/assets/assets/js/select.js +362 -0
- package/dist/worker/assets/assets/js/views/graph.js +67 -28
- package/dist/worker/assets/assets/js/views/home.js +98 -112
- package/dist/worker/assets/assets/js/views/people.js +8 -2
- package/dist/worker/assets/assets/js/views/runs.js +3 -1
- package/dist/worker/assets/docs-images/brain.jpg +0 -0
- package/dist/worker/assets/docs-images/home.jpg +0 -0
- package/dist/worker/assets/docs-images/org.jpg +0 -0
- package/dist/worker/assets/docs-images/prompt.jpg +0 -0
- package/dist/worker/assets/docs-images/setup-org.jpg +0 -0
- package/dist/worker/assets/docs-images/setup-plan.jpg +0 -0
- package/dist/worker/assets/docs-images/staff.jpg +0 -0
- package/dist/worker/assets/index.html +11 -3
- package/dist/worker/index.js +28 -4
- package/docs/getting-started.md +1 -1
- package/docs/images/brain.jpg +0 -0
- package/docs/images/home.jpg +0 -0
- package/docs/images/org.jpg +0 -0
- package/docs/images/prompt.jpg +0 -0
- package/docs/images/setup-org.jpg +0 -0
- package/docs/images/setup-plan.jpg +0 -0
- package/docs/images/staff.jpg +0 -0
- package/docs/portal.md +16 -11
- package/package.json +7 -1
- package/templates/portal/css/astryx.css +948 -0
- package/templates/portal/css/base.css +47 -112
- package/templates/portal/css/brain.css +15 -11
- package/templates/portal/css/graph.css +9 -12
- package/templates/portal/css/health.css +4 -7
- package/templates/portal/css/home.css +27 -29
- package/templates/portal/css/layout.css +10 -20
- package/templates/portal/css/markdown.css +1 -1
- package/templates/portal/css/runs.css +5 -3
- package/templates/portal/css/search.css +3 -6
- package/templates/portal/css/setup.css +3 -15
- package/templates/portal/index.html +11 -3
- package/templates/portal/js/app.js +2 -0
- package/templates/portal/js/astryx-ui.js +34 -0
- package/templates/portal/js/homesort.js +43 -4
- package/templates/portal/js/icons.js +2 -0
- package/templates/portal/js/select.js +362 -0
- package/templates/portal/js/views/graph.js +67 -28
- package/templates/portal/js/views/home.js +98 -112
- package/templates/portal/js/views/people.js +8 -2
- 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
|
-
|
|
57
|
-
|
|
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
|
-
|
|
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: "
|
|
170
|
-
el("button", { textContent: "
|
|
171
|
-
el("button", { textContent: "
|
|
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
|
-
|
|
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 =
|
|
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
|
-
|
|
326
|
-
|
|
327
|
-
ctx.
|
|
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 =
|
|
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 =
|
|
345
|
-
ctx.fillStyle =
|
|
385
|
+
ctx.strokeStyle = hue(n.group); ctx.lineWidth = 2 / scale; ctx.stroke();
|
|
386
|
+
ctx.fillStyle = hue(n.group);
|
|
346
387
|
} else {
|
|
347
|
-
ctx.fillStyle =
|
|
348
|
-
ctx.fillStyle = css("--
|
|
388
|
+
ctx.fillStyle = hue(n.group); ctx.fill();
|
|
389
|
+
ctx.fillStyle = css("--panel");
|
|
349
390
|
}
|
|
350
|
-
ctx.font = "600 " + Math.max(9, r * 0.
|
|
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 =
|
|
356
|
-
ctx.font = "600 " + fs + "px
|
|
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
|
-
|
|
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 =
|
|
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
|
-
|
|
373
|
-
|
|
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) <
|
|
400
|
-
?? vis.filter((n) => n.isGroup).find((n) => Math.hypot(n.x - p.x, n.y - p.y) <
|
|
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
|
-
|
|
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
|
|
113
|
-
*
|
|
114
|
-
*
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
168
|
-
|
|
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
|
|
175
|
-
|
|
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,
|
|
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
|
|
223
|
-
const
|
|
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
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
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
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
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
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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>" +
|