forge-cw 0.1.27 → 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.
- package/modules/mod-today/dist/banner.js +219 -239
- package/modules/mod-today/dist/server.js +289 -20
- package/modules/mod-today/dist/view.js +347 -114
- package/package.json +1 -1
|
@@ -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
|
|
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,88 @@ function groupProblems(problems) {
|
|
|
33
35
|
});
|
|
34
36
|
}
|
|
35
37
|
var groupLine = (g) => `${g.account} \xB7 ${g.label} did not respond`;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
function titleFor(i) {
|
|
39
|
+
if (!i.issueKey) return i.title;
|
|
40
|
+
const key = i.issueKey.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
41
|
+
const rest = i.title.replace(new RegExp(`^\\s*\\[?${key}\\]?\\s*[:\\-\u2013\u2014]?\\s*`, "i"), "");
|
|
42
|
+
return rest.trim() ? rest : i.title;
|
|
43
|
+
}
|
|
44
|
+
var SOURCE_NAMES = { linear: "Linear", slack: "Slack", github: "GitHub" };
|
|
45
|
+
function whoOf(i) {
|
|
46
|
+
const who = i.who.trim();
|
|
47
|
+
return !who || who.toLowerCase() === SOURCE_NAMES[i.source].toLowerCase() ? null : who;
|
|
48
|
+
}
|
|
49
|
+
var CAPPED_NOTE = "showing the latest 20";
|
|
50
|
+
var GITHUB_SEARCH = "https://github.com/pulls/review-requested";
|
|
51
|
+
var PENDING_EMPTY = "Nothing open \u2014 nice.";
|
|
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 }
|
|
41
105
|
];
|
|
42
|
-
function
|
|
43
|
-
|
|
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;
|
|
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);
|
|
54
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));
|
|
55
120
|
|
|
56
121
|
// src/rows.tsx
|
|
57
122
|
import { useCallback, useEffect, useRef, useState } from "preact/hooks";
|
|
@@ -69,6 +134,33 @@ function AccountChip({ account }) {
|
|
|
69
134
|
const token = accountToken(account);
|
|
70
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 });
|
|
71
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
|
+
}
|
|
72
164
|
function useDigest(forge, path = "/digest") {
|
|
73
165
|
const [reply, setReply] = useState(null);
|
|
74
166
|
const [error, setError] = useState(null);
|
|
@@ -131,6 +223,15 @@ function useActing(forge, date, reload, hurry = () => {
|
|
|
131
223
|
const act = (item, op, project) => run(async () => {
|
|
132
224
|
if (date) await forge.action(op, { date, id: item.id, ...project ? { project } : {} });
|
|
133
225
|
});
|
|
226
|
+
const startPending = (item, project) => run(async () => {
|
|
227
|
+
await forge.action("pending-start", { id: item.id, ...project ? { project } : {} });
|
|
228
|
+
});
|
|
229
|
+
const researchPending = (item) => run(async () => {
|
|
230
|
+
await forge.action("pending-research", { id: item.id });
|
|
231
|
+
});
|
|
232
|
+
const hidePending = (item) => run(async () => {
|
|
233
|
+
await forge.action("pending-hide", { id: item.id });
|
|
234
|
+
});
|
|
134
235
|
const refresh = async () => {
|
|
135
236
|
if (reading.current) return;
|
|
136
237
|
reading.current = true;
|
|
@@ -155,40 +256,30 @@ function useActing(forge, date, reload, hurry = () => {
|
|
|
155
256
|
const s = await forge.action("reconnect", { account });
|
|
156
257
|
if (s) forge.openSession(s.project, s.sessionDir);
|
|
157
258
|
});
|
|
158
|
-
return { busy, refreshing, retrying, retry, reconnect, run, act, refresh };
|
|
259
|
+
return { busy, refreshing, retrying, retry, reconnect, run, act, refresh, startPending, researchPending, hidePending };
|
|
159
260
|
}
|
|
160
261
|
function dayOf(date) {
|
|
161
262
|
const [y, m, d] = date.split("-").map(Number);
|
|
162
263
|
return new Date(y, m - 1, d);
|
|
163
264
|
}
|
|
164
|
-
var isToday = (date, now) => dayOf(date).toDateString() === now.toDateString();
|
|
165
|
-
function dayLabel(now, date) {
|
|
166
|
-
const day = dayOf(date);
|
|
167
|
-
if (!isToday(date, now)) return `From ${day.toLocaleDateString("en-US", { weekday: "long" })} ${day.getDate()}`;
|
|
168
|
-
const hour = now.getHours();
|
|
169
|
-
const part = hour < 12 ? "Good morning" : hour < 19 ? "Good afternoon" : "Good evening";
|
|
170
|
-
return `${part} \xB7 your ${now.toLocaleDateString("en-US", { weekday: "long" })} ${now.getDate()}`;
|
|
171
|
-
}
|
|
172
265
|
var clock = (d) => d.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit" });
|
|
266
|
+
function windowTime(at, read) {
|
|
267
|
+
if (at.toDateString() === read.toDateString()) return clock(at);
|
|
268
|
+
const yesterday = new Date(read.getTime() - 864e5).toDateString() === at.toDateString();
|
|
269
|
+
return `${yesterday ? "yesterday" : at.toLocaleDateString("en-US", { month: "short", day: "numeric" })} ${clock(at)}`;
|
|
270
|
+
}
|
|
173
271
|
function readLine(d) {
|
|
174
272
|
const read = new Date(d.readAt);
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
function ago(iso, now = /* @__PURE__ */ new Date()) {
|
|
181
|
-
const t = new Date(iso);
|
|
182
|
-
const min = Math.round((now.getTime() - t.getTime()) / 6e4);
|
|
183
|
-
if (min < 1) return "just now";
|
|
184
|
-
if (min < 60) return `${min} min ago`;
|
|
185
|
-
if (min < 24 * 60) return `${Math.round(min / 60)} h ago`;
|
|
186
|
-
return t.toLocaleDateString("en-US", { month: "short", day: "numeric" }) + " " + clock(t);
|
|
273
|
+
return `Read at ${clock(read)} \xB7 changes since ${windowTime(new Date(d.windowStart ?? d.since), read)}`;
|
|
274
|
+
}
|
|
275
|
+
function dayName(date) {
|
|
276
|
+
const day = dayOf(date);
|
|
277
|
+
return `${day.toLocaleDateString("en-US", { weekday: "long" })} ${day.getDate()}`;
|
|
187
278
|
}
|
|
188
279
|
var SOURCE_LABEL = { linear: "Linear", slack: "Slack", github: "GitHub" };
|
|
189
280
|
var SOURCE_TINT = { linear: "#5e6ad2 22%", slack: "#e01e5a 18%", github: "#8b949e 24%" };
|
|
190
281
|
function SourceIcon({ source }) {
|
|
191
|
-
return /* @__PURE__ */ jsx("div", { title: SOURCE_LABEL[source], style: { width: "
|
|
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: [
|
|
192
283
|
/* @__PURE__ */ jsx("path", { stroke: "#36c5f0", d: "M9 3.5v6" }),
|
|
193
284
|
/* @__PURE__ */ jsx("path", { stroke: "#2eb67d", d: "M20.5 9h-6" }),
|
|
194
285
|
/* @__PURE__ */ jsx("path", { stroke: "#ecb22e", d: "M15 20.5v-6" }),
|
|
@@ -240,78 +331,141 @@ function outcome(item) {
|
|
|
240
331
|
where ? ` \xB7 ${where}` : ""
|
|
241
332
|
] });
|
|
242
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 });
|
|
243
365
|
var Row = ({ item, projects = EMPTY_PROJECTS, acting, forge }) => {
|
|
244
366
|
const [project, setProject] = useState(item.project ?? "");
|
|
245
367
|
const open = item.state === "proposed" || item.state === "failed";
|
|
246
368
|
const needsProject = startsTask(item.kind) && !item.project;
|
|
247
369
|
const op = opFor(item, project);
|
|
248
370
|
const where = item.source === "slack" ? "in" : "on";
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
/* @__PURE__ */
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
] }),
|
|
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: [
|
|
265
386
|
/* @__PURE__ */ jsx(Sep, {}),
|
|
266
|
-
/* @__PURE__ */
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
387
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
388
|
+
"goes to ",
|
|
389
|
+
strong(item.targetSession.sessionDir)
|
|
390
|
+
] })
|
|
391
|
+
] }),
|
|
392
|
+
item.project && item.kind !== "to-task" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
271
393
|
/* @__PURE__ */ jsx(Sep, {}),
|
|
272
|
-
/* @__PURE__ */ jsxs("
|
|
273
|
-
"
|
|
274
|
-
|
|
275
|
-
" \u2197"
|
|
276
|
-
] }),
|
|
277
|
-
item.kind === "to-task" && item.targetSession && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
278
|
-
/* @__PURE__ */ jsx(Sep, {}),
|
|
279
|
-
/* @__PURE__ */ jsxs("span", { children: [
|
|
280
|
-
"goes to ",
|
|
281
|
-
strong(item.targetSession.sessionDir)
|
|
282
|
-
] })
|
|
283
|
-
] }),
|
|
284
|
-
item.project && item.kind !== "to-task" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
285
|
-
/* @__PURE__ */ jsx(Sep, {}),
|
|
286
|
-
/* @__PURE__ */ jsxs("span", { children: [
|
|
287
|
-
"project ",
|
|
288
|
-
strong(item.project)
|
|
289
|
-
] })
|
|
394
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
395
|
+
"project ",
|
|
396
|
+
strong(item.project)
|
|
290
397
|
] })
|
|
398
|
+
] })
|
|
399
|
+
] }),
|
|
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
|
|
291
407
|
] }),
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
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") })
|
|
410
|
+
] })
|
|
411
|
+
] });
|
|
412
|
+
};
|
|
413
|
+
var PENDING_TOKEN = { ci: "--red", review: "--blue", issue: "--green", reply: "--purple" };
|
|
414
|
+
var PendingRow = ({ item, projects = EMPTY_PROJECTS, acting, forge }) => {
|
|
415
|
+
const [project, setProject] = useState(item.project ?? "");
|
|
416
|
+
const token = PENDING_TOKEN[item.kind];
|
|
417
|
+
const target = item.project ?? project;
|
|
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
|
|
296
432
|
] }),
|
|
297
|
-
item.
|
|
433
|
+
item.project && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
434
|
+
/* @__PURE__ */ jsx(Sep, {}),
|
|
435
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
436
|
+
"project ",
|
|
437
|
+
strong(item.project)
|
|
438
|
+
] })
|
|
439
|
+
] })
|
|
298
440
|
] }),
|
|
299
|
-
/* @__PURE__ */
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
item.
|
|
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
|
|
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) }),
|
|
449
|
+
/* @__PURE__ */ jsx(Btn, { label: "Hide", style: ghostStyle, disabled: acting.busy, onClick: () => acting.hidePending(item) })
|
|
307
450
|
] })
|
|
308
451
|
] });
|
|
309
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
|
+
}
|
|
310
462
|
var READING_CSS = `
|
|
311
463
|
@keyframes today-spin { to { transform: rotate(360deg) } }
|
|
312
464
|
@keyframes today-pulse { 0%, 100% { opacity: .55 } 50% { opacity: 1 } }
|
|
313
465
|
.today-spin { animation: today-spin .8s linear infinite }
|
|
314
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) } }
|
|
315
469
|
@media (prefers-reduced-motion: reduce) { .today-spin, .today-pulse { animation: none } }`;
|
|
316
470
|
function useReadingStyles() {
|
|
317
471
|
if (typeof document !== "undefined" && !document.getElementById("today-reading-css")) {
|
|
@@ -361,54 +515,133 @@ function ProblemRow({ group, acting, details = false }) {
|
|
|
361
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)) })
|
|
362
516
|
] });
|
|
363
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
|
+
}
|
|
364
530
|
|
|
365
531
|
// src/view.tsx
|
|
366
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "preact/jsx-runtime";
|
|
532
|
+
import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "preact/jsx-runtime";
|
|
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" }];
|
|
367
536
|
function View({ forge }) {
|
|
537
|
+
useReadingStyles();
|
|
368
538
|
const [days, setDays] = useState2([]);
|
|
369
539
|
const [day, setDay] = useState2(null);
|
|
370
540
|
const { reply, error, reload, hurry } = useDigest(forge, day ? `/digest/${day}` : "/digest");
|
|
371
541
|
const projects = useProjects(forge);
|
|
542
|
+
const [filters, setFilters] = useFilters();
|
|
543
|
+
const [folds, setFold] = useFolds();
|
|
372
544
|
const digest = reply?.digest;
|
|
373
545
|
const acting = useActing(forge, digest?.date, reload, hurry);
|
|
374
546
|
const reading = reply?.reading;
|
|
375
547
|
const isReading = acting.refreshing || !!reading;
|
|
376
548
|
const [details, setDetails] = useState2(false);
|
|
377
549
|
const problems = groupProblems(digest?.problems ?? []);
|
|
378
|
-
const notes = notesLine(digest?.notes);
|
|
379
550
|
const enabled = reply?.enabled === true;
|
|
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 });
|
|
380
565
|
useEffect2(() => {
|
|
381
566
|
forge.route("/days").then((r) => setDays(r.days), () => {
|
|
382
567
|
});
|
|
383
568
|
}, [forge, digest?.readAt]);
|
|
384
|
-
return /* @__PURE__ */ jsxs2("div", { style: { padding: "22px", display: "flex", flexDirection: "column", gap: "
|
|
569
|
+
return /* @__PURE__ */ jsxs2("div", { style: { padding: "22px", display: "flex", flexDirection: "column", gap: "14px", maxWidth: "1280px" }, children: [
|
|
385
570
|
/* @__PURE__ */ jsxs2("div", { style: { display: "flex", alignItems: "center", gap: "12px", flexWrap: "wrap" }, children: [
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
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 }),
|
|
391
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")) })
|
|
392
582
|
] })
|
|
393
583
|
] }),
|
|
394
|
-
|
|
395
|
-
|
|
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) }),
|
|
396
587
|
problems.length > 0 && /* @__PURE__ */ jsxs2("div", { style: { display: "flex", flexDirection: "column", gap: "6px" }, children: [
|
|
397
588
|
problems.map((g) => /* @__PURE__ */ jsx2(ProblemRow, { group: g, acting, details }, g.account)),
|
|
398
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" })
|
|
399
590
|
] }),
|
|
400
|
-
|
|
401
|
-
!digest && isReading ? /* @__PURE__ */ jsx2(SkeletonRows, {}) : !digest
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
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 }) })
|
|
599
|
+
] }),
|
|
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
|
+
] })
|
|
606
|
+
] }),
|
|
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))
|
|
408
616
|
] }),
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
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
|
+
] })
|
|
643
|
+
] })
|
|
644
|
+
] })
|
|
412
645
|
] });
|
|
413
646
|
}
|
|
414
647
|
var view_default = definePanel({ id: "main", title: "Today", component: View });
|