@nanocollective/roster 0.1.0-beta.4 → 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.
@@ -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
- .homecard{padding:14px 16px;cursor:pointer;display:grid;grid-template-columns:1fr auto;
24
- align-items:center;gap:10px 18px}
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
- .homecard:hover{border-color:var(--border-strong)}
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:4px}
34
- .homedue{margin:8px 0 0;font-size:12.5px;color:var(--ink-dim)}
35
- .homedue.late{color:var(--warn)}
36
- .homeacts{justify-content:flex-end;flex-wrap:nowrap}
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
- .homecard{grid-template-columns:1fr}
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
- .homecard.gone,.homeline.gone{opacity:0;transform:translateX(12px);
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, and on a card in Needs you a blue
70
- edge that follows its corners. A row inside a list card carries no edge, since a bar drawn to
71
- the card's side squares off its rounded corners. Opening the thread marks it read, here and on
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
- .unread .homeopen::before,.unread .homerowtitle::before{content:"";display:inline-block;width:7px;height:7px;border-radius:50%;
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:auto 1fr auto;align-items:center;gap:12px;
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
- if (h.needs.length) for (const e of h.needs) page.append(needCard(e));
91
- else page.append(el("p", { className: "homeempty", textContent: "Nothing needs you." }));
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 needCard(e) {
171
+ function needRow(e, first) {
169
172
  const { item, kind } = e;
170
- /* The whole card opens the thread; the one quick action on it does not. Answering in words
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 card = el("div", {
173
- className: "card homecard" + (item.unread ? " unread" : ""),
175
+ const row = el("div", {
176
+ className: "homeneed" + (item.unread ? " unread" : ""),
174
177
  tabIndex: 0,
175
178
  role: "button",
176
179
  });
177
- card.onclick = (ev) => {
180
+ row.onclick = (ev) => {
178
181
  if (!ev.target.closest("button, a, textarea")) openThread(item);
179
182
  };
180
- card.onkeydown = (ev) => {
181
- if (ev.target === card && (ev.key === "Enter" || ev.key === " ")) {
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", true, () => openThread(item)));
205
- if (item.due) actions.append(button("Go with the default", false, () => say(e, "Go with your default.", note, actions)));
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", true, () => say(e, "Approved.", note, actions)));
211
+ actions.append(button("Approve", first, () => say(e, "Approved.", note, actions)));
208
212
  } else if (kind === "chore") {
209
- actions.append(button("Done", true, () => done(e, note, actions)));
213
+ actions.append(button("Done", first, () => done(e, note, actions)));
210
214
  } else if (kind === "merge") {
211
- const blocked = item.checks === "failing" || item.mergeable === "CONFLICTING";
212
- const needsReview = item.reviewDecision === "REVIEW_REQUIRED";
213
- const merge = button("Merge", !needsReview, () => merge_(e, note, actions));
214
- merge.disabled = blocked || item.checks === "pending" || needsReview;
215
- /* The branch rules want an approving review. Approve is the person's review, given on
216
- purpose; Merge waits for it rather than approving on their behalf. */
217
- if (needsReview) {
218
- const approve = button("Approve", true, async () => {
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
- merge.className = "ghbtn primary";
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
- card.append(actions);
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 words = {
255
- passing: "Checks pass.",
256
- failing: "Checks fail.",
257
- pending: "Checks are running.",
258
- none: "No checks.",
259
- };
260
- const conflict =
261
- (item.mergeable === "CONFLICTING" ? " Conflicts with its base." : "") +
262
- (item.reviewDecision === "REVIEW_REQUIRED" ? " Needs your approval to merge." : "");
263
- return el("p", {
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?.(".homecard, .homeline");
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
- el("span", { className: "chip homestate " + tone, textContent: chip }),
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", textContent: `${whereOf(e)} · ${sub}` }),
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nanocollective/roster",
3
- "version": "0.1.0-beta.4",
3
+ "version": "0.1.0-beta.5",
4
4
  "description": "An agent-run org, powered by GitHub. Scaffold AI staff members whose brain is a repo.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -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
- .homecard{padding:14px 16px;cursor:pointer;display:grid;grid-template-columns:1fr auto;
24
- align-items:center;gap:10px 18px}
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
- .homecard:hover{border-color:var(--border-strong)}
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:4px}
34
- .homedue{margin:8px 0 0;font-size:12.5px;color:var(--ink-dim)}
35
- .homedue.late{color:var(--warn)}
36
- .homeacts{justify-content:flex-end;flex-wrap:nowrap}
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
- .homecard{grid-template-columns:1fr}
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
- .homecard.gone,.homeline.gone{opacity:0;transform:translateX(12px);
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, and on a card in Needs you a blue
70
- edge that follows its corners. A row inside a list card carries no edge, since a bar drawn to
71
- the card's side squares off its rounded corners. Opening the thread marks it read, here and on
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
- .unread .homeopen::before,.unread .homerowtitle::before{content:"";display:inline-block;width:7px;height:7px;border-radius:50%;
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:auto 1fr auto;align-items:center;gap:12px;
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
- if (h.needs.length) for (const e of h.needs) page.append(needCard(e));
91
- else page.append(el("p", { className: "homeempty", textContent: "Nothing needs you." }));
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 needCard(e) {
171
+ function needRow(e, first) {
169
172
  const { item, kind } = e;
170
- /* The whole card opens the thread; the one quick action on it does not. Answering in words
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 card = el("div", {
173
- className: "card homecard" + (item.unread ? " unread" : ""),
175
+ const row = el("div", {
176
+ className: "homeneed" + (item.unread ? " unread" : ""),
174
177
  tabIndex: 0,
175
178
  role: "button",
176
179
  });
177
- card.onclick = (ev) => {
180
+ row.onclick = (ev) => {
178
181
  if (!ev.target.closest("button, a, textarea")) openThread(item);
179
182
  };
180
- card.onkeydown = (ev) => {
181
- if (ev.target === card && (ev.key === "Enter" || ev.key === " ")) {
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", true, () => openThread(item)));
205
- if (item.due) actions.append(button("Go with the default", false, () => say(e, "Go with your default.", note, actions)));
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", true, () => say(e, "Approved.", note, actions)));
211
+ actions.append(button("Approve", first, () => say(e, "Approved.", note, actions)));
208
212
  } else if (kind === "chore") {
209
- actions.append(button("Done", true, () => done(e, note, actions)));
213
+ actions.append(button("Done", first, () => done(e, note, actions)));
210
214
  } else if (kind === "merge") {
211
- const blocked = item.checks === "failing" || item.mergeable === "CONFLICTING";
212
- const needsReview = item.reviewDecision === "REVIEW_REQUIRED";
213
- const merge = button("Merge", !needsReview, () => merge_(e, note, actions));
214
- merge.disabled = blocked || item.checks === "pending" || needsReview;
215
- /* The branch rules want an approving review. Approve is the person's review, given on
216
- purpose; Merge waits for it rather than approving on their behalf. */
217
- if (needsReview) {
218
- const approve = button("Approve", true, async () => {
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
- merge.className = "ghbtn primary";
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
- card.append(actions);
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 words = {
255
- passing: "Checks pass.",
256
- failing: "Checks fail.",
257
- pending: "Checks are running.",
258
- none: "No checks.",
259
- };
260
- const conflict =
261
- (item.mergeable === "CONFLICTING" ? " Conflicts with its base." : "") +
262
- (item.reviewDecision === "REVIEW_REQUIRED" ? " Needs your approval to merge." : "");
263
- return el("p", {
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?.(".homecard, .homeline");
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
- el("span", { className: "chip homestate " + tone, textContent: chip }),
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", textContent: `${whereOf(e)} · ${sub}` }),
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
  ],