@nanocollective/roster 0.1.0-beta.10 → 0.1.0-beta.12

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 CHANGED
@@ -7059,6 +7059,9 @@ async function query(gh, owner, name) {
7059
7059
  if (!res.ok) throw new Error(res.error);
7060
7060
  return res.data?.repository;
7061
7061
  }
7062
+ function isStatus(n) {
7063
+ return (n.labels?.nodes ?? []).some((l) => l?.name === "status" || l?.name === "keep-open");
7064
+ }
7062
7065
  function shape(n, repo, role, kind) {
7063
7066
  const events = (n.timelineItems?.nodes ?? []).map((e) => event(e)).filter(Boolean);
7064
7067
  return {
@@ -7068,8 +7071,9 @@ function shape(n, repo, role, kind) {
7068
7071
  number: n.number,
7069
7072
  title: n.title ?? "",
7070
7073
  // The list carries the body only to find a decision's default; a row never shows it, and
7071
- // a thread that is opened is read whole on its own.
7072
- body: n.timelineItems ? n.body ?? "" : "",
7074
+ // a thread that is opened is read whole on its own. A status issue's body is the exception:
7075
+ // it is the staff member's report, and Home shows it.
7076
+ body: n.timelineItems || isStatus(n) ? n.body ?? "" : "",
7073
7077
  ...extras(n),
7074
7078
  labels: (n.labels?.nodes ?? []).map((l) => l.name),
7075
7079
  assignees: (n.assignees?.nodes ?? []).map((a) => a.login),
@@ -90,6 +90,12 @@
90
90
  .homereportwho .meta{padding-left:21px}
91
91
  .homereportask{display:flex;flex-wrap:wrap;align-items:center;gap:6px;padding-left:21px;margin-top:6px}
92
92
  .homereportask .meta{padding-left:0}
93
+ /* A few lines of the report, fading out; the row opens it in full. */
94
+ .homereportbody{min-width:0;max-height:6em;overflow:hidden;
95
+ -webkit-mask-image:linear-gradient(#000 55%,transparent);mask-image:linear-gradient(#000 55%,transparent)}
96
+ .homereport.full .homereportbody{max-height:none;-webkit-mask-image:none;mask-image:none}
97
+ .homereportissue{border:0;background:none;padding:0;font:inherit;color:var(--accent);cursor:pointer}
98
+ .homereportissue:hover{text-decoration:underline}
93
99
  .homereportbody p{margin:0 0 4px;color:var(--ink-dim);font-size:13px;line-height:1.5}
94
100
  .homereportbody p:first-child{color:var(--ink)}
95
101
  .homereportbody a{color:var(--accent)}
@@ -20,17 +20,6 @@ const CHORE_WORDS = ["setup", "submit", "data", "blocked"];
20
20
 
21
21
  const lower = (s) => String(s ?? "").toLowerCase();
22
22
 
23
- /** How old a run report can be and still be this morning's. */
24
- const REPORT_HOURS = 20;
25
-
26
- /** A run report as lines, without the @mention it opens with. */
27
- function reportLines(body) {
28
- return String(body ?? "")
29
- .split("\n")
30
- .map((l) => l.replace(/^\s*(@[\w-]+\s*)+/, "").replace(/^[-*]\s+/, "").trim())
31
- .filter(Boolean)
32
- .slice(0, 5);
33
- }
34
23
 
35
24
  /**
36
25
  * @param items the inbox list: open and recently closed issues and pull requests
@@ -76,16 +65,10 @@ export function sortHome(items, staff, humans, live = [], now = new Date()) {
76
65
  continue;
77
66
  }
78
67
 
79
- // The run report: the last word on a status issue, from the staff member, in the last day.
80
- const c = item.lastComment;
81
- if (
82
- owner &&
83
- item.number === owner.statusIssue &&
84
- c &&
85
- !people.has(lower(c.author)) &&
86
- now - new Date(c.createdAt) < REPORT_HOURS * 3_600_000
87
- ) {
88
- out.reports.push({ staff: owner, item, at: c.createdAt, lines: reportLines(c.body) });
68
+ /* The report: the body of a staff member's status issue, which every run rewrites. Not its
69
+ comments, which used to be the reports and grew into a thread nobody wanted to scroll. */
70
+ if (owner && item.number === owner.statusIssue && String(item.body ?? "").trim()) {
71
+ out.reports.push({ staff: owner, item, at: item.updatedAt, body: String(item.body).trim() });
89
72
  }
90
73
 
91
74
  const place = placeOf(item, owner, people, markers);
@@ -93,10 +93,13 @@ export function viewHome(m) {
93
93
 
94
94
  /* ------------------------------- reports -------------------------------- */
95
95
 
96
+ /** Whose reports are open in full. Kept here, since Home repaints on every poll. */
97
+ const openReports = new Set();
98
+
96
99
  /**
97
- * One staff member's last report, or a line saying there is none today, with a button that asks
98
- * for one. The report is markdown the staff member wrote, with links to the work it names. The
99
- * whole row opens their status issue, where it was posted; a link inside it goes where it points.
100
+ * One staff member's report: the body of their status issue, which every run rewrites, with a
101
+ * button that asks them to bring it up to date now. It is markdown they wrote, with links to the
102
+ * work it names. It shows its first few lines; the row opens it in full, and closes it again.
100
103
  */
101
104
  function reportRow(s, reports) {
102
105
  const r = reports.find((x) => x.staff.handle === s.handle);
@@ -115,7 +118,7 @@ function reportRow(s, reports) {
115
118
  body: `${s.mention ?? "@" + s.handle} Report, please.`,
116
119
  });
117
120
  ask.remove();
118
- note.textContent = `Asked. ${s.name} replies in a few minutes.`;
121
+ note.textContent = `Asked. ${s.name} updates it in a few minutes.`;
119
122
  refreshSoon();
120
123
  } catch (e) {
121
124
  note.textContent = String(e.message || e);
@@ -124,23 +127,44 @@ function reportRow(s, reports) {
124
127
  }
125
128
  };
126
129
 
127
- const row = el("div", { className: "homereport homeclick", tabIndex: 0, role: "button" }, [
128
- el("div", { className: "homereportwho" }, [
129
- el("span", { className: "homewho2" }, [icon(staffIcon(s), "ic"), el("b", { textContent: s.name })]),
130
- el("span", { className: "meta", textContent: r ? ago(r.at) : "No report today" }),
131
- el("div", { className: "homereportask" }, [ask, note]),
132
- ]),
133
- r
134
- ? el("div", { className: "md homereportbody", innerHTML: mdlite(r.lines.join("\n\n"), { repo: s.brain }) })
135
- : el("div"),
136
- ]);
130
+ const issue = el("button", { className: "homereportissue", textContent: "#" + item.number });
131
+ issue.onclick = () => openThread(item);
132
+ const full = openReports.has(s.handle);
133
+ const row = el(
134
+ "div",
135
+ {
136
+ className: "homereport" + (r ? " homeclick" : "") + (full ? " full" : ""),
137
+ ...(r ? { tabIndex: 0, role: "button", ariaExpanded: String(full) } : {}),
138
+ },
139
+ [
140
+ el("div", { className: "homereportwho" }, [
141
+ el("span", { className: "homewho2" }, [icon(staffIcon(s), "ic"), el("b", { textContent: s.name })]),
142
+ el("span", { className: "meta" }, [
143
+ document.createTextNode((r ? "Updated " + ago(r.at) : "No report yet") + " · "),
144
+ issue,
145
+ ]),
146
+ el("div", { className: "homereportask" }, [ask, note]),
147
+ ]),
148
+ r
149
+ ? el("div", { className: "md homereportbody", innerHTML: mdlite(r.body, { repo: s.brain }) })
150
+ : el("div"),
151
+ ],
152
+ );
153
+ if (!r) return row;
154
+ const toggle = () => {
155
+ if (openReports.has(s.handle)) openReports.delete(s.handle);
156
+ else openReports.add(s.handle);
157
+ const now = openReports.has(s.handle);
158
+ row.classList.toggle("full", now);
159
+ row.setAttribute("aria-expanded", String(now));
160
+ };
137
161
  row.onclick = (ev) => {
138
- if (!ev.target.closest("a, button")) openThread(item);
162
+ if (!ev.target.closest("a, button")) toggle();
139
163
  };
140
164
  row.onkeydown = (ev) => {
141
165
  if (ev.target === row && (ev.key === "Enter" || ev.key === " ")) {
142
166
  ev.preventDefault();
143
- openThread(item);
167
+ toggle();
144
168
  }
145
169
  };
146
170
  return row;