forge-cw 0.1.28 → 0.1.29

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.
@@ -7,7 +7,6 @@ import { definePanel } from "@forge-dev/sdk";
7
7
  var errorMessage = (e) => e instanceof Error ? e.message : String(e);
8
8
  var STARTS = ["issue", "request", "review"];
9
9
  var startsTask = (kind) => STARTS.includes(kind);
10
- var inAccount = (items, account) => account ? items.filter((i) => i.account === account) : items;
11
10
  function opFor(item, project) {
12
11
  if (item.kind === "to-task") return item.targetSession ? "send" : null;
13
12
  if (item.kind === "research") return "research";
@@ -19,7 +18,10 @@ function projectsFor({ names, owners }, account) {
19
18
  }
20
19
  var failedLine = (error) => `Last reading failed: ${error}`;
21
20
  var loadFailedLine = (error) => `Can't load Today: ${error}`;
22
- var notesLine = (notes) => notes?.length ? notes.join(" \xB7 ") : null;
21
+ var GH_SIGNED_OUT = "GitHub: gh is not signed in (run gh auth login)";
22
+ function tidyNotes(notes) {
23
+ return [...new Set(notes.map((n) => /^github\b[^:]*:/i.test(n) && /gh auth login|GH_TOKEN/i.test(n) ? GH_SIGNED_OUT : n))];
24
+ }
23
25
  var SOURCE_NAME = { slack: "Slack", linear: "Linear", reader: "Reader" };
24
26
  function sourcesLabel(sources) {
25
27
  const names = ["slack", "linear", "reader"].filter((s) => sources.includes(s)).map((s) => SOURCE_NAME[s]);
@@ -33,25 +35,6 @@ function groupProblems(problems) {
33
35
  });
34
36
  }
35
37
  var groupLine = (g) => `${g.account} \xB7 ${g.label} did not respond`;
36
- var GROUPS = [
37
- { title: "In open tasks", pick: (i) => i.kind === "to-task" },
38
- { title: "New", pick: (i) => i.kind === "issue" || i.kind === "request" },
39
- { title: "To review", pick: (i) => i.kind === "review" },
40
- { title: "Researching", pick: (i) => i.kind === "research" }
41
- ];
42
- function sections(all) {
43
- const live = all.filter((i) => i.state !== "dismissed");
44
- const groups = GROUPS.map((g) => ({ title: g.title, items: live.filter(g.pick) }));
45
- return [...groups, { title: "Dismissed", items: all.filter((i) => i.state === "dismissed") }].filter((g) => g.items.length > 0);
46
- }
47
- var accountsOf = (items) => [...new Set(items.flatMap((i) => i.account ? [i.account] : []))];
48
- function byAccount(items) {
49
- const accounts = accountsOf(items);
50
- if (accounts.length < 2) return [{ sections: sections(items) }];
51
- const blocks = accounts.map((account) => ({ account, sections: sections(inAccount(items, account)) }));
52
- const rest = items.filter((i) => !i.account);
53
- return rest.length ? [...blocks, { sections: sections(rest) }] : blocks;
54
- }
55
38
  function titleFor(i) {
56
39
  if (!i.issueKey) return i.title;
57
40
  const key = i.issueKey.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
@@ -63,19 +46,77 @@ function whoOf(i) {
63
46
  const who = i.who.trim();
64
47
  return !who || who.toLowerCase() === SOURCE_NAMES[i.source].toLowerCase() ? null : who;
65
48
  }
66
- var pendingLabel = (p) => p.kind === "ci" ? "CI failing" : p.kind === "review" ? "Review requested" : p.source === "linear" ? p.started ? "In progress" : "To do" : "Assigned";
67
- var pendingIn = (items, account) => account ? items.filter((p) => p.account === account) : items;
68
- function pendingByAccount(items) {
69
- const accounts = [...new Set(items.flatMap((p) => p.account ? [p.account] : []))];
70
- if (accounts.length < 2) return items.length ? [{ items }] : [];
71
- const blocks = accounts.map((account) => ({ account, items: pendingIn(items, account) }));
72
- const rest = items.filter((p) => !p.account);
73
- return rest.length ? [...blocks, { items: rest }] : blocks;
74
- }
75
49
  var CAPPED_NOTE = "showing the latest 20";
76
50
  var GITHUB_SEARCH = "https://github.com/pulls/review-requested";
77
51
  var PENDING_EMPTY = "Nothing open \u2014 nice.";
78
52
  var FIRST_READING_NOTE = "First reading \u2014 what you have open is under Pending.";
53
+ var NO_FILTERS = { account: "", source: "", query: "" };
54
+ var NO_ACCOUNT = "__none__";
55
+ var SOURCE_IDS = ["linear", "slack", "github"];
56
+ function parseFilters(raw) {
57
+ try {
58
+ const v = JSON.parse(raw ?? "");
59
+ if (!isRecord(v)) return NO_FILTERS;
60
+ return {
61
+ account: typeof v.account === "string" ? v.account : "",
62
+ source: SOURCE_IDS.includes(v.source) ? v.source : "",
63
+ query: typeof v.query === "string" ? v.query : ""
64
+ };
65
+ } catch {
66
+ return NO_FILTERS;
67
+ }
68
+ }
69
+ function isRecord(v) {
70
+ return typeof v === "object" && v !== null && !Array.isArray(v);
71
+ }
72
+ function matchesQuery(x, query) {
73
+ const q = query.trim().toLowerCase();
74
+ if (!q) return true;
75
+ return [x.title, x.issueKey, x.who, x.where, x.repo].some((f) => !!f && f.toLowerCase().includes(q));
76
+ }
77
+ function passes(x, f, skip) {
78
+ return (skip === "account" || !f.account || (f.account === NO_ACCOUNT ? !x.account : x.account === f.account)) && (skip === "source" || !f.source || x.source === f.source) && matchesQuery(x, f.query);
79
+ }
80
+ var filterNews = (items, f) => items.filter((i) => passes(i, f));
81
+ var filterPending = (items, f) => items.filter((p) => passes(p, f));
82
+ function newsList(items) {
83
+ const waiting = (i) => i.state === "proposed" || i.state === "failed" ? 0 : 1;
84
+ return items.filter((i) => i.state !== "dismissed").sort((a, b) => waiting(a) - waiting(b) || Date.parse(b.when) - Date.parse(a.when));
85
+ }
86
+ function countFor(news, pending, f) {
87
+ const all = [...news, ...pending];
88
+ const accounts = {};
89
+ let noAccount = 0;
90
+ for (const x of all.filter((x2) => passes(x2, f, "account"))) {
91
+ if (x.account) accounts[x.account] = (accounts[x.account] ?? 0) + 1;
92
+ else noAccount++;
93
+ }
94
+ const sources = { linear: 0, slack: 0, github: 0 };
95
+ for (const x of all.filter((x2) => passes(x2, f, "source"))) sources[x.source]++;
96
+ return { total: all.filter((x) => passes(x, f, "account")).length, accounts, noAccount, sources };
97
+ }
98
+ var PENDING_GROUPS = [
99
+ { id: "ci", title: "CI failing", pick: (p) => p.kind === "ci" },
100
+ { id: "slack", title: "Slack waiting on you", pick: (p) => p.kind === "reply" },
101
+ { id: "review", title: "Review requests", pick: (p) => p.kind === "review" },
102
+ { id: "progress", title: "Linear in progress", pick: (p) => p.source === "linear" && !!p.started },
103
+ { id: "issues", title: "Issues assigned", pick: (p) => p.source === "github" && p.kind === "issue" },
104
+ { id: "todo", title: "Linear to do", pick: (p) => p.source === "linear" && !p.started, folded: true }
105
+ ];
106
+ function groupPending(items) {
107
+ return PENDING_GROUPS.map((g) => ({ id: g.id, title: g.title, folded: !!g.folded, items: items.filter(g.pick) })).filter((g) => g.items.length > 0);
108
+ }
109
+ var isGroupFolded = (g, saved) => saved[g.id] ?? g.folded;
110
+ function ageShort(iso, now = /* @__PURE__ */ new Date()) {
111
+ const min = Math.max(0, Math.round((now.getTime() - Date.parse(iso)) / 6e4));
112
+ if (Number.isNaN(min)) return "";
113
+ if (min < 1) return "now";
114
+ if (min < 60) return `${min}m`;
115
+ if (min < 48 * 60) return `${Math.round(min / 60)}h`;
116
+ return `${Math.round(min / 1440)}d`;
117
+ }
118
+ var safeHref = (link) => /^https?:\/\//i.test(link) ? link : void 0;
119
+ var acceptable = (news) => news.filter((i) => i.state === "proposed" && opFor(i));
79
120
 
80
121
  // src/rows.tsx
81
122
  import { useCallback, useEffect, useRef, useState } from "preact/hooks";
@@ -93,6 +134,33 @@ function AccountChip({ account }) {
93
134
  const token = accountToken(account);
94
135
  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 });
