@nanocollective/roster 0.1.0-beta.3 → 0.1.0-beta.5
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 +23 -17
- package/dist/worker/assets/assets/css/home.css +30 -27
- package/dist/worker/assets/assets/js/views/home.js +57 -51
- package/dist/worker/index.js +30 -18
- package/package.json +1 -1
- package/templates/portal/css/home.css +30 -27
- package/templates/portal/js/views/home.js +57 -51
package/dist/cli.js
CHANGED
|
@@ -7548,12 +7548,14 @@ function isTextPath(path, size2) {
|
|
|
7548
7548
|
return size2 <= MAX_TEXT && !BINARY.test(path);
|
|
7549
7549
|
}
|
|
7550
7550
|
var Snapshots = class {
|
|
7551
|
-
constructor(kv, freshMs = 4e3) {
|
|
7551
|
+
constructor(kv, freshMs = 4e3, shareInflight = true) {
|
|
7552
7552
|
this.kv = kv;
|
|
7553
7553
|
this.freshMs = freshMs;
|
|
7554
|
+
this.shareInflight = shareInflight;
|
|
7554
7555
|
}
|
|
7555
7556
|
kv;
|
|
7556
7557
|
freshMs;
|
|
7558
|
+
shareInflight;
|
|
7557
7559
|
repos = /* @__PURE__ */ new Map();
|
|
7558
7560
|
inflight = /* @__PURE__ */ new Map();
|
|
7559
7561
|
checked = /* @__PURE__ */ new Map();
|
|
@@ -7573,13 +7575,20 @@ var Snapshots = class {
|
|
|
7573
7575
|
if (!opts.force && this.repos.has(repo) && Date.now() - last < this.freshMs) {
|
|
7574
7576
|
return Promise.resolve({ ok: true, changed: false });
|
|
7575
7577
|
}
|
|
7578
|
+
const pathsOnly = opts.pathsOnly === true;
|
|
7579
|
+
if (!this.shareInflight) {
|
|
7580
|
+
return this.load(gh, repo, pathsOnly, (step) => opts.report?.(repo, step));
|
|
7581
|
+
}
|
|
7576
7582
|
if (opts.report) {
|
|
7577
7583
|
if (!this.listeners.has(repo)) this.listeners.set(repo, /* @__PURE__ */ new Set());
|
|
7578
7584
|
this.listeners.get(repo).add(opts.report);
|
|
7579
7585
|
}
|
|
7580
7586
|
const running = this.inflight.get(repo);
|
|
7581
7587
|
if (running) return running;
|
|
7582
|
-
const
|
|
7588
|
+
const say = (step) => {
|
|
7589
|
+
for (const report3 of this.listeners.get(repo) ?? []) report3(repo, step);
|
|
7590
|
+
};
|
|
7591
|
+
const work = this.load(gh, repo, pathsOnly, say).finally(() => {
|
|
7583
7592
|
this.inflight.delete(repo);
|
|
7584
7593
|
this.listeners.delete(repo);
|
|
7585
7594
|
});
|
|
@@ -7603,11 +7612,8 @@ var Snapshots = class {
|
|
|
7603
7612
|
if (commit2) snap.sha = commit2;
|
|
7604
7613
|
void this.kv.put(`blob:${sha}`, text2);
|
|
7605
7614
|
}
|
|
7606
|
-
|
|
7607
|
-
|
|
7608
|
-
}
|
|
7609
|
-
async load(gh, repo, pathsOnly) {
|
|
7610
|
-
this.say(repo, "checking for changes");
|
|
7615
|
+
async load(gh, repo, pathsOnly, say) {
|
|
7616
|
+
say("checking for changes");
|
|
7611
7617
|
const head2 = await gh.request("GET", `repos/${repo}/commits/HEAD`, {
|
|
7612
7618
|
accept: "application/vnd.github.sha",
|
|
7613
7619
|
as: "text"
|
|
@@ -7619,16 +7625,16 @@ var Snapshots = class {
|
|
|
7619
7625
|
const sha = head2.data.trim();
|
|
7620
7626
|
const before = this.repos.get(repo);
|
|
7621
7627
|
if (before && before.sha === sha && before.pathsOnly === pathsOnly) {
|
|
7622
|
-
|
|
7628
|
+
say("up to date");
|
|
7623
7629
|
return { ok: true, changed: false };
|
|
7624
7630
|
}
|
|
7625
|
-
|
|
7626
|
-
const next = await this.build(gh, repo, sha, pathsOnly, before);
|
|
7631
|
+
say("reading the file list");
|
|
7632
|
+
const next = await this.build(gh, repo, sha, pathsOnly, say, before);
|
|
7627
7633
|
if (!next.ok) return { ok: false, changed: false, error: next.error, status: next.status };
|
|
7628
7634
|
this.repos.set(repo, next.snap);
|
|
7629
7635
|
return { ok: true, changed: true };
|
|
7630
7636
|
}
|
|
7631
|
-
async build(gh, repo, sha, pathsOnly, before) {
|
|
7637
|
+
async build(gh, repo, sha, pathsOnly, say, before) {
|
|
7632
7638
|
const [tree, commit2] = await Promise.all([
|
|
7633
7639
|
gh.request(
|
|
7634
7640
|
"GET",
|
|
@@ -7671,7 +7677,7 @@ var Snapshots = class {
|
|
|
7671
7677
|
})
|
|
7672
7678
|
);
|
|
7673
7679
|
if (missing2.length > TARBALL_OVER) {
|
|
7674
|
-
|
|
7680
|
+
say("downloading the repository");
|
|
7675
7681
|
const tgz = await gh.request("GET", `repos/${repo}/tarball/${sha}`, {
|
|
7676
7682
|
as: "bytes"
|
|
7677
7683
|
});
|
|
@@ -7687,7 +7693,7 @@ var Snapshots = class {
|
|
|
7687
7693
|
}
|
|
7688
7694
|
} else {
|
|
7689
7695
|
if (missing2.length) {
|
|
7690
|
-
|
|
7696
|
+
say(`fetching ${missing2.length} changed file${missing2.length === 1 ? "" : "s"}`);
|
|
7691
7697
|
}
|
|
7692
7698
|
await pool2(missing2, 8, async ([, e]) => {
|
|
7693
7699
|
const res = await gh.request("GET", `repos/${repo}/git/blobs/${e.sha}`, {
|
|
@@ -7701,7 +7707,7 @@ var Snapshots = class {
|
|
|
7701
7707
|
void this.kv.put(`blob:${e.sha}`, text2);
|
|
7702
7708
|
});
|
|
7703
7709
|
}
|
|
7704
|
-
await this.dates(gh, repo, snap, before);
|
|
7710
|
+
await this.dates(gh, repo, snap, say, before);
|
|
7705
7711
|
return { ok: true, snap };
|
|
7706
7712
|
}
|
|
7707
7713
|
/**
|
|
@@ -7711,7 +7717,7 @@ var Snapshots = class {
|
|
|
7711
7717
|
* GitHub, in batches, only for the ones that are new or changed. Kept by commit, so a warm
|
|
7712
7718
|
* start never asks at all.
|
|
7713
7719
|
*/
|
|
7714
|
-
async dates(gh, repo, snap, before) {
|
|
7720
|
+
async dates(gh, repo, snap, say, before) {
|
|
7715
7721
|
const key = `dates:${repo}@${snap.sha}`;
|
|
7716
7722
|
const kept = await this.kv.get(key);
|
|
7717
7723
|
if (kept) {
|
|
@@ -7726,7 +7732,7 @@ var Snapshots = class {
|
|
|
7726
7732
|
else ask.push(path);
|
|
7727
7733
|
}
|
|
7728
7734
|
const [owner, name] = repo.split("/");
|
|
7729
|
-
if (ask.length)
|
|
7735
|
+
if (ask.length) say("reading file dates");
|
|
7730
7736
|
for (let i = 0; i < ask.length; i += DATES_PER_QUERY) {
|
|
7731
7737
|
const batch = ask.slice(i, i + DATES_PER_QUERY);
|
|
7732
7738
|
const fields = batch.map(
|
|
@@ -7812,7 +7818,7 @@ var TTL = 45e3;
|
|
|
7812
7818
|
var LABEL_TTL = 3e5;
|
|
7813
7819
|
function createPortal(opts) {
|
|
7814
7820
|
const root2 = opts.root ?? `/@roster/${opts.org}`;
|
|
7815
|
-
const snapshots = new Snapshots(opts.kv);
|
|
7821
|
+
const snapshots = new Snapshots(opts.kv, void 0, opts.shareInflight ?? true);
|
|
7816
7822
|
mount(
|
|
7817
7823
|
root2,
|
|
7818
7824
|
snapshots.tree((repo) => repo.slice(repo.indexOf("/") + 1))
|
|
@@ -20,24 +20,33 @@
|
|
|
20
20
|
.homewho{font:500 12.5px var(--sans);color:var(--ink);background:var(--surface-2);border:0;
|
|
21
21
|
border-radius:8px;padding:5px 8px}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
/* Needs you: one list, a row per thing. A dot column for unread, the thing itself, and its
|
|
24
|
+
action; titles all start in the same place, and buttons are small enough not to shout. */
|
|
25
|
+
.homelist{padding:0 16px}
|
|
26
|
+
.homeneed{display:grid;grid-template-columns:8px minmax(0,1fr) auto;align-items:center;
|
|
27
|
+
gap:4px 14px;padding:14px 0;cursor:pointer}
|
|
28
|
+
.homeneed + .homeneed{border-top:1px solid var(--line)}
|
|
29
|
+
.homeneed:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:6px}
|
|
30
|
+
.homeneed:hover .homeopen{text-decoration:underline}
|
|
31
|
+
.homedot{align-self:start;width:7px;height:7px;margin-top:7px;border-radius:50%}
|
|
32
|
+
.homeneed.unread .homedot{background:var(--blue)}
|
|
25
33
|
.homeabout{min-width:0}
|
|
26
|
-
.
|
|
27
|
-
.homecard:focus-visible{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
|
|
28
|
-
.homehead{display:flex;align-items:baseline;gap:8px}
|
|
29
|
-
.homehead .chip{flex:none}
|
|
30
|
-
.homeopen{all:unset;cursor:pointer;font:600 14px/1.35 var(--sans);color:var(--ink);letter-spacing:-.01em}
|
|
31
|
-
.homeopen:hover{text-decoration:underline}
|
|
34
|
+
.homeopen{all:unset;cursor:pointer;font:600 14px/1.4 var(--sans);color:var(--ink);letter-spacing:-.01em}
|
|
32
35
|
.homeopen:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:4px}
|
|
33
|
-
.homeabout > .meta{margin-top:
|
|
34
|
-
.
|
|
35
|
-
.
|
|
36
|
-
.
|
|
36
|
+
.homeabout > .meta{margin-top:3px}
|
|
37
|
+
.homekind{font-weight:600;color:var(--ink-dim)}
|
|
38
|
+
.homekind.hot{color:var(--err)}
|
|
39
|
+
.homekind.warm{color:var(--warn)}
|
|
40
|
+
.homekind.cool{color:var(--ruled)}
|
|
41
|
+
.homekind.ok{color:var(--accent)}
|
|
42
|
+
.homedue{margin:5px 0 0;font-size:12.5px;color:var(--ink-dim)}
|
|
43
|
+
.homedue.late,.homedue .bad{color:var(--warn)}
|
|
44
|
+
.homeacts{justify-content:flex-end;flex-wrap:nowrap;gap:8px}
|
|
45
|
+
.homeacts .ghbtn{min-height:28px;padding:3px 12px;font-size:12.5px}
|
|
37
46
|
.homeacts .meta{white-space:normal;text-align:right;max-width:220px}
|
|
38
47
|
@media (max-width:640px){
|
|
39
|
-
.
|
|
40
|
-
.homeacts{justify-content:flex-start;flex-wrap:wrap}
|
|
48
|
+
.homeneed{grid-template-columns:8px minmax(0,1fr)}
|
|
49
|
+
.homeacts{grid-column:2;justify-content:flex-start;flex-wrap:wrap}
|
|
41
50
|
.homeacts .meta{text-align:left}
|
|
42
51
|
}
|
|
43
52
|
|
|
@@ -63,17 +72,14 @@
|
|
|
63
72
|
}
|
|
64
73
|
|
|
65
74
|
.homerest{margin-top:26px}
|
|
66
|
-
.
|
|
75
|
+
.homeneed.gone,.homeline.gone{opacity:0;transform:translateX(12px);
|
|
67
76
|
transition:opacity .2s var(--ease),transform .2s var(--ease)}
|
|
68
77
|
|
|
69
|
-
/* Activity you have not seen: a blue dot and a bold title
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
GitHub. */
|
|
73
|
-
.homecard.unread{box-shadow:inset 3px 0 0 var(--blue)}
|
|
78
|
+
/* Activity you have not seen: a blue dot and a bold title. In Needs you the dot has a column of
|
|
79
|
+
its own; in the other lists it sits before the title. Opening the thread marks it read, here
|
|
80
|
+
and on GitHub. */
|
|
74
81
|
.unread .homeopen,.unread .homerowtitle{font-weight:700}
|
|
75
|
-
|
|
76
|
-
background:var(--blue);margin:0 7px 1px 0;vertical-align:middle}
|
|
82
|
+
|
|
77
83
|
|
|
78
84
|
.homereports{display:flex;flex-direction:column;gap:14px;padding:14px 16px}
|
|
79
85
|
.homereport{display:grid;grid-template-columns:190px 1fr;gap:12px;font-size:13px;line-height:1.5;
|
|
@@ -87,15 +93,12 @@
|
|
|
87
93
|
.homereportbody a{color:var(--accent)}
|
|
88
94
|
@media (max-width:640px){.homereport{grid-template-columns:1fr;gap:4px}}
|
|
89
95
|
|
|
90
|
-
@media (max-width:640px){
|
|
91
|
-
.homehead{flex-wrap:wrap}
|
|
92
|
-
}
|
|
93
96
|
|
|
94
97
|
/* Rows in a list card (Unread, Your requests, Closed today) that open a thread. */
|
|
95
|
-
.homeline{display:grid;grid-template-columns:
|
|
98
|
+
.homeline{display:grid;grid-template-columns:8px minmax(0,1fr) auto;align-items:center;gap:4px 14px;
|
|
96
99
|
padding:12px 0;font-size:13.5px;cursor:pointer}
|
|
100
|
+
.homeline.unread .homedot{background:var(--blue)}
|
|
97
101
|
.homeline + .homeline{border-top:1px solid var(--line)}
|
|
98
|
-
.homeline .homestate{min-width:64px;justify-content:center}
|
|
99
102
|
.homeline:hover .homerowtitle{text-decoration:underline}
|
|
100
103
|
.homeline:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:6px}
|
|
101
104
|
.homerowtitle{font-weight:600;color:var(--ink)}
|
|
@@ -87,8 +87,11 @@ export function viewHome(m) {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
page.append(section("Needs you", h.needs.length));
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
/* One list rather than a card each: five boxes with a green button apiece read as a wall, and
|
|
91
|
+
nothing in it said which to do first. The top row's action is the one in green. */
|
|
92
|
+
if (h.needs.length) {
|
|
93
|
+
page.append(el("div", { className: "card homelist" }, h.needs.map((e, i) => needRow(e, i === 0))));
|
|
94
|
+
} else page.append(el("p", { className: "homeempty", textContent: "Nothing needs you." }));
|
|
92
95
|
|
|
93
96
|
if (h.unread.length) {
|
|
94
97
|
page.append(section("Unread", h.unread.length));
|
|
@@ -165,57 +168,59 @@ function titleOf(said) {
|
|
|
165
168
|
|
|
166
169
|
/* ------------------------------ needs you ------------------------------- */
|
|
167
170
|
|
|
168
|
-
function
|
|
171
|
+
function needRow(e, first) {
|
|
169
172
|
const { item, kind } = e;
|
|
170
|
-
/* The whole
|
|
173
|
+
/* The whole row opens the thread; the one quick action on it does not. Answering in words
|
|
171
174
|
happens in the thread, where what was asked is in front of you. */
|
|
172
|
-
const
|
|
173
|
-
className: "
|
|
175
|
+
const row = el("div", {
|
|
176
|
+
className: "homeneed" + (item.unread ? " unread" : ""),
|
|
174
177
|
tabIndex: 0,
|
|
175
178
|
role: "button",
|
|
176
179
|
});
|
|
177
|
-
|
|
180
|
+
row.onclick = (ev) => {
|
|
178
181
|
if (!ev.target.closest("button, a, textarea")) openThread(item);
|
|
179
182
|
};
|
|
180
|
-
|
|
181
|
-
if (ev.target ===
|
|
183
|
+
row.onkeydown = (ev) => {
|
|
184
|
+
if (ev.target === row && (ev.key === "Enter" || ev.key === " ")) {
|
|
182
185
|
ev.preventDefault();
|
|
183
186
|
openThread(item);
|
|
184
187
|
}
|
|
185
188
|
};
|
|
186
|
-
// What it is on the left, what you can do about it on the right.
|
|
187
|
-
const about = el("div", { className: "homeabout" }, [
|
|
188
|
-
el("div", { className: "homehead" }, [
|
|
189
|
-
el("span", { className: "chip " + (KIND_TONE[kind] ?? ""), textContent: KIND_LABEL[kind] }),
|
|
190
|
-
openLink(item),
|
|
191
|
-
]),
|
|
192
|
-
el("div", { className: "meta", textContent: whereOf(e) + " · " + ago(item.createdAt) }),
|
|
193
|
-
]);
|
|
194
|
-
card.append(about);
|
|
195
189
|
|
|
190
|
+
/* What kind of thing it is sits in the line under the title, so every title starts in the
|
|
191
|
+
same place; a chip in front of it pushed each one along by its own width. */
|
|
192
|
+
const meta = el("div", { className: "meta" }, [
|
|
193
|
+
el("span", { className: "homekind " + (KIND_TONE[kind] ?? ""), textContent: KIND_LABEL[kind] }),
|
|
194
|
+
document.createTextNode(" · " + whereOf(e) + " · " + ago(item.createdAt)),
|
|
195
|
+
]);
|
|
196
|
+
const about = el("div", { className: "homeabout" }, [openLink(item), meta]);
|
|
196
197
|
if (kind === "decision" && item.due) about.append(dueLine(item.due));
|
|
197
198
|
if (kind === "merge") about.append(checksLine(item));
|
|
198
199
|
|
|
199
200
|
// The note comes first so that what happened sits just left of the button that did it.
|
|
200
201
|
const note = el("span", { className: "meta" });
|
|
201
202
|
const actions = el("div", { className: "row homeacts" }, [note]);
|
|
203
|
+
row.append(el("span", { className: "homedot", ariaHidden: "true" }), about, actions);
|
|
202
204
|
|
|
203
205
|
if (kind === "decision" || kind === "ask") {
|
|
204
|
-
actions.append(button("Reply",
|
|
205
|
-
if (item.due)
|
|
206
|
+
actions.append(button("Reply", first, () => openThread(item)));
|
|
207
|
+
if (item.due) {
|
|
208
|
+
actions.append(button("Go with the default", false, () => say(e, "Go with your default.", note, actions)));
|
|
209
|
+
}
|
|
206
210
|
} else if (kind === "review") {
|
|
207
|
-
actions.append(button("Approve",
|
|
211
|
+
actions.append(button("Approve", first, () => say(e, "Approved.", note, actions)));
|
|
208
212
|
} else if (kind === "chore") {
|
|
209
|
-
actions.append(button("Done",
|
|
213
|
+
actions.append(button("Done", first, () => done(e, note, actions)));
|
|
210
214
|
} else if (kind === "merge") {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
if (
|
|
218
|
-
|
|
215
|
+
/* Merge is offered only when pressing it can work. A conflict, failing checks or checks
|
|
216
|
+
still running are in the line under the title instead; a grey button that cannot be
|
|
217
|
+
pressed looked like one that could. */
|
|
218
|
+
const blocked =
|
|
219
|
+
item.checks === "failing" || item.checks === "pending" || item.mergeable === "CONFLICTING";
|
|
220
|
+
const merge = () => button("Merge", first, () => merge_(e, note, actions));
|
|
221
|
+
if (item.reviewDecision === "REVIEW_REQUIRED") {
|
|
222
|
+
// Approve is the person's review, given on purpose; Merge waits for it.
|
|
223
|
+
const approve = button("Approve", first, async () => {
|
|
219
224
|
approve.disabled = true;
|
|
220
225
|
note.className = "meta";
|
|
221
226
|
note.textContent = "Approving…";
|
|
@@ -224,8 +229,7 @@ function needCard(e) {
|
|
|
224
229
|
item.reviewDecision = "APPROVED";
|
|
225
230
|
note.textContent = "Approved.";
|
|
226
231
|
approve.remove();
|
|
227
|
-
|
|
228
|
-
merge.disabled = blocked || item.checks === "pending";
|
|
232
|
+
if (!blocked) actions.append(merge());
|
|
229
233
|
} catch (err) {
|
|
230
234
|
note.textContent = String(err.message || err);
|
|
231
235
|
note.className = "meta err";
|
|
@@ -233,11 +237,9 @@ function needCard(e) {
|
|
|
233
237
|
}
|
|
234
238
|
});
|
|
235
239
|
actions.append(approve);
|
|
236
|
-
}
|
|
237
|
-
actions.append(merge);
|
|
240
|
+
} else if (!blocked) actions.append(merge());
|
|
238
241
|
}
|
|
239
|
-
|
|
240
|
-
return card;
|
|
242
|
+
return row;
|
|
241
243
|
}
|
|
242
244
|
|
|
243
245
|
function dueLine(due) {
|
|
@@ -250,20 +252,20 @@ function dueLine(due) {
|
|
|
250
252
|
});
|
|
251
253
|
}
|
|
252
254
|
|
|
255
|
+
/** Where a pull request stands, with only the parts that stop a merge in amber. */
|
|
253
256
|
function checksLine(item) {
|
|
254
|
-
const
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
(
|
|
263
|
-
|
|
264
|
-
className: "homedue" + (item.checks === "failing" || conflict ? " late" : ""),
|
|
265
|
-
textContent: (words[item.checks] ?? "") + conflict,
|
|
257
|
+
const parts = [];
|
|
258
|
+
if (item.checks === "passing") parts.push(["Checks pass", false]);
|
|
259
|
+
if (item.checks === "failing") parts.push(["Checks fail", true]);
|
|
260
|
+
if (item.checks === "pending") parts.push(["Checks are running", false]);
|
|
261
|
+
if (item.mergeable === "CONFLICTING") parts.push(["Conflicts with its base", true]);
|
|
262
|
+
if (item.reviewDecision === "REVIEW_REQUIRED") parts.push(["Needs your approval", false]);
|
|
263
|
+
const line = el("p", { className: "homedue" });
|
|
264
|
+
parts.forEach(([text, bad], i) => {
|
|
265
|
+
if (i) line.append(document.createTextNode(" · "));
|
|
266
|
+
line.append(el("span", { className: bad ? "bad" : "", textContent: text }));
|
|
266
267
|
});
|
|
268
|
+
return line;
|
|
267
269
|
}
|
|
268
270
|
|
|
269
271
|
async function say(e, text, note, actions) {
|
|
@@ -289,7 +291,7 @@ async function act(note, actions, payload, ok) {
|
|
|
289
291
|
await post(payload);
|
|
290
292
|
note.textContent = ok;
|
|
291
293
|
// Done is done: the card goes now, rather than when GitHub next answers.
|
|
292
|
-
const card = actions.closest?.(".
|
|
294
|
+
const card = actions.closest?.(".homeneed, .homeline");
|
|
293
295
|
if (card) {
|
|
294
296
|
card.classList.add("gone");
|
|
295
297
|
setTimeout(() => card.remove(), 220);
|
|
@@ -437,10 +439,14 @@ function listRow(e, { chip, tone = "", sub, action = null }) {
|
|
|
437
439
|
"div",
|
|
438
440
|
{ className: "homeline homeclick" + (e.item.unread ? " unread" : ""), tabIndex: 0, role: "button" },
|
|
439
441
|
[
|
|
440
|
-
|
|
442
|
+
// The same row as Needs you: an unread dot, the title, and what it is in the line under it.
|
|
443
|
+
el("span", { className: "homedot", ariaHidden: "true" }),
|
|
441
444
|
el("div", { className: "homerunwhat" }, [
|
|
442
445
|
el("div", { className: "homerowtitle", textContent: e.item.title }),
|
|
443
|
-
el("div", { className: "homerunsub"
|
|
446
|
+
el("div", { className: "homerunsub" }, [
|
|
447
|
+
el("span", { className: "homekind " + tone, textContent: chip }),
|
|
448
|
+
document.createTextNode(` · ${whereOf(e)} · ${sub}`),
|
|
449
|
+
]),
|
|
444
450
|
]),
|
|
445
451
|
el("div", { className: "homerunlog" }, action ? [action] : []),
|
|
446
452
|
],
|
package/dist/worker/index.js
CHANGED
|
@@ -2994,12 +2994,14 @@ function isTextPath(path, size2) {
|
|
|
2994
2994
|
return size2 <= MAX_TEXT && !BINARY.test(path);
|
|
2995
2995
|
}
|
|
2996
2996
|
var Snapshots = class {
|
|
2997
|
-
constructor(kv, freshMs = 4e3) {
|
|
2997
|
+
constructor(kv, freshMs = 4e3, shareInflight = true) {
|
|
2998
2998
|
this.kv = kv;
|
|
2999
2999
|
this.freshMs = freshMs;
|
|
3000
|
+
this.shareInflight = shareInflight;
|
|
3000
3001
|
}
|
|
3001
3002
|
kv;
|
|
3002
3003
|
freshMs;
|
|
3004
|
+
shareInflight;
|
|
3003
3005
|
repos = /* @__PURE__ */ new Map();
|
|
3004
3006
|
inflight = /* @__PURE__ */ new Map();
|
|
3005
3007
|
checked = /* @__PURE__ */ new Map();
|
|
@@ -3019,13 +3021,20 @@ var Snapshots = class {
|
|
|
3019
3021
|
if (!opts.force && this.repos.has(repo) && Date.now() - last < this.freshMs) {
|
|
3020
3022
|
return Promise.resolve({ ok: true, changed: false });
|
|
3021
3023
|
}
|
|
3024
|
+
const pathsOnly = opts.pathsOnly === true;
|
|
3025
|
+
if (!this.shareInflight) {
|
|
3026
|
+
return this.load(gh, repo, pathsOnly, (step) => opts.report?.(repo, step));
|
|
3027
|
+
}
|
|
3022
3028
|
if (opts.report) {
|
|
3023
3029
|
if (!this.listeners.has(repo)) this.listeners.set(repo, /* @__PURE__ */ new Set());
|
|
3024
3030
|
this.listeners.get(repo).add(opts.report);
|
|
3025
3031
|
}
|
|
3026
3032
|
const running = this.inflight.get(repo);
|
|
3027
3033
|
if (running) return running;
|
|
3028
|
-
const
|
|
3034
|
+
const say = (step) => {
|
|
3035
|
+
for (const report of this.listeners.get(repo) ?? []) report(repo, step);
|
|
3036
|
+
};
|
|
3037
|
+
const work = this.load(gh, repo, pathsOnly, say).finally(() => {
|
|
3029
3038
|
this.inflight.delete(repo);
|
|
3030
3039
|
this.listeners.delete(repo);
|
|
3031
3040
|
});
|
|
@@ -3049,11 +3058,8 @@ var Snapshots = class {
|
|
|
3049
3058
|
if (commit2) snap.sha = commit2;
|
|
3050
3059
|
void this.kv.put(`blob:${sha}`, text2);
|
|
3051
3060
|
}
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
}
|
|
3055
|
-
async load(gh, repo, pathsOnly) {
|
|
3056
|
-
this.say(repo, "checking for changes");
|
|
3061
|
+
async load(gh, repo, pathsOnly, say) {
|
|
3062
|
+
say("checking for changes");
|
|
3057
3063
|
const head2 = await gh.request("GET", `repos/${repo}/commits/HEAD`, {
|
|
3058
3064
|
accept: "application/vnd.github.sha",
|
|
3059
3065
|
as: "text"
|
|
@@ -3065,16 +3071,16 @@ var Snapshots = class {
|
|
|
3065
3071
|
const sha = head2.data.trim();
|
|
3066
3072
|
const before = this.repos.get(repo);
|
|
3067
3073
|
if (before && before.sha === sha && before.pathsOnly === pathsOnly) {
|
|
3068
|
-
|
|
3074
|
+
say("up to date");
|
|
3069
3075
|
return { ok: true, changed: false };
|
|
3070
3076
|
}
|
|
3071
|
-
|
|
3072
|
-
const next = await this.build(gh, repo, sha, pathsOnly, before);
|
|
3077
|
+
say("reading the file list");
|
|
3078
|
+
const next = await this.build(gh, repo, sha, pathsOnly, say, before);
|
|
3073
3079
|
if (!next.ok) return { ok: false, changed: false, error: next.error, status: next.status };
|
|
3074
3080
|
this.repos.set(repo, next.snap);
|
|
3075
3081
|
return { ok: true, changed: true };
|
|
3076
3082
|
}
|
|
3077
|
-
async build(gh, repo, sha, pathsOnly, before) {
|
|
3083
|
+
async build(gh, repo, sha, pathsOnly, say, before) {
|
|
3078
3084
|
const [tree, commit2] = await Promise.all([
|
|
3079
3085
|
gh.request(
|
|
3080
3086
|
"GET",
|
|
@@ -3117,7 +3123,7 @@ var Snapshots = class {
|
|
|
3117
3123
|
})
|
|
3118
3124
|
);
|
|
3119
3125
|
if (missing2.length > TARBALL_OVER) {
|
|
3120
|
-
|
|
3126
|
+
say("downloading the repository");
|
|
3121
3127
|
const tgz = await gh.request("GET", `repos/${repo}/tarball/${sha}`, {
|
|
3122
3128
|
as: "bytes"
|
|
3123
3129
|
});
|
|
@@ -3133,7 +3139,7 @@ var Snapshots = class {
|
|
|
3133
3139
|
}
|
|
3134
3140
|
} else {
|
|
3135
3141
|
if (missing2.length) {
|
|
3136
|
-
|
|
3142
|
+
say(`fetching ${missing2.length} changed file${missing2.length === 1 ? "" : "s"}`);
|
|
3137
3143
|
}
|
|
3138
3144
|
await pool2(missing2, 8, async ([, e]) => {
|
|
3139
3145
|
const res = await gh.request("GET", `repos/${repo}/git/blobs/${e.sha}`, {
|
|
@@ -3147,7 +3153,7 @@ var Snapshots = class {
|
|
|
3147
3153
|
void this.kv.put(`blob:${e.sha}`, text2);
|
|
3148
3154
|
});
|
|
3149
3155
|
}
|
|
3150
|
-
await this.dates(gh, repo, snap, before);
|
|
3156
|
+
await this.dates(gh, repo, snap, say, before);
|
|
3151
3157
|
return { ok: true, snap };
|
|
3152
3158
|
}
|
|
3153
3159
|
/**
|
|
@@ -3157,7 +3163,7 @@ var Snapshots = class {
|
|
|
3157
3163
|
* GitHub, in batches, only for the ones that are new or changed. Kept by commit, so a warm
|
|
3158
3164
|
* start never asks at all.
|
|
3159
3165
|
*/
|
|
3160
|
-
async dates(gh, repo, snap, before) {
|
|
3166
|
+
async dates(gh, repo, snap, say, before) {
|
|
3161
3167
|
const key = `dates:${repo}@${snap.sha}`;
|
|
3162
3168
|
const kept = await this.kv.get(key);
|
|
3163
3169
|
if (kept) {
|
|
@@ -3172,7 +3178,7 @@ var Snapshots = class {
|
|
|
3172
3178
|
else ask.push(path);
|
|
3173
3179
|
}
|
|
3174
3180
|
const [owner, name] = repo.split("/");
|
|
3175
|
-
if (ask.length)
|
|
3181
|
+
if (ask.length) say("reading file dates");
|
|
3176
3182
|
for (let i = 0; i < ask.length; i += DATES_PER_QUERY) {
|
|
3177
3183
|
const batch = ask.slice(i, i + DATES_PER_QUERY);
|
|
3178
3184
|
const fields = batch.map(
|
|
@@ -3258,7 +3264,7 @@ var TTL = 45e3;
|
|
|
3258
3264
|
var LABEL_TTL = 3e5;
|
|
3259
3265
|
function createPortal(opts) {
|
|
3260
3266
|
const root2 = opts.root ?? `/@roster/${opts.org}`;
|
|
3261
|
-
const snapshots = new Snapshots(opts.kv);
|
|
3267
|
+
const snapshots = new Snapshots(opts.kv, void 0, opts.shareInflight ?? true);
|
|
3262
3268
|
mount(
|
|
3263
3269
|
root2,
|
|
3264
3270
|
snapshots.tree((repo) => repo.slice(repo.indexOf("/") + 1))
|
|
@@ -4398,7 +4404,13 @@ function boot(env) {
|
|
|
4398
4404
|
useFrameworkRoot(FRAMEWORK);
|
|
4399
4405
|
const kv = cloudflareKV(env.CACHE);
|
|
4400
4406
|
useRecordStore(recordStore(kv));
|
|
4401
|
-
portal = createPortal({
|
|
4407
|
+
portal = createPortal({
|
|
4408
|
+
org: env.ROSTER_ORG,
|
|
4409
|
+
opsName: env.ROSTER_OPS_REPO ?? "roster-ops",
|
|
4410
|
+
kv,
|
|
4411
|
+
// A Worker request that awaits a fetch another request started never finishes.
|
|
4412
|
+
shareInflight: false
|
|
4413
|
+
});
|
|
4402
4414
|
return portal;
|
|
4403
4415
|
}
|
|
4404
4416
|
function clientFor(token) {
|
package/package.json
CHANGED
|
@@ -20,24 +20,33 @@
|
|
|
20
20
|
.homewho{font:500 12.5px var(--sans);color:var(--ink);background:var(--surface-2);border:0;
|
|
21
21
|
border-radius:8px;padding:5px 8px}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
/* Needs you: one list, a row per thing. A dot column for unread, the thing itself, and its
|
|
24
|
+
action; titles all start in the same place, and buttons are small enough not to shout. */
|
|
25
|
+
.homelist{padding:0 16px}
|
|
26
|
+
.homeneed{display:grid;grid-template-columns:8px minmax(0,1fr) auto;align-items:center;
|
|
27
|
+
gap:4px 14px;padding:14px 0;cursor:pointer}
|
|
28
|
+
.homeneed + .homeneed{border-top:1px solid var(--line)}
|
|
29
|
+
.homeneed:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:6px}
|
|
30
|
+
.homeneed:hover .homeopen{text-decoration:underline}
|
|
31
|
+
.homedot{align-self:start;width:7px;height:7px;margin-top:7px;border-radius:50%}
|
|
32
|
+
.homeneed.unread .homedot{background:var(--blue)}
|
|
25
33
|
.homeabout{min-width:0}
|
|
26
|
-
.
|
|
27
|
-
.homecard:focus-visible{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
|
|
28
|
-
.homehead{display:flex;align-items:baseline;gap:8px}
|
|
29
|
-
.homehead .chip{flex:none}
|
|
30
|
-
.homeopen{all:unset;cursor:pointer;font:600 14px/1.35 var(--sans);color:var(--ink);letter-spacing:-.01em}
|
|
31
|
-
.homeopen:hover{text-decoration:underline}
|
|
34
|
+
.homeopen{all:unset;cursor:pointer;font:600 14px/1.4 var(--sans);color:var(--ink);letter-spacing:-.01em}
|
|
32
35
|
.homeopen:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:4px}
|
|
33
|
-
.homeabout > .meta{margin-top:
|
|
34
|
-
.
|
|
35
|
-
.
|
|
36
|
-
.
|
|
36
|
+
.homeabout > .meta{margin-top:3px}
|
|
37
|
+
.homekind{font-weight:600;color:var(--ink-dim)}
|
|
38
|
+
.homekind.hot{color:var(--err)}
|
|
39
|
+
.homekind.warm{color:var(--warn)}
|
|
40
|
+
.homekind.cool{color:var(--ruled)}
|
|
41
|
+
.homekind.ok{color:var(--accent)}
|
|
42
|
+
.homedue{margin:5px 0 0;font-size:12.5px;color:var(--ink-dim)}
|
|
43
|
+
.homedue.late,.homedue .bad{color:var(--warn)}
|
|
44
|
+
.homeacts{justify-content:flex-end;flex-wrap:nowrap;gap:8px}
|
|
45
|
+
.homeacts .ghbtn{min-height:28px;padding:3px 12px;font-size:12.5px}
|
|
37
46
|
.homeacts .meta{white-space:normal;text-align:right;max-width:220px}
|
|
38
47
|
@media (max-width:640px){
|
|
39
|
-
.
|
|
40
|
-
.homeacts{justify-content:flex-start;flex-wrap:wrap}
|
|
48
|
+
.homeneed{grid-template-columns:8px minmax(0,1fr)}
|
|
49
|
+
.homeacts{grid-column:2;justify-content:flex-start;flex-wrap:wrap}
|
|
41
50
|
.homeacts .meta{text-align:left}
|
|
42
51
|
}
|
|
43
52
|
|
|
@@ -63,17 +72,14 @@
|
|
|
63
72
|
}
|
|
64
73
|
|
|
65
74
|
.homerest{margin-top:26px}
|
|
66
|
-
.
|
|
75
|
+
.homeneed.gone,.homeline.gone{opacity:0;transform:translateX(12px);
|
|
67
76
|
transition:opacity .2s var(--ease),transform .2s var(--ease)}
|
|
68
77
|
|
|
69
|
-
/* Activity you have not seen: a blue dot and a bold title
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
GitHub. */
|
|
73
|
-
.homecard.unread{box-shadow:inset 3px 0 0 var(--blue)}
|
|
78
|
+
/* Activity you have not seen: a blue dot and a bold title. In Needs you the dot has a column of
|
|
79
|
+
its own; in the other lists it sits before the title. Opening the thread marks it read, here
|
|
80
|
+
and on GitHub. */
|
|
74
81
|
.unread .homeopen,.unread .homerowtitle{font-weight:700}
|
|
75
|
-
|
|
76
|
-
background:var(--blue);margin:0 7px 1px 0;vertical-align:middle}
|
|
82
|
+
|
|
77
83
|
|
|
78
84
|
.homereports{display:flex;flex-direction:column;gap:14px;padding:14px 16px}
|
|
79
85
|
.homereport{display:grid;grid-template-columns:190px 1fr;gap:12px;font-size:13px;line-height:1.5;
|
|
@@ -87,15 +93,12 @@
|
|
|
87
93
|
.homereportbody a{color:var(--accent)}
|
|
88
94
|
@media (max-width:640px){.homereport{grid-template-columns:1fr;gap:4px}}
|
|
89
95
|
|
|
90
|
-
@media (max-width:640px){
|
|
91
|
-
.homehead{flex-wrap:wrap}
|
|
92
|
-
}
|
|
93
96
|
|
|
94
97
|
/* Rows in a list card (Unread, Your requests, Closed today) that open a thread. */
|
|
95
|
-
.homeline{display:grid;grid-template-columns:
|
|
98
|
+
.homeline{display:grid;grid-template-columns:8px minmax(0,1fr) auto;align-items:center;gap:4px 14px;
|
|
96
99
|
padding:12px 0;font-size:13.5px;cursor:pointer}
|
|
100
|
+
.homeline.unread .homedot{background:var(--blue)}
|
|
97
101
|
.homeline + .homeline{border-top:1px solid var(--line)}
|
|
98
|
-
.homeline .homestate{min-width:64px;justify-content:center}
|
|
99
102
|
.homeline:hover .homerowtitle{text-decoration:underline}
|
|
100
103
|
.homeline:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:6px}
|
|
101
104
|
.homerowtitle{font-weight:600;color:var(--ink)}
|
|
@@ -87,8 +87,11 @@ export function viewHome(m) {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
page.append(section("Needs you", h.needs.length));
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
/* One list rather than a card each: five boxes with a green button apiece read as a wall, and
|
|
91
|
+
nothing in it said which to do first. The top row's action is the one in green. */
|
|
92
|
+
if (h.needs.length) {
|
|
93
|
+
page.append(el("div", { className: "card homelist" }, h.needs.map((e, i) => needRow(e, i === 0))));
|
|
94
|
+
} else page.append(el("p", { className: "homeempty", textContent: "Nothing needs you." }));
|
|
92
95
|
|
|
93
96
|
if (h.unread.length) {
|
|
94
97
|
page.append(section("Unread", h.unread.length));
|
|
@@ -165,57 +168,59 @@ function titleOf(said) {
|
|
|
165
168
|
|
|
166
169
|
/* ------------------------------ needs you ------------------------------- */
|
|
167
170
|
|
|
168
|
-
function
|
|
171
|
+
function needRow(e, first) {
|
|
169
172
|
const { item, kind } = e;
|
|
170
|
-
/* The whole
|
|
173
|
+
/* The whole row opens the thread; the one quick action on it does not. Answering in words
|
|
171
174
|
happens in the thread, where what was asked is in front of you. */
|
|
172
|
-
const
|
|
173
|
-
className: "
|
|
175
|
+
const row = el("div", {
|
|
176
|
+
className: "homeneed" + (item.unread ? " unread" : ""),
|
|
174
177
|
tabIndex: 0,
|
|
175
178
|
role: "button",
|
|
176
179
|
});
|
|
177
|
-
|
|
180
|
+
row.onclick = (ev) => {
|
|
178
181
|
if (!ev.target.closest("button, a, textarea")) openThread(item);
|
|
179
182
|
};
|
|
180
|
-
|
|
181
|
-
if (ev.target ===
|
|
183
|
+
row.onkeydown = (ev) => {
|
|
184
|
+
if (ev.target === row && (ev.key === "Enter" || ev.key === " ")) {
|
|
182
185
|
ev.preventDefault();
|
|
183
186
|
openThread(item);
|
|
184
187
|
}
|
|
185
188
|
};
|
|
186
|
-
// What it is on the left, what you can do about it on the right.
|
|
187
|
-
const about = el("div", { className: "homeabout" }, [
|
|
188
|
-
el("div", { className: "homehead" }, [
|
|
189
|
-
el("span", { className: "chip " + (KIND_TONE[kind] ?? ""), textContent: KIND_LABEL[kind] }),
|
|
190
|
-
openLink(item),
|
|
191
|
-
]),
|
|
192
|
-
el("div", { className: "meta", textContent: whereOf(e) + " · " + ago(item.createdAt) }),
|
|
193
|
-
]);
|
|
194
|
-
card.append(about);
|
|
195
189
|
|
|
190
|
+
/* What kind of thing it is sits in the line under the title, so every title starts in the
|
|
191
|
+
same place; a chip in front of it pushed each one along by its own width. */
|
|
192
|
+
const meta = el("div", { className: "meta" }, [
|
|
193
|
+
el("span", { className: "homekind " + (KIND_TONE[kind] ?? ""), textContent: KIND_LABEL[kind] }),
|
|
194
|
+
document.createTextNode(" · " + whereOf(e) + " · " + ago(item.createdAt)),
|
|
195
|
+
]);
|
|
196
|
+
const about = el("div", { className: "homeabout" }, [openLink(item), meta]);
|
|
196
197
|
if (kind === "decision" && item.due) about.append(dueLine(item.due));
|
|
197
198
|
if (kind === "merge") about.append(checksLine(item));
|
|
198
199
|
|
|
199
200
|
// The note comes first so that what happened sits just left of the button that did it.
|
|
200
201
|
const note = el("span", { className: "meta" });
|
|
201
202
|
const actions = el("div", { className: "row homeacts" }, [note]);
|
|
203
|
+
row.append(el("span", { className: "homedot", ariaHidden: "true" }), about, actions);
|
|
202
204
|
|
|
203
205
|
if (kind === "decision" || kind === "ask") {
|
|
204
|
-
actions.append(button("Reply",
|
|
205
|
-
if (item.due)
|
|
206
|
+
actions.append(button("Reply", first, () => openThread(item)));
|
|
207
|
+
if (item.due) {
|
|
208
|
+
actions.append(button("Go with the default", false, () => say(e, "Go with your default.", note, actions)));
|
|
209
|
+
}
|
|
206
210
|
} else if (kind === "review") {
|
|
207
|
-
actions.append(button("Approve",
|
|
211
|
+
actions.append(button("Approve", first, () => say(e, "Approved.", note, actions)));
|
|
208
212
|
} else if (kind === "chore") {
|
|
209
|
-
actions.append(button("Done",
|
|
213
|
+
actions.append(button("Done", first, () => done(e, note, actions)));
|
|
210
214
|
} else if (kind === "merge") {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
if (
|
|
218
|
-
|
|
215
|
+
/* Merge is offered only when pressing it can work. A conflict, failing checks or checks
|
|
216
|
+
still running are in the line under the title instead; a grey button that cannot be
|
|
217
|
+
pressed looked like one that could. */
|
|
218
|
+
const blocked =
|
|
219
|
+
item.checks === "failing" || item.checks === "pending" || item.mergeable === "CONFLICTING";
|
|
220
|
+
const merge = () => button("Merge", first, () => merge_(e, note, actions));
|
|
221
|
+
if (item.reviewDecision === "REVIEW_REQUIRED") {
|
|
222
|
+
// Approve is the person's review, given on purpose; Merge waits for it.
|
|
223
|
+
const approve = button("Approve", first, async () => {
|
|
219
224
|
approve.disabled = true;
|
|
220
225
|
note.className = "meta";
|
|
221
226
|
note.textContent = "Approving…";
|
|
@@ -224,8 +229,7 @@ function needCard(e) {
|
|
|
224
229
|
item.reviewDecision = "APPROVED";
|
|
225
230
|
note.textContent = "Approved.";
|
|
226
231
|
approve.remove();
|
|
227
|
-
|
|
228
|
-
merge.disabled = blocked || item.checks === "pending";
|
|
232
|
+
if (!blocked) actions.append(merge());
|
|
229
233
|
} catch (err) {
|
|
230
234
|
note.textContent = String(err.message || err);
|
|
231
235
|
note.className = "meta err";
|
|
@@ -233,11 +237,9 @@ function needCard(e) {
|
|
|
233
237
|
}
|
|
234
238
|
});
|
|
235
239
|
actions.append(approve);
|
|
236
|
-
}
|
|
237
|
-
actions.append(merge);
|
|
240
|
+
} else if (!blocked) actions.append(merge());
|
|
238
241
|
}
|
|
239
|
-
|
|
240
|
-
return card;
|
|
242
|
+
return row;
|
|
241
243
|
}
|
|
242
244
|
|
|
243
245
|
function dueLine(due) {
|
|
@@ -250,20 +252,20 @@ function dueLine(due) {
|
|
|
250
252
|
});
|
|
251
253
|
}
|
|
252
254
|
|
|
255
|
+
/** Where a pull request stands, with only the parts that stop a merge in amber. */
|
|
253
256
|
function checksLine(item) {
|
|
254
|
-
const
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
(
|
|
263
|
-
|
|
264
|
-
className: "homedue" + (item.checks === "failing" || conflict ? " late" : ""),
|
|
265
|
-
textContent: (words[item.checks] ?? "") + conflict,
|
|
257
|
+
const parts = [];
|
|
258
|
+
if (item.checks === "passing") parts.push(["Checks pass", false]);
|
|
259
|
+
if (item.checks === "failing") parts.push(["Checks fail", true]);
|
|
260
|
+
if (item.checks === "pending") parts.push(["Checks are running", false]);
|
|
261
|
+
if (item.mergeable === "CONFLICTING") parts.push(["Conflicts with its base", true]);
|
|
262
|
+
if (item.reviewDecision === "REVIEW_REQUIRED") parts.push(["Needs your approval", false]);
|
|
263
|
+
const line = el("p", { className: "homedue" });
|
|
264
|
+
parts.forEach(([text, bad], i) => {
|
|
265
|
+
if (i) line.append(document.createTextNode(" · "));
|
|
266
|
+
line.append(el("span", { className: bad ? "bad" : "", textContent: text }));
|
|
266
267
|
});
|
|
268
|
+
return line;
|
|
267
269
|
}
|
|
268
270
|
|
|
269
271
|
async function say(e, text, note, actions) {
|
|
@@ -289,7 +291,7 @@ async function act(note, actions, payload, ok) {
|
|
|
289
291
|
await post(payload);
|
|
290
292
|
note.textContent = ok;
|
|
291
293
|
// Done is done: the card goes now, rather than when GitHub next answers.
|
|
292
|
-
const card = actions.closest?.(".
|
|
294
|
+
const card = actions.closest?.(".homeneed, .homeline");
|
|
293
295
|
if (card) {
|
|
294
296
|
card.classList.add("gone");
|
|
295
297
|
setTimeout(() => card.remove(), 220);
|
|
@@ -437,10 +439,14 @@ function listRow(e, { chip, tone = "", sub, action = null }) {
|
|
|
437
439
|
"div",
|
|
438
440
|
{ className: "homeline homeclick" + (e.item.unread ? " unread" : ""), tabIndex: 0, role: "button" },
|
|
439
441
|
[
|
|
440
|
-
|
|
442
|
+
// The same row as Needs you: an unread dot, the title, and what it is in the line under it.
|
|
443
|
+
el("span", { className: "homedot", ariaHidden: "true" }),
|
|
441
444
|
el("div", { className: "homerunwhat" }, [
|
|
442
445
|
el("div", { className: "homerowtitle", textContent: e.item.title }),
|
|
443
|
-
el("div", { className: "homerunsub"
|
|
446
|
+
el("div", { className: "homerunsub" }, [
|
|
447
|
+
el("span", { className: "homekind " + tone, textContent: chip }),
|
|
448
|
+
document.createTextNode(` · ${whereOf(e)} · ${sub}`),
|
|
449
|
+
]),
|
|
444
450
|
]),
|
|
445
451
|
el("div", { className: "homerunlog" }, action ? [action] : []),
|
|
446
452
|
],
|