forge-cw 0.1.28 → 0.1.30

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.
@@ -1,12 +1,10 @@
1
1
  // src/banner.tsx
2
- import { useState as useState2 } from "preact/hooks";
3
2
  import { definePanel } from "@forge-dev/sdk";
4
3
 
5
4
  // src/ops.ts
6
5
  var errorMessage = (e) => e instanceof Error ? e.message : String(e);
7
6
  var STARTS = ["issue", "request", "review"];
8
7
  var startsTask = (kind) => STARTS.includes(kind);
9
- var inAccount = (items, account) => account ? items.filter((i) => i.account === account) : items;
10
8
  function opFor(item, project) {
11
9
  if (item.kind === "to-task") return item.targetSession ? "send" : null;
12
10
  if (item.kind === "research") return "research";
@@ -18,7 +16,11 @@ function projectsFor({ names, owners }, account) {
18
16
  }
19
17
  var failedLine = (error) => `Last reading failed: ${error}`;
20
18
  var loadFailedLine = (error) => `Can't load Today: ${error}`;
21
- var notesLine = (notes) => notes?.length ? notes.join(" \xB7 ") : null;
19
+ var GH_SIGNED_OUT = "GitHub: gh is not signed in (run gh auth login)";
20
+ function tidyNotes(notes) {
21
+ return [...new Set(notes.map((n) => /^github\b[^:]*:/i.test(n) && /gh auth login|GH_TOKEN/i.test(n) ? GH_SIGNED_OUT : n))];
22
+ }
23
+ var notesLine = (notes) => notes?.length ? tidyNotes(notes).join(" \xB7 ") : null;
22
24
  var SOURCE_NAME = { slack: "Slack", linear: "Linear", reader: "Reader" };
23
25
  function sourcesLabel(sources) {
24
26
  const names = ["slack", "linear", "reader"].filter((s) => sources.includes(s)).map((s) => SOURCE_NAME[s]);
@@ -33,7 +35,6 @@ function groupProblems(problems) {
33
35
  }
34
36
  var groupLine = (g) => `${g.account} \xB7 ${g.label} did not respond`;
35
37
  var problemsLabel = (n) => `\u26A0 ${n} account problem${n === 1 ? "" : "s"}`;
36
- var accountsOf = (items) => [...new Set(items.flatMap((i) => i.account ? [i.account] : []))];
37
38
  function titleFor(i) {
38
39
  if (!i.issueKey) return i.title;
39
40
  const key = i.issueKey.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
@@ -45,9 +46,52 @@ function whoOf(i) {
45
46
  const who = i.who.trim();
46
47
  return !who || who.toLowerCase() === SOURCE_NAMES[i.source].toLowerCase() ? null : who;
47
48
  }
48
- var pendingLabel = (p) => p.kind === "ci" ? "CI failing" : p.kind === "review" ? "Review requested" : p.source === "linear" ? p.started ? "In progress" : "To do" : "Assigned";
49
- var pendingIn = (items, account) => account ? items.filter((p) => p.account === account) : items;
50
49
  var FIRST_READING_NOTE = "First reading \u2014 what you have open is under Pending.";
50
+ function newsList(items) {
51
+ const waiting = (i) => i.state === "proposed" || i.state === "failed" ? 0 : 1;
52
+ return items.filter((i) => i.state !== "dismissed").sort((a, b) => waiting(a) - waiting(b) || Date.parse(b.when) - Date.parse(a.when));
53
+ }
54
+ var GROUPS = [
55
+ { id: "needs", title: "Needs you" },
56
+ { id: "progress", title: "In progress" },
57
+ { id: "todo", title: "To do", folded: true },
58
+ { id: "updates", title: "Updates" }
59
+ ];
60
+ function groupOf(e) {
61
+ if (e.kind === "news") return e.item.state === "proposed" || e.item.state === "failed" ? "needs" : "updates";
62
+ const p = e.item;
63
+ if (p.kind === "ci" || p.kind === "reply") return "needs";
64
+ return p.kind === "review" || p.source === "linear" && p.started ? "progress" : "todo";
65
+ }
66
+ function inboxGroups(news, pending) {
67
+ const entries = [...pending.map((item) => ({ kind: "pending", item })), ...news.map((item) => ({ kind: "news", item }))];
68
+ return GROUPS.map((g) => ({ ...g, folded: !!g.folded, entries: entries.filter((e) => groupOf(e) === g.id) })).filter((g) => g.entries.length > 0);
69
+ }
70
+ function ageShort(iso, now = /* @__PURE__ */ new Date()) {
71
+ const min = Math.max(0, Math.round((now.getTime() - Date.parse(iso)) / 6e4));
72
+ if (Number.isNaN(min)) return "";
73
+ if (min < 1) return "now";
74
+ if (min < 60) return `${min}m`;
75
+ if (min < 48 * 60) return `${Math.round(min / 60)}h`;
76
+ return `${Math.round(min / 1440)}d`;
77
+ }
78
+ var safeHref = (link) => /^https?:\/\//i.test(link) ? link : void 0;
79
+ var isOpenNews = (i) => i.state === "proposed" || i.state === "failed";
80
+ function bannerSummary(news, pending) {
81
+ return { fresh: news.filter(isOpenNews).length, pending: pending.length, ci: pending.filter((p) => p.kind === "ci").length, slack: pending.filter((p) => p.kind === "reply").length };
82
+ }
83
+ function summaryText(s) {
84
+ const urgent = [s.ci ? `${s.ci} CI` : "", s.slack ? `${s.slack} Slack` : ""].filter(Boolean).join(" \xB7 ");
85
+ return `${s.fresh} new \xB7 ${s.pending} pending${urgent ? ` (${urgent})` : ""}`;
86
+ }
87
+ function urgentRows(news, pending, max = 3) {
88
+ const open = newsList(news).filter(isOpenNews);
89
+ const urgent = [...pending.filter((p) => p.kind === "ci"), ...pending.filter((p) => p.kind === "reply")];
90
+ const first = urgent.slice(0, open.length ? Math.max(1, max - 1) : max).map((item) => ({ kind: "pending", item }));
91
+ return [...first, ...open.slice(0, max - first.length).map((item) => ({ kind: "news", item }))];
92
+ }
93
+ var VERBS = { "to-task": "Send", issue: "Start", request: "Start", research: "Research", review: "Review" };
94
+ var verbFor = (kind) => VERBS[kind];
51
95
 
52
96
  // src/rows.tsx
53
97
  import { useCallback, useEffect, useRef, useState } from "preact/hooks";
@@ -65,24 +109,12 @@ function AccountChip({ account }) {
65
109
  const token = accountToken(account);
66
110
  return /* @__PURE__ */ jsx("span", { title: `Account ${account}`, style: { fontSize: "10.5px", fontWeight: 600, padding: "2px 7px", borderRadius: "6px", whiteSpace: "nowrap", color: `var(${token})`, background: soft(token, 15) }, children: account });
67
111
  }
68
- var FILTER_KEY = "today.account";
69
- function useAccountFilter() {
70
- const [account, setAccount] = useState(() => {
71
- try {
72
- return localStorage.getItem(FILTER_KEY) ?? "";
73
- } catch {
74
- return "";
75
- }
76
- });
77
- const choose = (a) => {
78
- setAccount(a);
79
- try {
80
- if (a) localStorage.setItem(FILTER_KEY, a);
81
- else localStorage.removeItem(FILTER_KEY);
82
- } catch {
83
- }
84
- };
85
- return [account, choose];
112
+ var START_DAY_KEY = "today.startDay";
113
+ function requestStartDay() {
114
+ try {
115
+ localStorage.setItem(START_DAY_KEY, String(Date.now()));
116
+ } catch {
117
+ }
86
118
  }
87
119
  function useDigest(forge, path = "/digest") {
88
120
  const [reply, setReply] = useState(null);
@@ -130,18 +162,22 @@ function useActing(forge, date, reload, hurry = () => {
130
162
  const [retrying, setRetrying] = useState(null);
131
163
  const reading = useRef(false);
132
164
  const guarded = async (fn) => {
165
+ let ok = true;
133
166
  try {
134
167
  await fn();
135
168
  } catch (e) {
169
+ ok = false;
136
170
  showToast(errorMessage(e), "error");
137
171
  }
138
172
  await reload();
173
+ return ok;
139
174
  };
140
175
  const run = async (fn) => {
141
- if (busy) return;
176
+ if (busy) return false;
142
177
  setBusy(true);
143
- await guarded(fn);
178
+ const ok = await guarded(fn);
144
179
  setBusy(false);
180
+ return ok;
145
181
  };
146
182
  const act = (item, op, project) => run(async () => {
147
183
  if (date) await forge.action(op, { date, id: item.id, ...project ? { project } : {} });
@@ -149,6 +185,9 @@ function useActing(forge, date, reload, hurry = () => {
149
185
  const startPending = (item, project) => run(async () => {
150
186
  await forge.action("pending-start", { id: item.id, ...project ? { project } : {} });
151
187
  });
188
+ const researchPending = (item) => run(async () => {
189
+ await forge.action("pending-research", { id: item.id });
190
+ });
152
191
  const hidePending = (item) => run(async () => {
153
192
  await forge.action("pending-hide", { id: item.id });
154
193
  });
@@ -176,7 +215,7 @@ function useActing(forge, date, reload, hurry = () => {
176
215
  const s = await forge.action("reconnect", { account });
177
216
  if (s) forge.openSession(s.project, s.sessionDir);
178
217
  });
179
- return { busy, refreshing, retrying, retry, reconnect, run, act, refresh, startPending, hidePending };
218
+ return { busy, refreshing, retrying, retry, reconnect, run, act, refresh, startPending, researchPending, hidePending };
180
219
  }
181
220
  function dayOf(date) {
182
221
  const [y, m, d] = date.split("-").map(Number);
@@ -191,9 +230,6 @@ function dayLabel(now, date) {
191
230
  return `${part} \xB7 your ${now.toLocaleDateString("en-US", { weekday: "long" })} ${now.getDate()}`;
192
231
  }
193
232
  var shortDay = (now, date) => !date || isToday(date, now) ? "Today" : dayLabel(now, date);
194
- function foldedNow(folded, items) {
195
- return folded || !items.some((i) => i.state === "proposed" || i.state === "failed");
196
- }
197
233
  var clock = (d) => d.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit" });
198
234
  function windowTime(at, read) {
199
235
  if (at.toDateString() === read.toDateString()) return clock(at);
@@ -204,18 +240,10 @@ function readLine(d) {
204
240
  const read = new Date(d.readAt);
205
241
  return `Read at ${clock(read)} \xB7 changes since ${windowTime(new Date(d.windowStart ?? d.since), read)}`;
206
242
  }
207
- function ago(iso, now = /* @__PURE__ */ new Date()) {
208
- const t = new Date(iso);
209
- const min = Math.round((now.getTime() - t.getTime()) / 6e4);
210
- if (min < 1) return "just now";
211
- if (min < 60) return `${min} min ago`;
212
- if (min < 24 * 60) return `${Math.round(min / 60)} h ago`;
213
- return t.toLocaleDateString("en-US", { month: "short", day: "numeric" }) + " " + clock(t);
214
- }
215
243
  var SOURCE_LABEL = { linear: "Linear", slack: "Slack", github: "GitHub" };
216
244
  var SOURCE_TINT = { linear: "#5e6ad2 22%", slack: "#e01e5a 18%", github: "#8b949e 24%" };
217
245
  function SourceIcon({ source }) {
218
- return /* @__PURE__ */ jsx("div", { title: SOURCE_LABEL[source], style: { width: "30px", height: "30px", borderRadius: "8px", display: "grid", placeItems: "center", flexShrink: 0, background: `color-mix(in srgb, ${SOURCE_TINT[source]}, transparent)` }, children: source === "github" ? /* @__PURE__ */ jsx("svg", { width: "15", height: "15", viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { fill: "currentColor", style: { color: "var(--ink)" }, d: "M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82a7.6 7.6 0 0 1 4 0c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z" }) }) : source === "linear" ? /* @__PURE__ */ jsx("svg", { width: "15", height: "15", viewBox: "0 0 100 100", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { fill: "#8c94f0", d: "M1.2 61.5 38.5 98.8C19.8 95.6 4.4 80.2 1.2 61.5zM0 46.9 53.1 100c3.4-.2 6.8-.8 10-1.6L1.6 36.9C.8 40.1.2 43.5 0 46.9zM4.9 27 73 95.1c2.6-1.1 5.1-2.5 7.4-4L8.9 19.6c-1.5 2.3-2.9 4.8-4 7.4zM14.4 13.8C23.4 5.3 35.5 0 48.9 0 76 0 100 24 100 51.1c0 13.4-5.3 25.5-13.8 34.5z" }) }) : /* @__PURE__ */ jsx("svg", { width: "15", height: "15", viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ jsxs("g", { fill: "none", "stroke-width": "2.6", "stroke-linecap": "round", children: [
246
+ return /* @__PURE__ */ jsx("div", { title: SOURCE_LABEL[source], style: { width: "22px", height: "22px", borderRadius: "6px", display: "grid", placeItems: "center", flexShrink: 0, background: `color-mix(in srgb, ${SOURCE_TINT[source]}, transparent)` }, children: source === "github" ? /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { fill: "currentColor", style: { color: "var(--ink)" }, d: "M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82a7.6 7.6 0 0 1 4 0c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z" }) }) : source === "linear" ? /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 100 100", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { fill: "#8c94f0", d: "M1.2 61.5 38.5 98.8C19.8 95.6 4.4 80.2 1.2 61.5zM0 46.9 53.1 100c3.4-.2 6.8-.8 10-1.6L1.6 36.9C.8 40.1.2 43.5 0 46.9zM4.9 27 73 95.1c2.6-1.1 5.1-2.5 7.4-4L8.9 19.6c-1.5 2.3-2.9 4.8-4 7.4zM14.4 13.8C23.4 5.3 35.5 0 48.9 0 76 0 100 24 100 51.1c0 13.4-5.3 25.5-13.8 34.5z" }) }) : /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ jsxs("g", { fill: "none", "stroke-width": "2.6", "stroke-linecap": "round", children: [
219
247
  /* @__PURE__ */ jsx("path", { stroke: "#36c5f0", d: "M9 3.5v6" }),
220
248
  /* @__PURE__ */ jsx("path", { stroke: "#2eb67d", d: "M20.5 9h-6" }),
221
249
  /* @__PURE__ */ jsx("path", { stroke: "#ecb22e", d: "M15 20.5v-6" }),
@@ -223,11 +251,11 @@ function SourceIcon({ source }) {
223
251
  ] }) }) });
224
252
  }
225
253
  var KIND = {
226
- "to-task": { label: "Send to the task", token: "--orange", verb: "Send" },
227
- issue: { label: "New task", token: "--green", verb: "Start" },
228
- request: { label: "New task", token: "--green", verb: "Start" },
229
- research: { label: "Research", token: "--purple", verb: "Research" },
230
- review: { label: "Review", token: "--blue", verb: "Review" }
254
+ "to-task": { label: "Send to the task", token: "--orange" },
255
+ issue: { label: "New task", token: "--green" },
256
+ request: { label: "New task", token: "--green" },
257
+ research: { label: "Research", token: "--purple" },
258
+ review: { label: "Review", token: "--blue" }
231
259
  };
232
260
  function KindPill({ kind }) {
233
261
  const k = KIND[kind];
@@ -267,118 +295,121 @@ function outcome(item) {
267
295
  where ? ` \xB7 ${where}` : ""
268
296
  ] });
269
297
  }
298
+ var sourceOf = (p) => SOURCE_LABEL[p.source];
299
+ var mono = { fontFamily: "var(--mono, ui-monospace, monospace)", fontSize: "11.5px", color: "var(--ink-2)", fontWeight: 500 };
300
+ function Line({ source, keyText, title, account, when, primary, children, dim }) {
301
+ const [open, setOpen] = useState(false);
302
+ return /* @__PURE__ */ jsxs("div", { style: { borderRadius: "9px", background: open ? soft("--ink", 3) : "transparent", border: `1px solid ${open ? "var(--hair)" : "transparent"}`, opacity: dim ? 0.55 : 1, transition: "background .2s var(--ease)" }, children: [
303
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px", padding: "4px 6px", minHeight: "30px" }, children: [
304
+ /* @__PURE__ */ jsxs("button", { type: "button", "aria-expanded": open, onClick: () => setOpen(!open), style: { flex: 1, minWidth: 0, display: "flex", alignItems: "center", gap: "8px", font: "inherit", fontSize: "12.5px", textAlign: "left", padding: 0, border: 0, background: "none", color: "var(--ink)", cursor: "pointer" }, children: [
305
+ /* @__PURE__ */ jsx(SourceIcon, { source }),
306
+ /* @__PURE__ */ jsx("span", { style: { minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", fontWeight: 530 }, children: title }),
307
+ keyText && /* @__PURE__ */ jsx("span", { style: { ...mono, flexShrink: 0, marginLeft: "auto" }, children: keyText })
308
+ ] }),
309
+ account && /* @__PURE__ */ jsx("span", { style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx(AccountChip, { account }) }),
310
+ /* @__PURE__ */ jsx("span", { title: when, style: { fontSize: "11px", color: "var(--ink-3)", minWidth: "26px", textAlign: "right" }, children: ageShort(when) }),
311
+ primary && /* @__PURE__ */ jsx("span", { style: { display: "flex", alignItems: "center", gap: "6px", flexShrink: 0 }, children: primary })
312
+ ] }),
313
+ open && /* @__PURE__ */ jsx("div", { style: { padding: "2px 8px 9px 36px", display: "flex", flexDirection: "column", gap: "7px", fontSize: "11.5px", color: "var(--ink-2)" }, children })
314
+ ] });
315
+ }
316
+ var Quote = ({ text }) => /* @__PURE__ */ jsxs("div", { style: { fontSize: "12px", borderLeft: "2px solid var(--hair-2)", paddingLeft: "8px", fontStyle: "italic" }, children: [
317
+ "\u201C",
318
+ text,
319
+ "\u201D"
320
+ ] });
321
+ function OpenLink({ href, label }) {
322
+ const safe = safeHref(href);
323
+ return safe ? /* @__PURE__ */ jsxs("a", { href: safe, target: "_blank", rel: "noopener noreferrer", style: { color: "var(--ink-2)", textDecoration: "none", borderBottom: "1px dotted var(--ink-3)" }, children: [
324
+ label,
325
+ " \u2197"
326
+ ] }) : null;
327
+ }
328
+ var Actions = ({ children }) => /* @__PURE__ */ jsx("div", { style: { display: "flex", alignItems: "center", gap: "8px", flexWrap: "wrap" }, children });
270
329
  var Row = ({ item, projects = EMPTY_PROJECTS, acting, forge }) => {
271
330
  const [project, setProject] = useState(item.project ?? "");
272
331
  const open = item.state === "proposed" || item.state === "failed";
273
332
  const needsProject = startsTask(item.kind) && !item.project;
274
333
  const op = opFor(item, project);
275
334
  const where = item.source === "slack" ? "in" : "on";
276
- return /* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "30px 1fr auto", gap: "12px", alignItems: "center", padding: "10px 12px", borderRadius: "11px", background: soft("--ink", 3), border: "1px solid var(--hair)", opacity: item.state === "dismissed" ? 0.55 : 1, transition: "background .2s var(--ease)" }, children: [
277
- /* @__PURE__ */ jsx(SourceIcon, { source: item.source }),
278
- /* @__PURE__ */ jsxs("div", { style: { minWidth: 0 }, children: [
279
- /* @__PURE__ */ jsxs("div", { style: { fontWeight: 560, fontSize: "13px", display: "flex", alignItems: "center", gap: "8px", minWidth: 0 }, children: [
280
- item.issueKey && /* @__PURE__ */ jsx("span", { style: { fontFamily: "var(--mono, ui-monospace, monospace)", fontSize: "11.5px", color: "var(--ink-2)", fontWeight: 500 }, children: item.issueKey }),
281
- /* @__PURE__ */ jsx("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: titleFor(item) })
282
- ] }),
283
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "6px", marginTop: "3px", fontSize: "11.5px", color: "var(--ink-2)", flexWrap: "wrap" }, children: [
284
- whoOf(item) && /* @__PURE__ */ jsx(Avatar, { who: item.who }),
285
- /* @__PURE__ */ jsx("span", { children: whoOf(item) ? /* @__PURE__ */ jsxs(Fragment, { children: [
286
- item.who,
287
- " ",
288
- where,
289
- " ",
290
- strong(item.where)
291
- ] }) : strong(item.where) }),
292
- /* @__PURE__ */ jsx(Sep, {}),
293
- /* @__PURE__ */ jsx("span", { children: ago(item.when) }),
294
- item.account && /* @__PURE__ */ jsxs(Fragment, { children: [
295
- /* @__PURE__ */ jsx(Sep, {}),
296
- /* @__PURE__ */ jsx(AccountChip, { account: item.account })
297
- ] }),
335
+ const s = item.startedSession;
336
+ const go = /* @__PURE__ */ jsx(Btn, { label: item.state === "failed" ? "Retry" : verbFor(item.kind), disabled: acting.busy || !op, onClick: () => op && acting.act(item, op, needsProject ? project : void 0) });
337
+ const primary = open ? needsProject ? null : go : item.state === "done" ? s ? /* @__PURE__ */ jsx(Btn, { label: "Open session", onClick: () => forge.openSession(s.project, s.sessionDir) }) : /* @__PURE__ */ jsx("span", { style: { fontSize: "11.5px", color: "var(--green)" }, children: item.kind === "to-task" ? "Sent" : "Done" }) : null;
338
+ return /* @__PURE__ */ jsxs(Line, { source: item.source, keyText: item.issueKey, title: titleFor(item), account: item.account, when: item.when, primary, children: [
339
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "6px", flexWrap: "wrap" }, children: [
340
+ /* @__PURE__ */ jsx(KindPill, { kind: item.kind }),
341
+ whoOf(item) && /* @__PURE__ */ jsx(Avatar, { who: item.who }),
342
+ /* @__PURE__ */ jsx("span", { children: whoOf(item) ? /* @__PURE__ */ jsxs(Fragment, { children: [
343
+ item.who,
344
+ " ",
345
+ where,
346
+ " ",
347
+ strong(item.where)
348
+ ] }) : strong(item.where) }),
349
+ item.kind === "to-task" && item.targetSession && /* @__PURE__ */ jsxs(Fragment, { children: [
298
350
  /* @__PURE__ */ jsx(Sep, {}),
299
- /* @__PURE__ */ jsxs("a", { href: item.link, target: "_blank", rel: "noopener noreferrer", style: { color: "var(--ink-2)", textDecoration: "none", borderBottom: "1px dotted var(--ink-3)" }, children: [
300
- "View in ",
301
- SOURCE_LABEL[item.source],
302
- " \u2197"
303
- ] }),
304
- item.kind === "to-task" && item.targetSession && /* @__PURE__ */ jsxs(Fragment, { children: [
305
- /* @__PURE__ */ jsx(Sep, {}),
306
- /* @__PURE__ */ jsxs("span", { children: [
307
- "goes to ",
308
- strong(item.targetSession.sessionDir)
309
- ] })
310
- ] }),
311
- item.project && item.kind !== "to-task" && /* @__PURE__ */ jsxs(Fragment, { children: [
312
- /* @__PURE__ */ jsx(Sep, {}),
313
- /* @__PURE__ */ jsxs("span", { children: [
314
- "project ",
315
- strong(item.project)
316
- ] })
351
+ /* @__PURE__ */ jsxs("span", { children: [
352
+ "goes to ",
353
+ strong(item.targetSession.sessionDir)
317
354
  ] })
318
355
  ] }),
319
- item.quote && /* @__PURE__ */ jsxs("div", { style: { marginTop: "6px", fontSize: "12px", color: "var(--ink-2)", borderLeft: "2px solid var(--hair-2)", paddingLeft: "8px", fontStyle: "italic" }, children: [
320
- "\u201C",
321
- item.quote,
322
- "\u201D"
323
- ] }),
324
- item.error && /* @__PURE__ */ jsx("div", { style: { marginTop: "6px", fontSize: "11.5px", color: "var(--red)" }, children: item.error })
356
+ item.project && item.kind !== "to-task" && /* @__PURE__ */ jsxs(Fragment, { children: [
357
+ /* @__PURE__ */ jsx(Sep, {}),
358
+ /* @__PURE__ */ jsxs("span", { children: [
359
+ "project ",
360
+ strong(item.project)
361
+ ] })
362
+ ] })
325
363
  ] }),
326
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
327
- /* @__PURE__ */ jsx(KindPill, { kind: item.kind }),
328
- open && needsProject && /* @__PURE__ */ jsx(ProjectPicker, { projects: projectsFor(projects, item.account), value: project, onChange: setProject }),
329
- open && /* @__PURE__ */ jsx(Btn, { label: item.state === "failed" ? "Retry" : KIND[item.kind].verb, disabled: acting.busy || !op, onClick: () => op && acting.act(item, op, needsProject ? project : void 0) }),
330
- open && /* @__PURE__ */ jsx(Btn, { label: "Dismiss", style: ghostStyle, disabled: acting.busy, onClick: () => acting.act(item, "dismiss") }),
331
- item.state === "done" && outcome(item),
332
- item.state === "done" && item.startedSession && /* @__PURE__ */ jsx(Btn, { label: "Open session", onClick: () => forge.openSession(item.startedSession.project, item.startedSession.sessionDir) }),
333
- item.state === "dismissed" && /* @__PURE__ */ jsx("span", { style: { fontSize: "11.5px", color: "var(--ink-3)" }, children: "Dismissed" })
364
+ item.quote && /* @__PURE__ */ jsx(Quote, { text: item.quote }),
365
+ item.error && /* @__PURE__ */ jsx("div", { style: { color: "var(--red)" }, children: item.error }),
366
+ item.state === "done" && outcome(item),
367
+ /* @__PURE__ */ jsxs(Actions, { children: [
368
+ open && needsProject && /* @__PURE__ */ jsxs(Fragment, { children: [
369
+ /* @__PURE__ */ jsx(ProjectPicker, { projects: projectsFor(projects, item.account), value: project, onChange: setProject }),
370
+ go
371
+ ] }),
372
+ /* @__PURE__ */ jsx(OpenLink, { href: item.link, label: `Open in ${sourceOf(item)}` }),
373
+ open && /* @__PURE__ */ jsx(Btn, { label: "Dismiss", style: ghostStyle, disabled: acting.busy, onClick: () => acting.act(item, "dismiss") })
334
374
  ] })
335
375
  ] });
336
376
  };
337
- var PENDING_TOKEN = { ci: "--red", review: "--blue", issue: "--green" };
338
- var PendingRow = ({ item, projects = EMPTY_PROJECTS, acting, forge, compact }) => {
377
+ var PENDING_TOKEN = { ci: "--red", review: "--blue", issue: "--green", reply: "--purple" };
378
+ var PendingRow = ({ item, projects = EMPTY_PROJECTS, acting, forge }) => {
339
379
  const [project, setProject] = useState(item.project ?? "");
340
380
  const token = PENDING_TOKEN[item.kind];
341
381
  const target = item.project ?? project;
342
- return /* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "30px 1fr auto", gap: "12px", alignItems: "center", padding: compact ? "7px 10px" : "10px 12px", borderRadius: "11px", background: soft("--ink", 3), border: "1px solid var(--hair)" }, children: [
343
- /* @__PURE__ */ jsx(SourceIcon, { source: item.source }),
344
- /* @__PURE__ */ jsxs("div", { style: { minWidth: 0 }, children: [
345
- /* @__PURE__ */ jsxs("div", { style: { fontWeight: 560, fontSize: "13px", display: "flex", alignItems: "center", gap: "8px", minWidth: 0 }, children: [
346
- item.issueKey && /* @__PURE__ */ jsx("span", { style: { fontFamily: "var(--mono, ui-monospace, monospace)", fontSize: "11.5px", color: "var(--ink-2)", fontWeight: 500 }, children: item.issueKey }),
347
- /* @__PURE__ */ jsx("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: titleFor(item) })
382
+ const slack = item.kind === "reply";
383
+ const start = /* @__PURE__ */ jsx(Btn, { label: item.kind === "review" ? "Review" : "Start", disabled: acting.busy || !target, onClick: () => acting.startPending(item, item.project ? void 0 : project) });
384
+ const primary = item.targetSession ? /* @__PURE__ */ jsx(Btn, { label: "Open task", onClick: () => forge.openSession(item.targetSession.project, item.targetSession.sessionDir) }) : item.project ? start : null;
385
+ return /* @__PURE__ */ jsxs(Line, { source: item.source, keyText: item.issueKey, title: titleFor(item), account: item.account, when: item.when, primary, children: [
386
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "6px", flexWrap: "wrap" }, children: [
387
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "10.5px", fontWeight: 600, padding: "2px 7px", borderRadius: "6px", whiteSpace: "nowrap", color: `var(${token})`, background: soft(token, 15) }, children: slack ? "Waiting on you" : item.kind === "ci" ? "CI failing" : item.kind === "review" ? "Review requested" : item.state }),
388
+ slack ? /* @__PURE__ */ jsxs("span", { children: [
389
+ item.who,
390
+ " in ",
391
+ strong(item.where ?? "")
392
+ ] }) : /* @__PURE__ */ jsxs("span", { children: [
393
+ item.repo ? strong(item.repo) : null,
394
+ item.repo && item.state ? " \xB7 " : "",
395
+ item.state
348
396
  ] }),
349
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "6px", marginTop: "3px", fontSize: "11.5px", color: "var(--ink-2)", flexWrap: "wrap" }, children: [
350
- /* @__PURE__ */ jsxs("span", { children: [
351
- item.repo ? strong(item.repo) : null,
352
- item.repo && item.state ? " \xB7 " : "",
353
- item.state
354
- ] }),
355
- (item.repo || item.state) && /* @__PURE__ */ jsx(Sep, {}),
356
- /* @__PURE__ */ jsx("span", { children: ago(item.when) }),
357
- item.account && /* @__PURE__ */ jsxs(Fragment, { children: [
358
- /* @__PURE__ */ jsx(Sep, {}),
359
- /* @__PURE__ */ jsx(AccountChip, { account: item.account })
360
- ] }),
397
+ item.project && /* @__PURE__ */ jsxs(Fragment, { children: [
361
398
  /* @__PURE__ */ jsx(Sep, {}),
362
- /* @__PURE__ */ jsxs("a", { href: item.link, target: "_blank", rel: "noopener noreferrer", style: { color: "var(--ink-2)", textDecoration: "none", borderBottom: "1px dotted var(--ink-3)" }, children: [
363
- "View in ",
364
- SOURCE_LABEL[item.source],
365
- " \u2197"
366
- ] }),
367
- item.project && /* @__PURE__ */ jsxs(Fragment, { children: [
368
- /* @__PURE__ */ jsx(Sep, {}),
369
- /* @__PURE__ */ jsxs("span", { children: [
370
- "project ",
371
- strong(item.project)
372
- ] })
399
+ /* @__PURE__ */ jsxs("span", { children: [
400
+ "project ",
401
+ strong(item.project)
373
402
  ] })
374
403
  ] })
375
404
  ] }),
376
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
377
- /* @__PURE__ */ jsx("span", { style: { fontSize: "10.5px", fontWeight: 600, padding: "2px 7px", borderRadius: "6px", whiteSpace: "nowrap", color: `var(${token})`, background: soft(token, 15) }, children: pendingLabel(item) }),
378
- item.targetSession ? /* @__PURE__ */ jsx(Btn, { label: "Open task", onClick: () => forge.openSession(item.targetSession.project, item.targetSession.sessionDir) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
379
- !item.project && /* @__PURE__ */ jsx(ProjectPicker, { projects: projectsFor(projects, item.account), value: project, onChange: setProject }),
380
- /* @__PURE__ */ jsx(Btn, { label: item.kind === "review" ? "Review" : "Start", disabled: acting.busy || !target, onClick: () => acting.startPending(item, item.project ? void 0 : project) })
405
+ item.quote && /* @__PURE__ */ jsx(Quote, { text: item.quote }),
406
+ /* @__PURE__ */ jsxs(Actions, { children: [
407
+ !item.targetSession && !item.project && /* @__PURE__ */ jsxs(Fragment, { children: [
408
+ /* @__PURE__ */ jsx(ProjectPicker, { projects: projectsFor(projects, item.account), value: project, onChange: setProject }),
409
+ start
381
410
  ] }),
411
+ /* @__PURE__ */ jsx(OpenLink, { href: item.link, label: `Open in ${sourceOf(item)}` }),
412
+ slack && !item.targetSession && /* @__PURE__ */ jsx(Btn, { label: "Research", style: ghostStyle, disabled: acting.busy, onClick: () => acting.researchPending(item) }),
382
413
  /* @__PURE__ */ jsx(Btn, { label: "Hide", style: ghostStyle, disabled: acting.busy, onClick: () => acting.hidePending(item) })
383
414
  ] })
384
415
  ] });
@@ -388,7 +419,20 @@ var READING_CSS = `
388
419
  @keyframes today-pulse { 0%, 100% { opacity: .55 } 50% { opacity: 1 } }
389
420
  .today-spin { animation: today-spin .8s linear infinite }
390
421
  .today-pulse { animation: today-pulse 1.4s ease-in-out infinite }
391
- @media (prefers-reduced-motion: reduce) { .today-spin, .today-pulse { animation: none } }`;
422
+ .today-inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: calc(100vh - 250px); min-height: 440px; border: 1px solid var(--hair); border-radius: 12px; overflow: hidden }
423
+ .today-list { display: flex; flex-direction: column; min-height: 0; background: var(--card); border-right: 1px solid var(--hair) }
424
+ .today-detail { overflow-y: auto; min-width: 0; background: var(--elev) }
425
+ .today-back { display: none }
426
+ @media (max-width: 900px) {
427
+ .today-inbox { grid-template-columns: minmax(0, 1fr) }
428
+ .today-list { border-right: 0 }
429
+ .today-inbox[data-open="true"] .today-list, .today-inbox[data-open="false"] .today-detail { display: none }
430
+ .today-back { display: inline-block }
431
+ .today-triage { grid-template-columns: minmax(0, 1fr) !important }
432
+ }
433
+ @keyframes today-slide { from { opacity: 0; transform: translateX(28px) } to { opacity: 1; transform: none } }
434
+ .today-slide { animation: today-slide .22s var(--ease) }
435
+ @media (prefers-reduced-motion: reduce) { .today-spin, .today-pulse, .today-slide { animation: none } }`;
392
436
  function useReadingStyles() {
393
437
  if (typeof document !== "undefined" && !document.getElementById("today-reading-css")) {
394
438
  const el = document.createElement("style");
@@ -413,93 +457,31 @@ function ReadingLine({ reading }) {
413
457
  accounts.length > 0 && /* @__PURE__ */ jsx("span", { children: "\u2026" })
414
458
  ] });
415
459
  }
416
- function SkeletonRows() {
417
- useReadingStyles();
418
- return /* @__PURE__ */ jsx("div", { "aria-hidden": "true", style: { display: "flex", flexDirection: "column", gap: "6px" }, children: [0, 1, 2].map((n) => /* @__PURE__ */ jsxs("div", { class: "today-pulse", style: { display: "flex", alignItems: "center", gap: "12px", padding: "10px 12px", borderRadius: "10px", background: "var(--elev)", border: "1px solid var(--hair)", animationDelay: `${n * 0.15}s` }, children: [
419
- /* @__PURE__ */ jsx("div", { style: { width: "30px", height: "30px", borderRadius: "8px", background: "var(--hair)" } }),
420
- /* @__PURE__ */ jsxs("div", { style: { flex: 1, display: "flex", flexDirection: "column", gap: "6px" }, children: [
421
- /* @__PURE__ */ jsx("div", { style: { height: "9px", width: `${70 - n * 12}%`, borderRadius: "5px", background: "var(--hair)" } }),
422
- /* @__PURE__ */ jsx("div", { style: { height: "8px", width: "35%", borderRadius: "5px", background: "var(--hair)" } })
423
- ] })
424
- ] }, n)) });
425
- }
426
- function ProblemRow({ group, acting, details = false }) {
427
- const mine = acting.retrying === group.account;
428
- return /* @__PURE__ */ jsxs("div", { role: "alert", title: group.reasons.join("\n"), style: { padding: "7px 10px", borderRadius: "10px", fontSize: "12px", color: "var(--ink-2)", background: soft("--orange", 10), border: `1px solid ${soft("--orange", 35)}` }, children: [
429
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
430
- /* @__PURE__ */ jsx("span", { style: { color: "var(--orange)" }, children: "\u26A0" }),
431
- /* @__PURE__ */ jsx("span", { style: { minWidth: 0, overflowWrap: "anywhere" }, children: groupLine(group) }),
432
- /* @__PURE__ */ jsxs("span", { style: { marginLeft: "auto", display: "flex", gap: "8px", flexShrink: 0 }, children: [
433
- /* @__PURE__ */ jsx(Btn, { label: mine ? "Reading\u2026" : "Retry", disabled: acting.busy, onClick: () => acting.retry(group.account) }),
434
- /* @__PURE__ */ jsx(Btn, { label: "Reconnect", style: ghostStyle, disabled: acting.busy, onClick: () => acting.reconnect(group.account) })
435
- ] })
436
- ] }),
437
- details && /* @__PURE__ */ jsx("ul", { style: { margin: "6px 0 0 22px", padding: 0, color: "var(--ink-3)", fontSize: "11.5px" }, children: group.reasons.map((r) => /* @__PURE__ */ jsx("li", { children: r }, r)) })
438
- ] });
439
- }
440
460
 
441
461
  // src/banner.tsx
442
462
  import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "preact/jsx-runtime";
443
- var pill = { display: "flex", alignItems: "center", gap: "6px", fontSize: "11.5px", color: "var(--ink-2)", padding: "3px 9px", borderRadius: "20px", background: "var(--elev)", border: "1px solid var(--hair)" };
444
- function Count({ token, n, label }) {
445
- if (n === 0) return null;
446
- return /* @__PURE__ */ jsxs2("span", { style: pill, children: [
447
- /* @__PURE__ */ jsx2("i", { style: { width: "7px", height: "7px", borderRadius: "50%", background: `var(${token})` } }),
448
- n,
449
- " ",
450
- label
451
- ] });
452
- }
453
- function FilterChip({ label, n, on, token, onClick }) {
454
- const tint = token ?? "--blue";
455
- return /* @__PURE__ */ jsxs2("button", { type: "button", "aria-pressed": on, onClick, style: { ...pill, font: "inherit", fontSize: "11.5px", cursor: "pointer", color: on ? "var(--ink)" : "var(--ink-2)", borderColor: on ? `var(${tint})` : "var(--hair)", background: on ? soft(tint, 15) : "var(--elev)" }, children: [
456
- token && /* @__PURE__ */ jsx2("i", { style: { width: "7px", height: "7px", borderRadius: "50%", background: `var(${token})` } }),
457
- label,
458
- " \xB7 ",
459
- n
460
- ] });
461
- }
462
- var live = (items) => items.filter((i) => i.state !== "dismissed");
463
- var done = (items, pick) => items.filter((i) => i.state === "done" && pick(i.kind)).length;
464
463
  function shell(children) {
465
- return /* @__PURE__ */ jsx2("div", { style: { position: "relative", borderRadius: "16px", padding: "1px", background: `linear-gradient(135deg, ${soft("--blue", 55)}, ${soft("--purple", 40)} 45%, var(--hair) 80%)`, boxShadow: `0 10px 40px ${soft("--blue", 10)}` }, children: /* @__PURE__ */ jsx2("div", { style: { borderRadius: "15px", background: "radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--blue) 14%, var(--card)) 0%, var(--card) 55%)" }, children }) });
466
- }
467
- var PENDING_SHOWN = 5;
468
- function PendingFold({ pending, projects, acting, forge }) {
469
- const [open, setOpen] = useState2(false);
470
- if (pending.length === 0) return null;
471
- return /* @__PURE__ */ jsxs2("div", { style: { marginTop: "10px" }, children: [
472
- /* @__PURE__ */ jsxs2("button", { type: "button", "aria-expanded": open, onClick: () => setOpen(!open), style: { font: "inherit", fontSize: "12px", fontWeight: 600, padding: 0, border: 0, background: "none", cursor: "pointer", color: "var(--ink-2)" }, children: [
473
- open ? "\u25BE" : "\u25B8",
474
- " Pending \xB7 ",
475
- pending.length
476
- ] }),
477
- open && /* @__PURE__ */ jsxs2("div", { style: { display: "flex", flexDirection: "column", gap: "6px", marginTop: "8px" }, children: [
478
- pending.slice(0, PENDING_SHOWN).map((p) => /* @__PURE__ */ jsx2(PendingRow, { item: p, projects, acting, forge, compact: true }, p.id)),
479
- /* @__PURE__ */ jsx2("div", { children: /* @__PURE__ */ jsx2(Btn, { label: "See all \u2192", style: ghostStyle, onClick: () => forge.openPage() }) })
480
- ] })
481
- ] });
464
+ return /* @__PURE__ */ jsx2("div", { style: { position: "relative", borderRadius: "14px", padding: "1px", background: `linear-gradient(135deg, ${soft("--blue", 55)}, ${soft("--purple", 40)} 45%, var(--hair) 80%)`, boxShadow: `0 8px 30px ${soft("--blue", 8)}` }, children: /* @__PURE__ */ jsx2("div", { style: { borderRadius: "13px", background: "radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--blue) 12%, var(--card)) 0%, var(--card) 55%)" }, children }) });
482
465
  }
483
466
  function Strip({ title, children, actions, below }) {
484
467
  return shell(
485
468
  /* @__PURE__ */ jsxs2(Fragment2, { children: [
486
- /* @__PURE__ */ jsxs2("div", { style: { display: "flex", alignItems: "center", gap: "10px", padding: "9px 16px", fontSize: "12.5px", color: "var(--ink-2)" }, children: [
469
+ /* @__PURE__ */ jsxs2("div", { style: { display: "flex", alignItems: "center", gap: "10px", padding: "8px 14px", fontSize: "12.5px", color: "var(--ink-2)", flexWrap: "wrap" }, children: [
487
470
  /* @__PURE__ */ jsx2("span", { style: { color: "var(--orange)" }, children: "\u2600\uFE0E" }),
488
471
  /* @__PURE__ */ jsx2("b", { style: { color: "var(--ink)", fontWeight: 600 }, children: title }),
489
472
  children,
490
473
  /* @__PURE__ */ jsx2("span", { style: { marginLeft: "auto", display: "flex", gap: "8px" }, children: actions })
491
474
  ] }),
492
- below && /* @__PURE__ */ jsx2("div", { style: { padding: "0 16px 10px" }, children: below })
475
+ below && /* @__PURE__ */ jsx2("div", { style: { padding: "0 10px 8px" }, children: below })
493
476
  ] })
494
477
  );
495
478
  }
479
+ var small = { ...ghostStyle, border: "1px solid var(--hair-2)", fontSize: "11.5px", padding: "2px 8px", color: "var(--ink)" };
480
+ var linkStyle = { font: "inherit", fontSize: "inherit", padding: 0, border: 0, background: "none", cursor: "pointer" };
496
481
  function Banner({ forge }) {
497
482
  const { reply, error, reload, hurry } = useDigest(forge);
498
483
  const projects = useProjects(forge);
499
- const [chosen, choose] = useAccountFilter();
500
484
  const digest = reply?.digest;
501
- const allPending = reply?.pending ?? [];
502
- const pendingText = (list) => list.length ? ` \xB7 ${list.length} pending` : "";
503
485
  const acting = useActing(forge, digest?.date, reload, hurry);
504
486
  const reading = reply?.reading;
505
487
  const isReading = acting.refreshing || !!reading;
@@ -508,112 +490,59 @@ function Banner({ forge }) {
508
490
  "\xB7 ",
509
491
  text
510
492
  ] });
511
- const notes = notesLine(digest?.notes);
512
- const note = notes && /* @__PURE__ */ jsxs2("span", { style: { color: "var(--ink-3)" }, children: [
513
- "\xB7 ",
514
- notes
515
- ] });
516
- const problems = groupProblems(digest?.problems ?? []);
517
- const problemRows = problems.length > 0 && /* @__PURE__ */ jsx2("div", { style: { display: "flex", flexDirection: "column", gap: "6px", marginBottom: "8px" }, children: problems.map((g) => /* @__PURE__ */ jsx2(ProblemRow, { group: g, acting }, g.account)) });
518
- const problemsLink = problems.length > 0 && /* @__PURE__ */ jsxs2("button", { type: "button", onClick: () => forge.openPage(), style: { font: "inherit", fontSize: "inherit", padding: 0, border: 0, background: "none", cursor: "pointer", color: "var(--orange)" }, children: [
519
- "\xB7 ",
520
- problemsLabel(problems.length)
521
- ] });
522
493
  if (!reply && !error) return null;
523
494
  if (reply && !reply.enabled) {
524
495
  return /* @__PURE__ */ jsx2(Strip, { title: "Today", actions: /* @__PURE__ */ jsx2(Btn, { label: "Turn on", style: primaryStyle, disabled: acting.busy, onClick: () => acting.run(() => forge.action("enable")) }), children: /* @__PURE__ */ jsx2("span", { children: "\xB7 Linear, Slack and GitHub each morning" }) });
525
496
  }
526
- if (reply && isReading && (!digest || digest.items.length === 0)) {
527
- return shell(
528
- /* @__PURE__ */ jsxs2("div", { style: { padding: "14px 18px", display: "flex", flexDirection: "column", gap: "12px" }, children: [
529
- /* @__PURE__ */ jsxs2("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
530
- /* @__PURE__ */ jsx2("span", { style: { color: "var(--orange)" }, children: "\u2600\uFE0E" }),
531
- /* @__PURE__ */ jsx2(ReadingLine, { reading }),
532
- /* @__PURE__ */ jsx2("span", { style: { marginLeft: "auto" }, children: refreshBtn })
533
- ] }),
534
- !digest && /* @__PURE__ */ jsx2(SkeletonRows, {}),
535
- problemRows
536
- ] })
537
- );
497
+ if (reply && isReading && !digest) {
498
+ return /* @__PURE__ */ jsx2(Strip, { title: "Today", actions: refreshBtn, children: /* @__PURE__ */ jsx2(ReadingLine, { reading }) });
538
499
  }
539
- if (!reply || !digest || digest.items.length === 0) {
540
- return /* @__PURE__ */ jsxs2(Strip, { title: reply && !digest ? "Not read yet" : shortDay(/* @__PURE__ */ new Date(), digest?.date), actions: refreshBtn, below: reply && /* @__PURE__ */ jsx2(PendingFold, { pending: allPending, projects, acting, forge }), children: [
541
- !reply ? failure(loadFailedLine(error)) : digest?.error ? failure(failedLine(digest.error)) : digest && /* @__PURE__ */ jsxs2("span", { children: [
542
- "\xB7 ",
543
- reply.firstReading ? FIRST_READING_NOTE : `nothing new since ${clock(new Date(digest.readAt))}`,
544
- pendingText(allPending)
545
- ] }),
546
- problemsLink,
547
- note
548
- ] });
500
+ if (!reply || !digest) {
501
+ return /* @__PURE__ */ jsx2(Strip, { title: "Not read yet", actions: refreshBtn, children: error ? failure(loadFailedLine(error)) : /* @__PURE__ */ jsx2("span", { children: "\xB7 use Refresh to read now" }) });
549
502
  }
550
- const items = digest.items;
551
- const accounts = accountsOf(items);
552
- const account = accounts.includes(chosen) ? chosen : "";
553
- const seen = (list) => inAccount(list, account);
554
- const shown = seen(live(items));
555
- const folded = foldedNow(reply.folded, items);
556
- const fold = (value) => acting.run(() => forge.action("fold", { date: digest.date, folded: value }));
557
- if (folded) {
558
- return /* @__PURE__ */ jsxs2(Strip, { title: shortDay(/* @__PURE__ */ new Date(), digest.date), actions: /* @__PURE__ */ jsxs2(Fragment2, { children: [
559
- refreshBtn,
560
- /* @__PURE__ */ jsx2(Btn, { label: "See all \u2192", style: ghostStyle, onClick: () => forge.openPage() })
561
- ] }), below: /* @__PURE__ */ jsx2(PendingFold, { pending: pendingIn(allPending, account), projects, acting, forge }), children: [
562
- /* @__PURE__ */ jsxs2("span", { children: [
563
- "\xB7 ",
564
- done(items, startsTask),
565
- " started \xB7 ",
566
- done(items, (k) => k === "research"),
567
- " researching \xB7 ",
568
- done(items, (k) => k === "to-task"),
569
- " sent",
570
- pendingText(pendingIn(allPending, account))
503
+ const pending = reply.pending ?? [];
504
+ const summary = bannerSummary(digest.items, pending);
505
+ const rows = urgentRows(digest.items, pending);
506
+ const needing = inboxGroups(digest.items.filter((i) => i.state !== "dismissed"), pending).find((g) => g.id === "needs")?.entries.length ?? 0;
507
+ const problems = groupProblems(digest.problems ?? []);
508
+ const notes = notesLine(digest.notes);
509
+ const status = [isReading ? null : readLine(digest), reply.firstReading ? FIRST_READING_NOTE : null, notes].filter(Boolean).join(" \xB7 ");
510
+ const statusLine = /* @__PURE__ */ jsxs2("div", { style: { display: "flex", alignItems: "center", gap: "8px", fontSize: "11.5px", color: "var(--ink-3)", padding: "2px 6px 0", minWidth: 0 }, children: [
511
+ isReading ? /* @__PURE__ */ jsx2(ReadingLine, { reading }) : /* @__PURE__ */ jsx2("span", { title: status, style: { minWidth: 0, flexShrink: 1, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: status }),
512
+ digest.error && /* @__PURE__ */ jsx2("span", { style: { color: "var(--red)" }, children: failedLine(digest.error) }),
513
+ problems.length === 1 && /* @__PURE__ */ jsxs2("span", { role: "alert", title: problems[0].reasons.join("\n"), style: { display: "inline-flex", alignItems: "center", gap: "6px", color: "var(--ink-2)" }, children: [
514
+ /* @__PURE__ */ jsx2("span", { style: { color: "var(--orange)" }, children: "\u26A0" }),
515
+ groupLine(problems[0]),
516
+ /* @__PURE__ */ jsx2(Btn, { label: acting.retrying === problems[0].account ? "Reading\u2026" : "Retry", style: small, disabled: acting.busy, onClick: () => acting.retry(problems[0].account) }),
517
+ /* @__PURE__ */ jsx2(Btn, { label: "Reconnect", style: { ...small, ...ghostStyle, padding: "2px 8px" }, disabled: acting.busy, onClick: () => acting.reconnect(problems[0].account) })
518
+ ] }),
519
+ problems.length > 1 && /* @__PURE__ */ jsxs2("button", { type: "button", onClick: () => forge.openPage(), style: { ...linkStyle, color: "var(--orange)" }, children: [
520
+ problemsLabel(problems.length),
521
+ " \xB7 Fix on Today \u2192"
522
+ ] })
523
+ ] });
524
+ return /* @__PURE__ */ jsxs2(
525
+ Strip,
526
+ {
527
+ title: shortDay(/* @__PURE__ */ new Date(), digest.date),
528
+ actions: refreshBtn,
529
+ below: /* @__PURE__ */ jsxs2("div", { style: { display: "flex", flexDirection: "column", gap: "2px" }, children: [
530
+ rows.map((r) => r.kind === "pending" ? /* @__PURE__ */ jsx2(PendingRow, { item: r.item, projects, acting, forge }, r.item.id) : /* @__PURE__ */ jsx2(Row, { item: r.item, projects, acting, forge }, r.item.id)),
531
+ statusLine
571
532
  ] }),
572
- digest.error && failure(failedLine(digest.error)),
573
- problemsLink,
574
- note
575
- ] });
576
- }
577
- const waiting = seen(items).filter((i) => i.state === "proposed" || i.state === "failed");
578
- const ready = waiting.filter((i) => opFor(i)).length;
579
- const acceptAll = () => acting.run(() => forge.action("accept-all", { date: digest.date, ...account ? { account } : {} }));
580
- return shell(
581
- /* @__PURE__ */ jsxs2("div", { style: { padding: "16px 18px 12px" }, children: [
582
- /* @__PURE__ */ jsxs2("div", { style: { display: "flex", alignItems: "center", gap: "12px" }, children: [
583
- /* @__PURE__ */ jsx2("div", { style: { width: "34px", height: "34px", borderRadius: "10px", display: "grid", placeItems: "center", background: "linear-gradient(160deg, #ffb340, #ff7a1a)", boxShadow: "0 4px 14px rgba(255, 140, 30, .35)", fontSize: "17px" }, children: "\u2600\uFE0E" }),
584
- /* @__PURE__ */ jsxs2("div", { children: [
585
- /* @__PURE__ */ jsx2("h3", { style: { margin: 0, fontSize: "15px", fontWeight: 650, letterSpacing: "-.01em" }, children: dayLabel(/* @__PURE__ */ new Date(), digest.date) }),
586
- /* @__PURE__ */ jsx2("div", { style: { color: "var(--ink-2)", fontSize: "12px", marginTop: "1px" }, children: isReading ? /* @__PURE__ */ jsx2(ReadingLine, { reading }) : readLine(digest) })
533
+ children: [
534
+ /* @__PURE__ */ jsxs2("span", { children: [
535
+ "\xB7 ",
536
+ summaryText(summary),
537
+ " \xB7"
587
538
  ] }),
588
- /* @__PURE__ */ jsxs2("div", { style: { marginLeft: "auto", display: "flex", gap: "8px" }, children: [
589
- refreshBtn,
590
- /* @__PURE__ */ jsx2(Btn, { label: "Fold \u2303", style: ghostStyle, disabled: acting.busy, onClick: () => fold(true) }),
591
- ready > 0 && /* @__PURE__ */ jsx2(Btn, { label: `Accept ${ready === 1 ? "it" : `the ${ready}`}`, style: primaryStyle, disabled: acting.busy, onClick: acceptAll })
592
- ] })
593
- ] }),
594
- accounts.length > 1 && /* @__PURE__ */ jsxs2("div", { role: "group", "aria-label": "Account", style: { display: "flex", gap: "6px", marginTop: "12px", flexWrap: "wrap" }, children: [
595
- /* @__PURE__ */ jsx2(FilterChip, { label: "All", n: live(items).length, on: !account, onClick: () => choose("") }),
596
- accounts.map((a) => /* @__PURE__ */ jsx2(FilterChip, { label: a, token: accountToken(a), n: inAccount(live(items), a).length, on: account === a, onClick: () => choose(a) }, a))
597
- ] }),
598
- /* @__PURE__ */ jsxs2("div", { style: { display: "flex", gap: "6px", margin: "14px 0 10px", flexWrap: "wrap" }, children: [
599
- /* @__PURE__ */ jsx2(Count, { token: "--orange", n: shown.filter((i) => i.kind === "to-task").length, label: "for open tasks" }),
600
- /* @__PURE__ */ jsx2(Count, { token: "--green", n: shown.filter((i) => i.kind === "issue" || i.kind === "request").length, label: "new tasks" }),
601
- /* @__PURE__ */ jsx2(Count, { token: "--blue", n: shown.filter((i) => i.kind === "review").length, label: "to review" }),
602
- /* @__PURE__ */ jsx2(Count, { token: "--purple", n: shown.filter((i) => i.kind === "research").length, label: "researching" }),
603
- /* @__PURE__ */ jsxs2("span", { style: { ...pill, marginLeft: "auto", borderColor: "transparent", background: "none", color: "var(--ink-3)" }, children: [
604
- seen(items).length,
605
- " read \xB7 ",
606
- seen(items).length - shown.length,
607
- " dismissed"
608
- ] })
609
- ] }),
610
- digest.error && /* @__PURE__ */ jsx2("div", { style: { marginBottom: "8px", fontSize: "11.5px", color: "var(--red)" }, children: failedLine(digest.error) }),
611
- notes && /* @__PURE__ */ jsx2("div", { style: { marginBottom: "8px", fontSize: "11.5px", color: "var(--ink-3)" }, children: notes }),
612
- problemRows,
613
- /* @__PURE__ */ jsx2("div", { style: { display: "flex", flexDirection: "column", gap: "6px" }, children: shown.map((i) => /* @__PURE__ */ jsx2(Row, { item: i, projects, acting, forge }, i.id)) }),
614
- /* @__PURE__ */ jsx2(PendingFold, { pending: pendingIn(allPending, account), projects, acting, forge }),
615
- /* @__PURE__ */ jsx2("div", { style: { marginTop: "10px", fontSize: "11.5px", color: "var(--ink-3)" }, children: "Research starts on its own (limited per day). The rest waits for your ok." })
616
- ] })
539
+ /* @__PURE__ */ jsx2("button", { type: "button", onClick: () => forge.openPage(), style: { ...linkStyle, fontWeight: 600, color: "var(--blue)" }, children: "Open Today \u2192" }),
540
+ needing > 0 && /* @__PURE__ */ jsx2("button", { type: "button", onClick: () => {
541
+ requestStartDay();
542
+ forge.openPage();
543
+ }, style: { ...linkStyle, fontWeight: 600, color: "var(--purple)" }, children: "Start the day \u2192" })
544
+ ]
545
+ }
617
546
  );
618
547
  }
619
548
  var banner_default = definePanel({ id: "banner", title: "Today", component: Banner });