95
136
  }
137
+ var FILTERS_KEY = "today.filters";
138
+ var FOLDS_KEY = "today.folds";
139
+ function useStored(key, read, empty) {
140
+ const [value, setValue] = useState(() => {
141
+ try {
142
+ return read(localStorage.getItem(key));
143
+ } catch {
144
+ return empty;
145
+ }
146
+ });
147
+ const set = (next) => {
148
+ setValue(next);
149
+ try {
150
+ localStorage.setItem(key, JSON.stringify(next));
151
+ } catch {
152
+ }
153
+ };
154
+ return [value, set];
155
+ }
156
+ var useFilters = () => useStored(FILTERS_KEY, parseFilters, NO_FILTERS);
157
+ function useFolds() {
158
+ const [folds, set] = useStored(FOLDS_KEY, (raw) => {
159
+ const v = JSON.parse(raw ?? "{}");
160
+ return typeof v === "object" && v !== null && !Array.isArray(v) ? Object.fromEntries(Object.entries(v).filter(([, f]) => typeof f === "boolean")) : {};
161
+ }, {});
162
+ return [folds, (id, folded) => set({ ...folds, [id]: folded })];
163
+ }
96
164
  function useDigest(forge, path = "/digest") {
97
165
  const [reply, setReply] = useState(null);
98
166
  const [error, setError] = useState(null);
@@ -158,6 +226,9 @@ function useActing(forge, date, reload, hurry = () => {
158
226
  const startPending = (item, project) => run(async () => {
159
227
  await forge.action("pending-start", { id: item.id, ...project ? { project } : {} });
160
228
  });
229
+ const researchPending = (item) => run(async () => {
230
+ await forge.action("pending-research", { id: item.id });
231
+ });
161
232
  const hidePending = (item) => run(async () => {
162
233
  await forge.action("pending-hide", { id: item.id });
163
234
  });
@@ -185,20 +256,12 @@ function useActing(forge, date, reload, hurry = () => {
185
256
  const s = await forge.action("reconnect", { account });
186
257
  if (s) forge.openSession(s.project, s.sessionDir);
187
258
  });
188
- return { busy, refreshing, retrying, retry, reconnect, run, act, refresh, startPending, hidePending };
259
+ return { busy, refreshing, retrying, retry, reconnect, run, act, refresh, startPending, researchPending, hidePending };
189
260
  }
190
261
  function dayOf(date) {
191
262
  const [y, m, d] = date.split("-").map(Number);
192
263
  return new Date(y, m - 1, d);
193
264
  }
194
- var isToday = (date, now) => dayOf(date).toDateString() === now.toDateString();
195
- function dayLabel(now, date) {
196
- const day = dayOf(date);
197
- if (!isToday(date, now)) return `From ${day.toLocaleDateString("en-US", { weekday: "long" })} ${day.getDate()}`;
198
- const hour = now.getHours();
199
- const part = hour < 12 ? "Good morning" : hour < 19 ? "Good afternoon" : "Good evening";
200
- return `${part} \xB7 your ${now.toLocaleDateString("en-US", { weekday: "long" })} ${now.getDate()}`;
201
- }
202
265
  var clock = (d) => d.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit" });
203
266
  function windowTime(at, read) {
204
267
  if (at.toDateString() === read.toDateString()) return clock(at);
@@ -213,18 +276,10 @@ function dayName(date) {
213
276
  const day = dayOf(date);
214
277
  return `${day.toLocaleDateString("en-US", { weekday: "long" })} ${day.getDate()}`;
215
278
  }
216
- function ago(iso, now = /* @__PURE__ */ new Date()) {
217
- const t = new Date(iso);
218
- const min = Math.round((now.getTime() - t.getTime()) / 6e4);
219
- if (min < 1) return "just now";
220
- if (min < 60) return `${min} min ago`;
221
- if (min < 24 * 60) return `${Math.round(min / 60)} h ago`;
222
- return t.toLocaleDateString("en-US", { month: "short", day: "numeric" }) + " " + clock(t);
223
- }
224
279
  var SOURCE_LABEL = { linear: "Linear", slack: "Slack", github: "GitHub" };
225
280
  var SOURCE_TINT = { linear: "#5e6ad2 22%", slack: "#e01e5a 18%", github: "#8b949e 24%" };
226
281
  function SourceIcon({ source }) {
227
- 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: [
282
+ 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: [
228
283
  /* @__PURE__ */ jsx("path", { stroke: "#36c5f0", d: "M9 3.5v6" }),
229
284
  /* @__PURE__ */ jsx("path", { stroke: "#2eb67d", d: "M20.5 9h-6" }),
230
285
  /* @__PURE__ */ jsx("path", { stroke: "#ecb22e", d: "M15 20.5v-6" }),
@@ -276,127 +331,141 @@ function outcome(item) {
276
331
  where ? ` \xB7 ${where}` : ""
277
332
  ] });
278
333
  }
334
+ var sourceOf = (p) => SOURCE_LABEL[p.source];
335
+ var mono = { fontFamily: "var(--mono, ui-monospace, monospace)", fontSize: "11.5px", color: "var(--ink-2)", fontWeight: 500 };
336
+ function Line({ source, keyText, title, account, when, primary, children, dim }) {
337
+ const [open, setOpen] = useState(false);
338
+ 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: [
339
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px", padding: "4px 6px", minHeight: "30px" }, children: [
340
+ /* @__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: [
341
+ /* @__PURE__ */ jsx(SourceIcon, { source }),
342
+ /* @__PURE__ */ jsx("span", { style: { minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", fontWeight: 530 }, children: title }),
343
+ keyText && /* @__PURE__ */ jsx("span", { style: { ...mono, flexShrink: 0, marginLeft: "auto" }, children: keyText })
344
+ ] }),
345
+ account && /* @__PURE__ */ jsx("span", { style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx(AccountChip, { account }) }),
346
+ /* @__PURE__ */ jsx("span", { title: when, style: { fontSize: "11px", color: "var(--ink-3)", minWidth: "26px", textAlign: "right" }, children: ageShort(when) }),
347
+ primary && /* @__PURE__ */ jsx("span", { style: { display: "flex", alignItems: "center", gap: "6px", flexShrink: 0 }, children: primary })
348
+ ] }),
349
+ open && /* @__PURE__ */ jsx("div", { style: { padding: "2px 8px 9px 36px", display: "flex", flexDirection: "column", gap: "7px", fontSize: "11.5px", color: "var(--ink-2)" }, children })
350
+ ] });
351
+ }
352
+ var Quote = ({ text }) => /* @__PURE__ */ jsxs("div", { style: { fontSize: "12px", borderLeft: "2px solid var(--hair-2)", paddingLeft: "8px", fontStyle: "italic" }, children: [
353
+ "\u201C",
354
+ text,
355
+ "\u201D"
356
+ ] });
357
+ function OpenLink({ href, label }) {
358
+ const safe = safeHref(href);
359
+ 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: [
360
+ label,
361
+ " \u2197"
362
+ ] }) : null;
363
+ }
364
+ var Actions = ({ children }) => /* @__PURE__ */ jsx("div", { style: { display: "flex", alignItems: "center", gap: "8px", flexWrap: "wrap" }, children });
279
365
  var Row = ({ item, projects = EMPTY_PROJECTS, acting, forge }) => {
280
366
  const [project, setProject] = useState(item.project ?? "");
281
367
  const open = item.state === "proposed" || item.state === "failed";
282
368
  const needsProject = startsTask(item.kind) && !item.project;
283
369
  const op = opFor(item, project);
284
370
  const where = item.source === "slack" ? "in" : "on";
285
- 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: [
286
- /* @__PURE__ */ jsx(SourceIcon, { source: item.source }),
287
- /* @__PURE__ */ jsxs("div", { style: { minWidth: 0 }, children: [
288
- /* @__PURE__ */ jsxs("div", { style: { fontWeight: 560, fontSize: "13px", display: "flex", alignItems: "center", gap: "8px", minWidth: 0 }, children: [
289
- item.issueKey && /* @__PURE__ */ jsx("span", { style: { fontFamily: "var(--mono, ui-monospace, monospace)", fontSize: "11.5px", color: "var(--ink-2)", fontWeight: 500 }, children: item.issueKey }),
290
- /* @__PURE__ */ jsx("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: titleFor(item) })
291
- ] }),
292
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "6px", marginTop: "3px", fontSize: "11.5px", color: "var(--ink-2)", flexWrap: "wrap" }, children: [
293
- whoOf(item) && /* @__PURE__ */ jsx(Avatar, { who: item.who }),
294
- /* @__PURE__ */ jsx("span", { children: whoOf(item) ? /* @__PURE__ */ jsxs(Fragment, { children: [
295
- item.who,
296
- " ",
297
- where,
298
- " ",
299
- strong(item.where)
300
- ] }) : strong(item.where) }),
301
- /* @__PURE__ */ jsx(Sep, {}),
302
- /* @__PURE__ */ jsx("span", { children: ago(item.when) }),
303
- item.account && /* @__PURE__ */ jsxs(Fragment, { children: [
304
- /* @__PURE__ */ jsx(Sep, {}),
305
- /* @__PURE__ */ jsx(AccountChip, { account: item.account })
306
- ] }),
371
+ const s = item.startedSession;
372
+ const go = /* @__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) });
373
+ 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;
374
+ return /* @__PURE__ */ jsxs(Line, { source: item.source, keyText: item.issueKey, title: titleFor(item), account: item.account, when: item.when, primary, children: [
375
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "6px", flexWrap: "wrap" }, children: [
376
+ /* @__PURE__ */ jsx(KindPill, { kind: item.kind }),
377
+ whoOf(item) && /* @__PURE__ */ jsx(Avatar, { who: item.who }),
378
+ /* @__PURE__ */ jsx("span", { children: whoOf(item) ? /* @__PURE__ */ jsxs(Fragment, { children: [
379
+ item.who,
380
+ " ",
381
+ where,
382
+ " ",
383
+ strong(item.where)
384
+ ] }) : strong(item.where) }),
385
+ item.kind === "to-task" && item.targetSession && /* @__PURE__ */ jsxs(Fragment, { children: [
307
386
  /* @__PURE__ */ jsx(Sep, {}),
308
- /* @__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: [
309
- "View in ",
310
- SOURCE_LABEL[item.source],
311
- " \u2197"
312
- ] }),
313
- item.kind === "to-task" && item.targetSession && /* @__PURE__ */ jsxs(Fragment, { children: [
314
- /* @__PURE__ */ jsx(Sep, {}),
315
- /* @__PURE__ */ jsxs("span", { children: [
316
- "goes to ",
317
- strong(item.targetSession.sessionDir)
318
- ] })
319
- ] }),
320
- item.project && item.kind !== "to-task" && /* @__PURE__ */ jsxs(Fragment, { children: [
321
- /* @__PURE__ */ jsx(Sep, {}),
322
- /* @__PURE__ */ jsxs("span", { children: [
323
- "project ",
324
- strong(item.project)
325
- ] })
387
+ /* @__PURE__ */ jsxs("span", { children: [
388
+ "goes to ",
389
+ strong(item.targetSession.sessionDir)
326
390
  ] })
327
391
  ] }),
328
- 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: [
329
- "\u201C",
330
- item.quote,
331
- "\u201D"
332
- ] }),
333
- item.error && /* @__PURE__ */ jsx("div", { style: { marginTop: "6px", fontSize: "11.5px", color: "var(--red)" }, children: item.error })
392
+ item.project && item.kind !== "to-task" && /* @__PURE__ */ jsxs(Fragment, { children: [
393
+ /* @__PURE__ */ jsx(Sep, {}),
394
+ /* @__PURE__ */ jsxs("span", { children: [
395
+ "project ",
396
+ strong(item.project)
397
+ ] })
398
+ ] })
334
399
  ] }),
335
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
336
- /* @__PURE__ */ jsx(KindPill, { kind: item.kind }),
337
- open && needsProject && /* @__PURE__ */ jsx(ProjectPicker, { projects: projectsFor(projects, item.account), value: project, onChange: setProject }),
338
- 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) }),
339
- open && /* @__PURE__ */ jsx(Btn, { label: "Dismiss", style: ghostStyle, disabled: acting.busy, onClick: () => acting.act(item, "dismiss") }),
340
- item.state === "done" && outcome(item),
341
- item.state === "done" && item.startedSession && /* @__PURE__ */ jsx(Btn, { label: "Open session", onClick: () => forge.openSession(item.startedSession.project, item.startedSession.sessionDir) }),
342
- item.state === "dismissed" && /* @__PURE__ */ jsx("span", { style: { fontSize: "11.5px", color: "var(--ink-3)" }, children: "Dismissed" })
400
+ item.quote && /* @__PURE__ */ jsx(Quote, { text: item.quote }),
401
+ item.error && /* @__PURE__ */ jsx("div", { style: { color: "var(--red)" }, children: item.error }),
402
+ item.state === "done" && outcome(item),
403
+ /* @__PURE__ */ jsxs(Actions, { children: [
404
+ open && needsProject && /* @__PURE__ */ jsxs(Fragment, { children: [
405
+ /* @__PURE__ */ jsx(ProjectPicker, { projects: projectsFor(projects, item.account), value: project, onChange: setProject }),
406
+ go
407
+ ] }),
408
+ /* @__PURE__ */ jsx(OpenLink, { href: item.link, label: `Open in ${sourceOf(item)}` }),
409
+ open && /* @__PURE__ */ jsx(Btn, { label: "Dismiss", style: ghostStyle, disabled: acting.busy, onClick: () => acting.act(item, "dismiss") })
343
410
  ] })
344
411
  ] });
345
412
  };
346
- var PENDING_TOKEN = { ci: "--red", review: "--blue", issue: "--green" };
347
- var PendingRow = ({ item, projects = EMPTY_PROJECTS, acting, forge, compact }) => {
413
+ var PENDING_TOKEN = { ci: "--red", review: "--blue", issue: "--green", reply: "--purple" };
414
+ var PendingRow = ({ item, projects = EMPTY_PROJECTS, acting, forge }) => {
348
415
  const [project, setProject] = useState(item.project ?? "");
349
416
  const token = PENDING_TOKEN[item.kind];
350
417
  const target = item.project ?? project;
351
- 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: [
352
- /* @__PURE__ */ jsx(SourceIcon, { source: item.source }),
353
- /* @__PURE__ */ jsxs("div", { style: { minWidth: 0 }, children: [
354
- /* @__PURE__ */ jsxs("div", { style: { fontWeight: 560, fontSize: "13px", display: "flex", alignItems: "center", gap: "8px", minWidth: 0 }, children: [
355
- item.issueKey && /* @__PURE__ */ jsx("span", { style: { fontFamily: "var(--mono, ui-monospace, monospace)", fontSize: "11.5px", color: "var(--ink-2)", fontWeight: 500 }, children: item.issueKey }),
356
- /* @__PURE__ */ jsx("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: titleFor(item) })
418
+ const slack = item.kind === "reply";
419
+ const start = /* @__PURE__ */ jsx(Btn, { label: item.kind === "review" ? "Review" : "Start", disabled: acting.busy || !target, onClick: () => acting.startPending(item, item.project ? void 0 : project) });
420
+ const primary = item.targetSession ? /* @__PURE__ */ jsx(Btn, { label: "Open task", onClick: () => forge.openSession(item.targetSession.project, item.targetSession.sessionDir) }) : item.project ? start : null;
421
+ return /* @__PURE__ */ jsxs(Line, { source: item.source, keyText: item.issueKey, title: titleFor(item), account: item.account, when: item.when, primary, children: [
422
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "6px", flexWrap: "wrap" }, children: [
423
+ /* @__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 }),
424
+ slack ? /* @__PURE__ */ jsxs("span", { children: [
425
+ item.who,
426
+ " in ",
427
+ strong(item.where ?? "")
428
+ ] }) : /* @__PURE__ */ jsxs("span", { children: [
429
+ item.repo ? strong(item.repo) : null,
430
+ item.repo && item.state ? " \xB7 " : "",
431
+ item.state
357
432
  ] }),
358
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "6px", marginTop: "3px", fontSize: "11.5px", color: "var(--ink-2)", flexWrap: "wrap" }, children: [
359
- /* @__PURE__ */ jsxs("span", { children: [
360
- item.repo ? strong(item.repo) : null,
361
- item.repo && item.state ? " \xB7 " : "",
362
- item.state
363
- ] }),
364
- (item.repo || item.state) && /* @__PURE__ */ jsx(Sep, {}),
365
- /* @__PURE__ */ jsx("span", { children: ago(item.when) }),
366
- item.account && /* @__PURE__ */ jsxs(Fragment, { children: [
367
- /* @__PURE__ */ jsx(Sep, {}),
368
- /* @__PURE__ */ jsx(AccountChip, { account: item.account })
369
- ] }),
433
+ item.project && /* @__PURE__ */ jsxs(Fragment, { children: [
370
434
  /* @__PURE__ */ jsx(Sep, {}),
371
- /* @__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: [
372
- "View in ",
373
- SOURCE_LABEL[item.source],
374
- " \u2197"
375
- ] }),
376
- item.project && /* @__PURE__ */ jsxs(Fragment, { children: [
377
- /* @__PURE__ */ jsx(Sep, {}),
378
- /* @__PURE__ */ jsxs("span", { children: [
379
- "project ",
380
- strong(item.project)
381
- ] })
435
+ /* @__PURE__ */ jsxs("span", { children: [
436
+ "project ",
437
+ strong(item.project)
382
438
  ] })
383
439
  ] })
384
440
  ] }),
385
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
386
- /* @__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) }),
387
- item.targetSession ? /* @__PURE__ */ jsx(Btn, { label: "Open task", onClick: () => forge.openSession(item.targetSession.project, item.targetSession.sessionDir) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
388
- !item.project && /* @__PURE__ */ jsx(ProjectPicker, { projects: projectsFor(projects, item.account), value: project, onChange: setProject }),
389
- /* @__PURE__ */ jsx(Btn, { label: item.kind === "review" ? "Review" : "Start", disabled: acting.busy || !target, onClick: () => acting.startPending(item, item.project ? void 0 : project) })
441
+ item.quote && /* @__PURE__ */ jsx(Quote, { text: item.quote }),
442
+ /* @__PURE__ */ jsxs(Actions, { children: [
443
+ !item.targetSession && !item.project && /* @__PURE__ */ jsxs(Fragment, { children: [
444
+ /* @__PURE__ */ jsx(ProjectPicker, { projects: projectsFor(projects, item.account), value: project, onChange: setProject }),
445
+ start
390
446
  ] }),
447
+ /* @__PURE__ */ jsx(OpenLink, { href: item.link, label: `Open in ${sourceOf(item)}` }),
448
+ slack && !item.targetSession && /* @__PURE__ */ jsx(Btn, { label: "Research", style: ghostStyle, disabled: acting.busy, onClick: () => acting.researchPending(item) }),
391
449
  /* @__PURE__ */ jsx(Btn, { label: "Hide", style: ghostStyle, disabled: acting.busy, onClick: () => acting.hidePending(item) })
392
450
  ] })
393
451
  ] });
394
452
  };
453
+ function Pill({ label, n, on, token, onClick }) {
454
+ const tint = token ?? "--blue";
455
+ return /* @__PURE__ */ jsxs("button", { type: "button", "aria-pressed": on, onClick, style: { display: "inline-flex", alignItems: "center", gap: "6px", font: "inherit", fontSize: "11.5px", cursor: "pointer", padding: "3px 9px", borderRadius: "20px", color: on ? "var(--ink)" : "var(--ink-2)", border: `1px solid ${on ? `var(${tint})` : "var(--hair)"}`, background: on ? soft(tint, 15) : "var(--elev)" }, children: [
456
+ token && /* @__PURE__ */ jsx("i", { style: { width: "7px", height: "7px", borderRadius: "50%", background: `var(${token})` } }),
457
+ label,
458
+ " \xB7 ",
459
+ n
460
+ ] });
461
+ }
395
462
  var READING_CSS = `
396
463
  @keyframes today-spin { to { transform: rotate(360deg) } }
397
464
  @keyframes today-pulse { 0%, 100% { opacity: .55 } 50% { opacity: 1 } }
398
465
  .today-spin { animation: today-spin .8s linear infinite }
399
466
  .today-pulse { animation: today-pulse 1.4s ease-in-out infinite }
467
+ .today-cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 24px; align-items: start }
468
+ @media (max-width: 900px) { .today-cols { grid-template-columns: minmax(0, 1fr) } }
400
469
  @media (prefers-reduced-motion: reduce) { .today-spin, .today-pulse { animation: none } }`;
401
470
  function useReadingStyles() {
402
471
  if (typeof document !== "undefined" && !document.getElementById("today-reading-css")) {
@@ -446,82 +515,131 @@ function ProblemRow({ group, acting, details = false }) {
446
515
  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)) })
447
516
  ] });
448
517
  }
518
+ function Notes({ notes }) {
519
+ const [open, setOpen] = useState(false);
520
+ if (!notes?.length) return null;
521
+ const short = tidyNotes(notes);
522
+ return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "4px", fontSize: "12px", color: "var(--ink-3)" }, children: [
523
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "baseline", gap: "8px", minWidth: 0 }, children: [
524
+ /* @__PURE__ */ jsx("span", { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: short.join(" \xB7 ") }),
525
+ /* @__PURE__ */ jsx("button", { type: "button", "aria-expanded": open, onClick: () => setOpen(!open), style: { font: "inherit", fontSize: "11.5px", padding: 0, border: 0, background: "none", cursor: "pointer", color: "var(--ink-3)", flexShrink: 0 }, children: open ? "Hide details" : "Details" })
526
+ ] }),
527
+ open && /* @__PURE__ */ jsx("ul", { style: { margin: 0, paddingLeft: "18px" }, children: notes.map((n) => /* @__PURE__ */ jsx("li", { style: { overflowWrap: "anywhere" }, children: n }, n)) })
528
+ ] });
529
+ }
449
530
 
450
531
  // src/view.tsx
451
532
  import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "preact/jsx-runtime";
452
- var heading = { margin: "4px 0 0", fontSize: "13px", fontWeight: 650, letterSpacing: "-.01em" };
453
- var subheading = { margin: "4px 0", fontSize: "11px", fontWeight: 600, letterSpacing: ".06em", textTransform: "uppercase", color: "var(--ink-3)" };
533
+ var heading = { margin: 0, fontSize: "13px", fontWeight: 650, letterSpacing: "-.01em" };
534
+ var muted = { fontSize: "12.5px", color: "var(--ink-2)", padding: "4px 6px" };
535
+ var SOURCES = [{ id: "linear", label: "Linear" }, { id: "slack", label: "Slack" }, { id: "github", label: "GitHub" }];
454
536
  function View({ forge }) {
537
+ useReadingStyles();
455
538
  const [days, setDays] = useState2([]);
456
539
  const [day, setDay] = useState2(null);
457
540
  const { reply, error, reload, hurry } = useDigest(forge, day ? `/digest/${day}` : "/digest");
458
541
  const projects = useProjects(forge);
542
+ const [filters, setFilters] = useFilters();
543
+ const [folds, setFold] = useFolds();
459
544
  const digest = reply?.digest;
460
545
  const acting = useActing(forge, digest?.date, reload, hurry);
461
546
  const reading = reply?.reading;
462
547
  const isReading = acting.refreshing || !!reading;
463
548
  const [details, setDetails] = useState2(false);
464
549
  const problems = groupProblems(digest?.problems ?? []);
465
- const notes = notesLine(digest?.notes);
466
550
  const enabled = reply?.enabled === true;
467
- const pending = reply?.pending ?? [];
468
- const liveNews = (digest?.items ?? []).filter((i) => i.state !== "dismissed").length;
551
+ const allNews = newsList(digest?.items ?? []);
552
+ const allPending = reply?.pending ?? [];
553
+ const everything = [...allNews, ...allPending];
554
+ const accounts = [...new Set(everything.flatMap((x) => x.account ? [x.account] : []))];
555
+ const present = SOURCES.filter((s) => everything.some((x) => x.source === s.id));
556
+ const hasNone = everything.some((x) => !x.account);
557
+ const active = { ...filters, account: accounts.includes(filters.account) || hasNone && filters.account === NO_ACCOUNT ? filters.account : "", source: present.some((s) => s.id === filters.source) ? filters.source : "" };
558
+ const counts = countFor(allNews, allPending, active);
559
+ const news = filterNews(allNews, active);
560
+ const ready = acceptable(news);
561
+ const pending = filterPending(allPending, active);
562
+ const searching = active.query.trim() !== "";
563
+ const filtered = active.account !== "" || active.source !== "" || searching;
564
+ const set = (next) => setFilters({ ...filters, ...next });
469
565
  useEffect2(() => {
470
566
  forge.route("/days").then((r) => setDays(r.days), () => {
471
567
  });
472
568
  }, [forge, digest?.readAt]);
473
- return /* @__PURE__ */ jsxs2("div", { style: { padding: "22px", display: "flex", flexDirection: "column", gap: "16px", maxWidth: "1180px" }, children: [
569
+ return /* @__PURE__ */ jsxs2("div", { style: { padding: "22px", display: "flex", flexDirection: "column", gap: "14px", maxWidth: "1280px" }, children: [
474
570
  /* @__PURE__ */ jsxs2("div", { style: { display: "flex", alignItems: "center", gap: "12px", flexWrap: "wrap" }, children: [
475
- days.length > 0 && /* @__PURE__ */ jsx2("select", { "aria-label": "Day", value: digest?.date ?? "", onChange: (e) => setDay(e.target.value), style: { font: "inherit", fontSize: "12.5px", padding: "5px 8px", borderRadius: "8px", border: "1px solid var(--hair-2)", background: "var(--card)", color: "var(--ink)" }, children: days.map((d) => /* @__PURE__ */ jsx2("option", { value: d, children: dayName(d) }, d)) }),
476
- digest && /* @__PURE__ */ jsx2("b", { style: { fontSize: "13px", fontWeight: 600 }, children: dayLabel(/* @__PURE__ */ new Date(), digest.date) }),
477
- isReading ? /* @__PURE__ */ jsx2(ReadingLine, { reading }) : /* @__PURE__ */ jsx2("span", { style: { fontSize: "12px", color: "var(--ink-2)" }, children: digest ? readLine(digest) : "Not read yet" }),
478
- /* @__PURE__ */ jsxs2("span", { style: { marginLeft: "auto", display: "flex", gap: "8px" }, children: [
479
- enabled && /* @__PURE__ */ jsx2(ActionButton, { label: isReading ? "Reading\u2026" : "Read now", variant: "primary", size: "sm", disabled: isReading, loading: isReading, onClick: acting.refresh }),
571
+ /* @__PURE__ */ jsxs2("b", { style: { fontSize: "14px", fontWeight: 650, display: "flex", alignItems: "center", gap: "8px" }, children: [
572
+ "Today",
573
+ digest && days.length > 0 ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
574
+ /* @__PURE__ */ jsx2("span", { style: { color: "var(--ink-3)", fontWeight: 400 }, children: "\xB7" }),
575
+ /* @__PURE__ */ jsx2("select", { "aria-label": "Day", value: digest.date, onChange: (e) => setDay(e.target.value), style: { font: "inherit", fontSize: "13px", fontWeight: 600, padding: "4px 8px", borderRadius: "8px", border: "1px solid var(--hair-2)", background: "var(--card)", color: "var(--ink)" }, children: days.map((d) => /* @__PURE__ */ jsx2("option", { value: d, children: dayName(d) }, d)) })
576
+ ] }) : digest ? ` \xB7 ${dayName(digest.date)}` : null
577
+ ] }),
578
+ /* @__PURE__ */ jsx2("input", { type: "search", "aria-label": "Search", placeholder: "Search\u2026", value: filters.query, onInput: (e) => set({ query: e.target.value }), style: { font: "inherit", fontSize: "12.5px", padding: "5px 10px", borderRadius: "8px", border: "1px solid var(--hair-2)", background: "var(--card)", color: "var(--ink)", minWidth: "180px", marginLeft: "auto" } }),
579
+ /* @__PURE__ */ jsxs2("span", { style: { display: "flex", gap: "8px" }, children: [
580
+ enabled && /* @__PURE__ */ jsx2(ActionButton, { label: isReading ? "Reading\u2026" : "Refresh", variant: "primary", size: "sm", disabled: isReading, loading: isReading, onClick: acting.refresh }),
480
581
  reply && /* @__PURE__ */ jsx2(ActionButton, { label: enabled ? "Turn off" : "Turn on", variant: enabled ? "secondary" : "primary", size: "sm", disabled: acting.busy, onClick: () => acting.run(() => forge.action(enabled ? "disable" : "enable")) })
481
582
  ] })
482
583
  ] }),
483
- reply && !enabled && /* @__PURE__ */ jsx2("div", { style: { padding: "12px 14px", borderRadius: "10px", fontSize: "12.5px", lineHeight: 1.5, color: "var(--ink-2)", background: "var(--card)", border: "1px solid var(--hair)", maxWidth: "640px" }, children: "Today is off. Turned on, it reads your Linear, Slack and GitHub each morning and whenever you press Read now. Each reading spends your account's usage. Research it proposes can start sessions on its own, a few a day." }),
484
- (error || digest?.error) && /* @__PURE__ */ jsx2("div", { style: { padding: "10px 12px", borderRadius: "10px", fontSize: "12px", color: "var(--red)", background: "var(--card)", border: "1px solid color-mix(in srgb, var(--red) 45%, var(--hair))" }, children: error ? loadFailedLine(error) : failedLine(digest.error) }),
584
+ /* @__PURE__ */ jsx2("div", { style: { fontSize: "12px", color: "var(--ink-2)" }, children: isReading ? /* @__PURE__ */ jsx2(ReadingLine, { reading }) : digest ? readLine(digest) : "Not read yet" }),
585
+ reply && !enabled && /* @__PURE__ */ jsx2("div", { style: { padding: "12px 14px", borderRadius: "10px", fontSize: "12.5px", lineHeight: 1.5, color: "var(--ink-2)", background: "var(--card)", border: "1px solid var(--hair)", maxWidth: "640px" }, children: "Today is off. Turned on, it reads your Linear, Slack and GitHub each morning and whenever you press Refresh. Each reading spends your account's usage. Research it proposes can start sessions on its own, a few a day." }),
586
+ (error || digest?.error) && /* @__PURE__ */ jsx2("div", { style: { padding: "8px 12px", borderRadius: "10px", fontSize: "12px", color: "var(--red)", background: "var(--card)", border: "1px solid color-mix(in srgb, var(--red) 45%, var(--hair))" }, children: error ? loadFailedLine(error) : failedLine(digest.error) }),
485
587
  problems.length > 0 && /* @__PURE__ */ jsxs2("div", { style: { display: "flex", flexDirection: "column", gap: "6px" }, children: [
486
588
  problems.map((g) => /* @__PURE__ */ jsx2(ProblemRow, { group: g, acting, details }, g.account)),
487
589
  /* @__PURE__ */ jsx2("button", { type: "button", "aria-expanded": details, onClick: () => setDetails(!details), style: { alignSelf: "flex-start", font: "inherit", fontSize: "11.5px", padding: 0, border: 0, background: "none", cursor: "pointer", color: "var(--ink-3)" }, children: details ? "Hide details" : "Details" })
488
590
  ] }),
489
- notes && /* @__PURE__ */ jsx2("div", { style: { fontSize: "12px", color: "var(--ink-3)" }, children: notes }),
490
- !digest && isReading ? /* @__PURE__ */ jsx2(SkeletonRows, {}) : !digest ? /* @__PURE__ */ jsx2(EmptyState, { title: "Nothing to show", description: enabled ? "Today reads your Linear, Slack and GitHub once a day. Use Read now to read them now." : "Turn Today on to read your Linear, Slack and GitHub." }) : /* @__PURE__ */ jsxs2(Fragment2, { children: [
491
- /* @__PURE__ */ jsxs2("section", { style: { display: "flex", flexDirection: "column", gap: "16px" }, children: [
492
- /* @__PURE__ */ jsxs2("h3", { style: heading, children: [
493
- "News \xB7 ",
494
- liveNews
591
+ /* @__PURE__ */ jsx2(Notes, { notes: digest?.notes }),
592
+ !digest && isReading ? /* @__PURE__ */ jsx2(SkeletonRows, {}) : !digest ? /* @__PURE__ */ jsx2(EmptyState, { title: "Nothing to show", description: enabled ? "Today reads your Linear, Slack and GitHub once a day. Use Refresh to read them now." : "Turn Today on to read your Linear, Slack and GitHub." }) : /* @__PURE__ */ jsxs2(Fragment2, { children: [
593
+ /* @__PURE__ */ jsxs2("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
594
+ (accounts.length > 1 || accounts.length > 0 && hasNone) && /* @__PURE__ */ jsxs2("div", { role: "group", "aria-label": "Account", style: { display: "flex", alignItems: "center", gap: "6px", flexWrap: "wrap" }, children: [
595
+ /* @__PURE__ */ jsx2("span", { style: { fontSize: "11.5px", color: "var(--ink-3)", minWidth: "52px" }, children: "Account" }),
596
+ /* @__PURE__ */ jsx2(Pill, { label: "All", n: counts.total, on: !active.account, onClick: () => set({ account: "" }) }),
597
+ accounts.map((a) => /* @__PURE__ */ jsx2(Pill, { label: a, token: accountToken(a), n: counts.accounts[a] ?? 0, on: active.account === a, onClick: () => set({ account: a }) }, a)),
598
+ hasNone && /* @__PURE__ */ jsx2(Pill, { label: "No account", n: counts.noAccount, on: active.account === NO_ACCOUNT, onClick: () => set({ account: NO_ACCOUNT }) })
495
599
  ] }),
496
- digest.items.length === 0 && /* @__PURE__ */ jsx2("div", { style: { fontSize: "12.5px", color: "var(--ink-2)" }, children: reply?.firstReading ? FIRST_READING_NOTE : "Nothing new." }),
497
- byAccount(digest.items).map(({ account, sections: sections2 }) => /* @__PURE__ */ jsxs2("div", { style: { display: "flex", flexDirection: "column", gap: "16px" }, children: [
498
- account && /* @__PURE__ */ jsx2("div", { children: /* @__PURE__ */ jsx2(AccountChip, { account }) }),
499
- sections2.map(({ title, items }) => /* @__PURE__ */ jsxs2("section", { style: { display: "flex", flexDirection: "column", gap: "6px" }, children: [
500
- /* @__PURE__ */ jsxs2("h4", { style: subheading, children: [
501
- title,
502
- " \xB7 ",
503
- items.length
504
- ] }),
505
- items.map((i) => /* @__PURE__ */ jsx2(Row, { item: i, projects, acting, forge }, i.id))
506
- ] }, title))
507
- ] }, account ?? ""))
600
+ /* @__PURE__ */ jsxs2("div", { role: "group", "aria-label": "Source", style: { display: "flex", alignItems: "center", gap: "6px", flexWrap: "wrap" }, children: [
601
+ /* @__PURE__ */ jsx2("span", { style: { fontSize: "11.5px", color: "var(--ink-3)", minWidth: "52px" }, children: "Source" }),
602
+ /* @__PURE__ */ jsx2(Pill, { label: "All", n: counts.sources.linear + counts.sources.slack + counts.sources.github, on: !active.source, onClick: () => set({ source: "" }) }),
603
+ present.map((s) => /* @__PURE__ */ jsx2(Pill, { label: s.label, n: counts.sources[s.id], on: active.source === s.id, onClick: () => set({ source: s.id }) }, s.id)),
604
+ filtered && /* @__PURE__ */ jsx2("button", { type: "button", onClick: () => setFilters(NO_FILTERS), style: { font: "inherit", fontSize: "11.5px", padding: 0, border: 0, background: "none", cursor: "pointer", color: "var(--ink-3)" }, children: "Clear" })
605
+ ] })
508
606
  ] }),
509
- /* @__PURE__ */ jsxs2("section", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
510
- /* @__PURE__ */ jsxs2("h3", { style: heading, children: [
511
- "Pending \xB7 ",
512
- pending.length,
513
- reply?.pendingCapped && /* @__PURE__ */ jsxs2("span", { style: { fontWeight: 400, fontSize: "11.5px", color: "var(--ink-3)" }, children: [
514
- " \xB7 ",
515
- CAPPED_NOTE,
516
- " \u2014 ",
517
- /* @__PURE__ */ jsx2("a", { href: GITHUB_SEARCH, target: "_blank", rel: "noopener noreferrer", style: { color: "inherit" }, children: "see GitHub" })
518
- ] })
607
+ /* @__PURE__ */ jsxs2("div", { class: "today-cols", children: [
608
+ /* @__PURE__ */ jsxs2("section", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
609
+ /* @__PURE__ */ jsxs2("h3", { style: { ...heading, marginBottom: "4px", display: "flex", alignItems: "center", gap: "10px" }, children: [
610
+ "News \xB7 ",
611
+ news.length,
612
+ ready.length > 0 && digest && /* @__PURE__ */ jsx2(Btn, { label: `Accept ${ready.length === 1 ? "it" : `the ${ready.length}`}`, style: primaryStyle, disabled: acting.busy, onClick: () => acting.run(() => forge.action("accept-all", { date: digest.date, ids: ready.map((i) => i.id).join(",") })) })
613
+ ] }),
614
+ news.length === 0 && /* @__PURE__ */ jsx2("div", { style: muted, children: filtered && allNews.length > 0 ? "No news matches." : reply?.firstReading ? FIRST_READING_NOTE : "Nothing new." }),
615
+ news.map((i) => /* @__PURE__ */ jsx2(Row, { item: i, projects, acting, forge }, i.id))
519
616
  ] }),
520
- pending.length === 0 && /* @__PURE__ */ jsx2("div", { style: { fontSize: "12.5px", color: "var(--ink-2)" }, children: PENDING_EMPTY }),
521
- pendingByAccount(pending).map(({ account, items }) => /* @__PURE__ */ jsxs2("div", { style: { display: "flex", flexDirection: "column", gap: "6px" }, children: [
522
- account && /* @__PURE__ */ jsx2("div", { children: /* @__PURE__ */ jsx2(AccountChip, { account }) }),
523
- items.map((p) => /* @__PURE__ */ jsx2(PendingRow, { item: p, projects, acting, forge }, p.id))
524
- ] }, account ?? ""))
617
+ /* @__PURE__ */ jsxs2("section", { style: { display: "flex", flexDirection: "column", gap: "10px" }, children: [
618
+ /* @__PURE__ */ jsxs2("h3", { style: heading, children: [
619
+ "Pending \xB7 ",
620
+ pending.length,
621
+ reply?.pendingCapped && /* @__PURE__ */ jsxs2("span", { style: { fontWeight: 400, fontSize: "11.5px", color: "var(--ink-3)" }, children: [
622
+ " \xB7 ",
623
+ CAPPED_NOTE,
624
+ " \u2014 ",
625
+ /* @__PURE__ */ jsx2("a", { href: GITHUB_SEARCH, target: "_blank", rel: "noopener noreferrer", style: { color: "inherit" }, children: "see GitHub" })
626
+ ] })
627
+ ] }),
628
+ pending.length === 0 && /* @__PURE__ */ jsx2("div", { style: muted, children: filtered && allPending.length > 0 ? "No pending matches." : PENDING_EMPTY }),
629
+ groupPending(pending).map((g) => {
630
+ const folded = !searching && isGroupFolded(g, folds);
631
+ return /* @__PURE__ */ jsxs2("div", { style: { display: "flex", flexDirection: "column", gap: "2px" }, children: [
632
+ /* @__PURE__ */ jsxs2("button", { type: "button", "aria-expanded": !folded, onClick: () => setFold(g.id, !folded), style: { alignSelf: "flex-start", font: "inherit", fontSize: "11px", fontWeight: 600, letterSpacing: ".05em", textTransform: "uppercase", padding: "2px 0", border: 0, background: "none", cursor: "pointer", color: "var(--ink-3)" }, children: [
633
+ folded ? "\u25B8" : "\u25BE",
634
+ " ",
635
+ g.title,
636
+ " \xB7 ",
637
+ g.items.length
638
+ ] }),
639
+ !folded && g.items.map((p) => /* @__PURE__ */ jsx2(PendingRow, { item: p, projects, acting, forge }, p.id))
640
+ ] }, g.id);
641
+ })
642
+ ] })
525
643
  ] })
526
644
  ] })
527
645
  ] });