@andrioid/paseo-attention-span 0.5.0 → 0.6.1

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.
Files changed (73) hide show
  1. package/OVERVIEW.md +7 -1
  2. package/client/attention-screen.tsx +74 -1176
  3. package/client/coverage-settings.tsx +5 -4
  4. package/client/data.ts +4 -2
  5. package/client/feedback.tsx +21 -25
  6. package/client/history.tsx +17 -50
  7. package/client/item-actions.ts +363 -0
  8. package/client/item-row.tsx +450 -0
  9. package/client/new-issue.tsx +244 -0
  10. package/client/next-up.tsx +36 -183
  11. package/client/pickers.tsx +237 -0
  12. package/client/session-menu.ts +3 -11
  13. package/client/sessions.ts +58 -57
  14. package/client/setup.tsx +2 -1
  15. package/client/sheet.tsx +92 -15
  16. package/client/still.tsx +70 -27
  17. package/client/ui.tsx +23 -14
  18. package/client/wrap-up.tsx +151 -85
  19. package/docs/architecture.md +22 -11
  20. package/docs/screenshots/desktop-dark-doing-acknowledge.png +0 -0
  21. package/docs/screenshots/desktop-dark-doing-clear.png +0 -0
  22. package/docs/screenshots/desktop-dark-doing-issue-sheet.png +0 -0
  23. package/docs/screenshots/desktop-dark-doing-reviewers.png +0 -0
  24. package/docs/screenshots/desktop-dark-doing-sheet.png +0 -0
  25. package/docs/screenshots/desktop-dark-doing-wrap-dirty.png +0 -0
  26. package/docs/screenshots/desktop-dark-doing-wrap-multi.png +0 -0
  27. package/docs/screenshots/desktop-dark-doing-wrap.png +0 -0
  28. package/docs/screenshots/desktop-dark-doing.png +0 -0
  29. package/docs/screenshots/desktop-dark-next-up-setup.png +0 -0
  30. package/docs/screenshots/desktop-dark-next-up.png +0 -0
  31. package/docs/screenshots/desktop-dark-settings.png +0 -0
  32. package/docs/screenshots/phone-dark-doing.png +0 -0
  33. package/docs/screenshots/phone-light-next-up-filtered.png +0 -0
  34. package/index.client.tsx +19 -0
  35. package/index.server.ts +43 -26
  36. package/package.json +3 -1
  37. package/requirements.yaml +11 -3
  38. package/server/actions.ts +2 -1
  39. package/server/archive.ts +146 -67
  40. package/server/archived.ts +12 -16
  41. package/server/changes.ts +34 -54
  42. package/server/classify.ts +142 -136
  43. package/server/feedback.ts +2 -6
  44. package/server/fetch.ts +262 -0
  45. package/server/fixture.ts +91 -7
  46. package/server/github-types.ts +3 -1
  47. package/server/markdown.ts +3 -1
  48. package/server/port.ts +46 -0
  49. package/server/queries.ts +33 -23
  50. package/server/service.ts +155 -272
  51. package/server/setup.ts +15 -14
  52. package/server/store.ts +94 -80
  53. package/server/update.ts +34 -13
  54. package/server/view.ts +16 -15
  55. package/shared/archive.ts +116 -13
  56. package/shared/attention.ts +50 -18
  57. package/shared/changes.ts +2 -1
  58. package/shared/config.ts +2 -6
  59. package/shared/drafting.ts +17 -0
  60. package/shared/feedback.ts +6 -5
  61. package/shared/format.ts +2 -1
  62. package/shared/history-report.ts +2 -1
  63. package/shared/item-sessions.ts +76 -0
  64. package/shared/item-view.ts +223 -0
  65. package/shared/linked-sessions.ts +59 -8
  66. package/shared/names.ts +17 -0
  67. package/shared/new-issue.ts +129 -0
  68. package/shared/next-up-filter.ts +137 -0
  69. package/shared/paging.ts +16 -0
  70. package/shared/rpc.ts +23 -10
  71. package/shared/setup.ts +3 -1
  72. package/shared/still.ts +28 -7
  73. package/shared/wrap-up.ts +20 -23
@@ -0,0 +1,450 @@
1
+ // A card on Doing, Waiting and History, and its sheet, with the people and stack lines both show [ATT-05, ATT-06].
2
+
3
+ import { openExternalUrl } from "@getpaseo/plugin/client";
4
+ import { useQuery } from "@tanstack/react-query";
5
+ import { type ReactNode, useState } from "react";
6
+ import { Pressable, Text, View } from "react-native";
7
+ import { type ActionId, type AgentSummary, type Chip, type FailingChecks, type Item, itemSessions, type PersonRole, type SubRow, type WaitingGroup, type WaitingOn } from "../shared/attention";
8
+ import type { SessionKind } from "../shared/config";
9
+ import { failingList, groupLabel, rerunHistory, summarizeRerun } from "../shared/checks";
10
+ import { ago } from "../shared/format";
11
+ import { noteBusy } from "../shared/got-it";
12
+ import { actionLabel, alsoWaitingOn, cardStack, cardWhen, copiesLink, rerunState, sessionSignal, type SheetStep, sheetPlan, soleStep, stackMetaChips, targetUrl, waitChips } from "../shared/item-view";
13
+ import { CardList, CardRow } from "./card";
14
+ import { NumberText, PlaceText } from "./entity";
15
+ import type { IconName } from "./icons";
16
+ import { type Actions, itemDetailsQuery } from "./item-actions";
17
+ import { stateMark } from "./mark";
18
+ import { AcknowledgeSheet, ReviewerSheet } from "./pickers";
19
+ import { sessionEntry, startAnotherEntry } from "./session-menu";
20
+ import { ActionSheet, DETAILS_STALE_MS, DetailLines, FadeIn, githubEntry, type SheetEntry, useArrived, usePrefetchOnRest } from "./sheet";
21
+ import { Avatar, Hint, LINE_HEIGHT, Meta, mix, TablerIcon, tint, useCopy, useHover, useStrongText, useStyles } from "./ui";
22
+
23
+ // The agent icon marks every action that starts an agent session; the rest act on GitHub right away [ATT-13].
24
+ const ACTION_ICONS: Record<ActionId, IconName> = {
25
+ reply: "replyArrow",
26
+ acknowledge: "thumbUp",
27
+ review: "agent",
28
+ fix: "agent",
29
+ rerun: "reload",
30
+ address: "agent",
31
+ update: "update",
32
+ rebase: "agent",
33
+ refresh: "agent",
34
+ ready: "pr",
35
+ request_review: "claim",
36
+ automerge: "clock",
37
+ merge: "merge",
38
+ close: "close",
39
+ start: "agent",
40
+ got_it: "check",
41
+ };
42
+
43
+ // Rerun failed jobs as a sheet line: which checks failed and whether they were rerun before, flaky or real? [PRS-09]
44
+ // It can be pressed before the checks are in: the sheet closes, and the rerun goes ahead once they are.
45
+ function rerunEntry(label: string, details: SheetDetails | undefined, rerun: (runIds?: number[]) => void): SheetEntry {
46
+ const base = { key: "rerun", icon: ACTION_ICONS.rerun, label, live: true };
47
+ const line = rerunState(details);
48
+ if (line.state === "ready") return { ...base, detailNode: <RerunDetail failing={line.failing} arrived={!!details?.arrived} />, hint: failingList(line.failing), onPress: () => rerun(line.runIds) };
49
+ if (line.state === "checking") return { ...base, detail: line.detail, onPress: () => rerun() };
50
+ return { ...base, detail: line.detail, ...(line.state === "elsewhere" ? { hint: failingList(line.failing) } : {}), disabled: true, onPress: () => {} };
51
+ }
52
+
53
+ // What an item's sheet has fetched, as its lines need it; `arrived` once it came in while the sheet was open.
54
+ interface SheetDetails {
55
+ data?: { failing: FailingChecks[] };
56
+ isLoading: boolean;
57
+ arrived?: boolean;
58
+ }
59
+
60
+ // "7 failed · lint, e2e ×3, unit ×2 · ↻ rerun once": the count and names quiet, as the card's red already says CI failed; checks
61
+ // that can't rerun dimmer; the history amber once rerun, a hint it may not be flaky. One line on desktop, where the names give way
62
+ // and the hint has them all; two on phones, which can't point at a hint [PRS-09].
63
+ function RerunDetail({ failing, arrived }: { failing: FailingChecks[]; arrived: boolean }) {
64
+ const styles = useStyles();
65
+ const summary = summarizeRerun(failing);
66
+ const strong = useStrongText();
67
+ // Dimmer than the quiet text, on the line's own background, so it reads in any theme.
68
+ const dimmer = { color: mix(styles.c.foregroundMuted, styles.c.surface2, 0.55) };
69
+ const stack = summary.prs.length > 1;
70
+ const names = summary.prs.map(({ pr, groups }, index) => (
71
+ <Text key={pr}>
72
+ {index > 0 ? " · " : null}
73
+ {stack ? <Text style={strong}>#{pr} </Text> : null}
74
+ {groups.map((group, at) => (
75
+ <Text key={`${group.name}-${group.rerunnable}`} style={group.rerunnable ? null : dimmer}>
76
+ {at > 0 ? ", " : null}
77
+ {groupLabel(group)}
78
+ </Text>
79
+ ))}
80
+ </Text>
81
+ ));
82
+ const history = (
83
+ <Text style={summary.reruns ? { color: styles.c.statusWarning, fontWeight: "500" } : null}>{summary.reruns ? `↻ ${rerunHistory(summary.reruns)}` : rerunHistory(0)}</Text>
84
+ );
85
+ const line = [styles.muted, { lineHeight: LINE_HEIGHT }];
86
+ return (
87
+ <FadeIn active={arrived}>
88
+ {styles.compact ? (
89
+ <Text style={line} numberOfLines={2}>
90
+ {summary.failed} failed · {names} · {history}
91
+ </Text>
92
+ ) : (
93
+ <View style={{ flexDirection: "row", minWidth: 0 }}>
94
+ <Text style={line}>{summary.failed} failed · </Text>
95
+ <Text style={[line, { flexShrink: 1 }]} numberOfLines={1}>
96
+ {names}
97
+ </Text>
98
+ <Text style={line}> · {history}</Text>
99
+ </View>
100
+ )}
101
+ </FadeIn>
102
+ );
103
+ }
104
+
105
+ export function Card({ items, actions, group }: { items: Item[]; actions: Actions; group?: WaitingGroup }) {
106
+ return (
107
+ <CardList>
108
+ {items.map((item, index) => (
109
+ <ItemRow key={item.key} item={item} first={index === 0} actions={actions} group={group} />
110
+ ))}
111
+ </CardList>
112
+ );
113
+ }
114
+
115
+ // The sheet, Acknowledge, or the reviewer picker (after Ready for review, or on its own).
116
+ type Sheet = "item" | "acknowledge" | "reviewers" | "reviewers-after-ready" | null;
117
+
118
+ // A card that works collapsed: its main action and ›. Tapping it opens the sheet with everything else [ATT-05, ATT-06].
119
+ // In Waiting, a card sits under one of whom it waits on: its group.
120
+ function ItemRow({ item, first, actions, group }: { item: Item; first: boolean; actions: Actions; group?: WaitingGroup }) {
121
+ const styles = useStyles();
122
+ // An open session leads; without one, the item's own action does [SES-03].
123
+ const sessions = itemSessions(actions.agents, item);
124
+ const waits = waitChips(item, !!group, actions.config.waitingTooLongDays);
125
+ // The group names one; the card names the rest [WAI-01].
126
+ const others = alsoWaitingOn(item, group?.who);
127
+ const waitingOn = group ? null : item.waitingOn ? <WaitingOnLine people={item.waitingOn} asked={item.wait?.reason === "question"} expanded={false} /> : null;
128
+ const alsoOn = others.length ? <Text style={styles.muted}>also waiting on {others.join(", ")}</Text> : null;
129
+ const [sheet, setSheet] = useState<Sheet>(null);
130
+ const [confirm, setConfirm] = useState<"merge" | "close" | null>(null);
131
+ const main = item.actions[0];
132
+ const { rows: children, target: targetRow } = cardStack(item);
133
+ const shown = [...waits, ...stackMetaChips(item, targetRow)];
134
+ const chips = sessions[0] ? [...shown, sessionSignal(sessions[0])] : shown;
135
+ // The sheet opens at once; what it fetches fills in [ATT-06].
136
+ const open = () => setSheet("item");
137
+ const prefetch = usePrefetchOnRest(itemDetailsQuery(item, actions.fetchDetails));
138
+ const copy = useCopy();
139
+
140
+ function perform(action: ActionId) {
141
+ setSheet(null);
142
+ if (action === "merge" || action === "close") setConfirm(action);
143
+ else if (action === "acknowledge") setSheet("acknowledge");
144
+ else if (action === "request_review") setSheet("reviewers");
145
+ // A draft made ready goes straight on to who should review it [PRS-11].
146
+ else if (action === "ready") (actions.act(item, action), setSheet("reviewers-after-ready"));
147
+ else actions.act(item, action);
148
+ }
149
+ const handlers: SheetHandlers = { onPerform: perform, onClose: () => setSheet(null) };
150
+ // One action shows instead of ›; the card still opens the sheet, quiet lines and all [ATT-06].
151
+ const sole = soleStep(sheetPlan(item, sessions));
152
+ const only = sole && sheetEntry(sole, item, actions, handlers);
153
+ const confirmed = (action: "merge" | "close") => (comment: string) => (setConfirm(null), actions.confirm(item, action, comment));
154
+
155
+ return (
156
+ <CardRow
157
+ first={first}
158
+ mark={stateMark(item)}
159
+ title={item.title}
160
+ meta={{
161
+ place: { repo: item.repo, number: item.number, login: actions.login },
162
+ when: cardWhen(item),
163
+ signals: chips,
164
+ }}
165
+ extra={
166
+ item.person || waitingOn || alsoOn || children.length > 0 ? (
167
+ <>
168
+ {item.person ? <PersonQuote person={item.person} expanded={false} /> : null}
169
+ {waitingOn}
170
+ {alsoOn}
171
+ {children.length > 0 ? <StackLine rows={children} merged={!!item.closedAt} target={targetRow?.key} /> : null}
172
+ </>
173
+ ) : null
174
+ }
175
+ onOpen={open}
176
+ hover={prefetch}
177
+ busy={item.change ? noteBusy(actions.busy, item.key) : actions.busy.has(item.key)}
178
+ primary={
179
+ sessions[0]
180
+ ? { label: "Open session", icon: "agent", onPress: () => actions.openAgent(sessions[0].id) }
181
+ : main
182
+ ? { label: actionLabel(main, item), icon: ACTION_ICONS[main], iconOnly: main === "got_it", onPress: () => perform(main) }
183
+ : undefined
184
+ }
185
+ secondary={[
186
+ only ? { label: only.label, accessibilityLabel: only.accessibilityLabel, icon: only.icon, onPress: only.onPress } : { label: `Details for #${item.number}`, icon: "chevronRight", onPress: open },
187
+ ...(copiesLink(item) ? [{ label: `Copy link to #${item.number}`, icon: "copy" as const, onPress: () => copy(item.url, `Copied link to #${item.number}`) }] : []),
188
+ ]}
189
+ confirm={
190
+ confirm === "merge"
191
+ ? {
192
+ text: `Merge PR ${item.target.number} into ${item.target.baseRefName} (${item.target.mergeMethod})?`,
193
+ choices: [{ label: "Merge", icon: "merge", solid: true, onConfirm: confirmed("merge") }],
194
+ onCancel: () => setConfirm(null),
195
+ }
196
+ : confirm === "close"
197
+ ? {
198
+ text: `Close PR ${item.target.number}? A comment is only posted if you write one.`,
199
+ comment: true,
200
+ choices: [{ label: "Close PR", icon: "close", solid: true, onConfirm: confirmed("close") }],
201
+ onCancel: () => setConfirm(null),
202
+ }
203
+ : null
204
+ }
205
+ overlay={
206
+ <>
207
+ {sheet === "item" ? <ItemSheet item={item} waitChips={waits} sessions={sessions} actions={actions} {...handlers} /> : null}
208
+ {sheet === "acknowledge" ? <AcknowledgeSheet item={item} onReact={(ids) => (setSheet(null), actions.acknowledge(item, ids))} onClose={() => setSheet(null)} /> : null}
209
+ {sheet === "reviewers" || sheet === "reviewers-after-ready" ? (
210
+ <ReviewerSheet
211
+ item={item}
212
+ afterReady={sheet === "reviewers-after-ready"}
213
+ onRequest={(reviewers) => (setSheet(null), actions.requestReviewers(item, reviewers))}
214
+ onClose={() => setSheet(null)}
215
+ />
216
+ ) : null}
217
+ </>
218
+ }
219
+ />
220
+ );
221
+ }
222
+
223
+ interface SheetHandlers {
224
+ onPerform: (action: ActionId) => void;
225
+ onClose: () => void;
226
+ }
227
+
228
+ // What the card already knows on top, then every action, then what's fetched when it opens, so nothing jumps as it loads [ATT-06, GH-01].
229
+ function ItemSheet({ item, waitChips, sessions, actions, ...handlers }: { item: Item; waitChips: Chip[]; sessions: AgentSummary[]; actions: Actions } & SheetHandlers) {
230
+ const details = useQuery({ ...itemDetailsQuery(item, actions.fetchDetails), staleTime: DETAILS_STALE_MS });
231
+ const arrived = useArrived(details.isLoading);
232
+ const elsewhere = !!targetUrl(item);
233
+ // The row of the PR its actions apply to, where it's in the stack line: marked there instead of named on top.
234
+ const targetRow = elsewhere ? item.children.find((child) => child.url === item.target.url) : undefined;
235
+ const meta = elsewhere && !targetRow ? [`actions apply to PR #${item.target.number}`] : [];
236
+ // PRs already in the stack line link from there; list only the rest, like someone else's PR closing the same issue.
237
+ const shown = new Set(item.children.map((child) => child.url));
238
+ const extra = details.data && { ...details.data, linked: details.data.linked.filter((link) => !shown.has(link.url)) };
239
+ return (
240
+ <ActionSheet
241
+ title={item.title}
242
+ onClose={handlers.onClose}
243
+ top={
244
+ <>
245
+ {/* Number first, as on the card; the sheet always names the owner, even of my own repos [ATT-20]. */}
246
+ <Meta lead={<PlaceText place={{ repo: item.repo, number: item.number, login: null }} />} facts={meta} chips={[...waitChips, ...stackMetaChips(item, targetRow)]} />
247
+ {item.person ? <PersonQuote person={item.person} expanded /> : null}
248
+ {item.waitingOn ? <WaitingOnLine people={item.waitingOn} asked={item.wait?.reason === "question"} expanded /> : null}
249
+ {item.children.length > 0 ? <StackLine rows={item.children} merged={!!item.closedAt} links target={targetRow?.key} /> : null}
250
+ </>
251
+ }
252
+ entries={sheetEntries(item, sessions, actions, handlers, { data: details.data, isLoading: details.isLoading, arrived })}
253
+ // The PR its actions apply to has a size line, named where it isn't the item; an issue's PRs are in its stack line
254
+ // already, so few more come [ATT-06].
255
+ bottom={
256
+ <DetailLines
257
+ details={extra}
258
+ loading={details.isLoading}
259
+ error={details.error}
260
+ linkedLabel={item.kind === "issue" ? "PR" : "Closes"}
261
+ expected={item.target.kind === "pr" ? 1 : 0}
262
+ sizeOf={elsewhere ? item.target.number : undefined}
263
+ />
264
+ }
265
+ />
266
+ );
267
+ }
268
+
269
+ // Everything an item's sheet offers, each saying what it will do [ATT-06]. Rerun's line says more once the checks are in.
270
+ function sheetEntries(item: Item, sessions: AgentSummary[], actions: Actions, handlers: SheetHandlers, details?: SheetDetails): SheetEntry[] {
271
+ return sheetPlan(item, sessions).map((step) => sheetEntry(step, item, actions, handlers, details));
272
+ }
273
+
274
+ function sheetEntry(step: SheetStep, item: Item, actions: Actions, { onPerform, onClose }: SheetHandlers, details?: SheetDetails): SheetEntry {
275
+ const close = (then: () => void) => () => (onClose(), then());
276
+ const open = (agentId: string) => close(() => actions.openAgent(agentId))();
277
+ const withOptions = (label: string, kind: SessionKind) => close(() => actions.startWithOptions({ itemKey: item.key, title: `${label}: ${item.title}`, kind, target: item.target }));
278
+ switch (step.kind) {
279
+ case "session":
280
+ return sessionEntry(step.agent, step.label, open);
281
+ case "ask":
282
+ return { key: step.action, icon: "agent", label: `${step.label}…`, detail: step.detail, onPress: withOptions(step.label, step.session) };
283
+ case "rerun":
284
+ return rerunEntry(step.label, details, (runIds) => close(() => actions.rerun(item, runIds))());
285
+ case "action":
286
+ return { key: step.action, icon: ACTION_ICONS[step.action], label: step.label, detail: step.detail, housekeeping: step.housekeeping, onPress: () => onPerform(step.action) };
287
+ case "github":
288
+ return githubEntry(item, (url) => close(() => void openExternalUrl(url))(), step.pr);
289
+ case "start":
290
+ return startAnotherEntry(step.any, withOptions("Start session", step.session));
291
+ case "dismiss":
292
+ return { key: "dismiss", icon: "dismiss", label: "Dismiss", detail: "Hides it until something new happens on it", housekeeping: true, onPress: close(() => actions.dismiss(item)) };
293
+ }
294
+ }
295
+
296
+ // What a face on a card is to it, where no quote says it: the icon of the tab or section that means the same, so whom I wait on
297
+ // reads like Waiting, and whose comments are left like Changes requested [ATT-19].
298
+ const ROLE_ICON: Record<PersonRole | "waiting", IconName> = { waiting: "hourglass", author: "pencil", changes: "changes" };
299
+
300
+ // The icon sits tight against the faces it explains, apart from the name and time, so they read as one.
301
+ function Badged({ role, children }: { role: keyof typeof ROLE_ICON; children: ReactNode }) {
302
+ const styles = useStyles();
303
+ return (
304
+ <View style={{ flexDirection: "row", alignItems: "center", gap: 2 }}>
305
+ <TablerIcon name={ROLE_ICON[role]} size={16} color={styles.c.foregroundMuted} />
306
+ {children}
307
+ </View>
308
+ );
309
+ }
310
+
311
+ // Who is waiting on me, or who I'm waiting on.
312
+ function PersonQuote({ person, expanded }: { person: NonNullable<Item["person"]>; expanded: boolean }) {
313
+ const styles = useStyles();
314
+ const name = <Text style={{ color: styles.c.foreground, fontSize: 12, fontWeight: "600" }}>{person.login}</Text>;
315
+ // An author line says who, not when: its time meant something different on each tab [ATT-19].
316
+ if (!person.snippet && person.role) {
317
+ const text = person.role === "author" ? `Opened by ${person.login}` : `${person.login}'s comments are left to address, since your last push ${ago(person.since)} ago`;
318
+ return (
319
+ <Hint text={text}>
320
+ <View style={styles.row}>
321
+ <Badged role={person.role}>
322
+ <Avatar url={person.avatarUrl} bot={person.bot} />
323
+ </Badged>
324
+ {name}
325
+ {person.role === "author" ? null : <Text style={styles.muted}>· {ago(person.since)}</Text>}
326
+ </View>
327
+ </Hint>
328
+ );
329
+ }
330
+ const line = (
331
+ <View style={styles.row}>
332
+ <Avatar url={person.avatarUrl} bot={person.bot} />
333
+ {name}
334
+ <Text style={styles.muted}>· {ago(person.since)}</Text>
335
+ </View>
336
+ );
337
+ if (!person.snippet) return line;
338
+ return (
339
+ <View style={styles.quote}>
340
+ {line}
341
+ <Text style={{ color: styles.c.foreground, fontSize: 13, lineHeight: 18 }} numberOfLines={expanded ? undefined : 2}>
342
+ {person.snippet}
343
+ </Text>
344
+ </View>
345
+ );
346
+ }
347
+
348
+ // Pictures on a card before the rest are counted, so a crowd fits a phone; the sheet names everyone.
349
+ const MAX_FACES = 5;
350
+
351
+ // Who my work waits on: one by name, several by picture, named on hover, and each by name in the sheet [WAI-02].
352
+ // On an issue they're who my question tagged; on a PR, reviewers since my last push or reply [WAI-02, ATT-19].
353
+ function WaitingOnLine({ people, asked, expanded }: { people: WaitingOn[]; asked: boolean; expanded: boolean }) {
354
+ const styles = useStyles();
355
+ const [hovered, setHovered] = useState<string | null>(null);
356
+ const name = (login: string) => (
357
+ <Text style={{ color: styles.c.foreground, fontSize: 12, fontWeight: "600", flexShrink: 1 }} numberOfLines={1}>
358
+ {login}
359
+ </Text>
360
+ );
361
+ const since = (at: string) => <Text style={styles.muted}>· {ago(at)}</Text>;
362
+ const explain = (logins: string[], at: string) => `Waiting on ${logins.join(", ")} since ${asked ? "you asked" : "your last push or reply"}, ${ago(at)} ago`;
363
+ if (expanded || people.length === 1) {
364
+ return (
365
+ <View style={{ gap: 6 }}>
366
+ {people.map((who) => (
367
+ <Hint key={who.login} text={explain([who.login], who.since)}>
368
+ <View style={styles.row}>
369
+ <Badged role="waiting">
370
+ <Avatar url={who.avatarUrl} team={who.team} />
371
+ </Badged>
372
+ {name(who.login)}
373
+ {since(who.since)}
374
+ </View>
375
+ </Hint>
376
+ ))}
377
+ </View>
378
+ );
379
+ }
380
+ const earliest = people.map((who) => who.since).sort()[0];
381
+ return (
382
+ <Hint text={explain(people.map((who) => who.login), earliest)}>
383
+ <View style={styles.row}>
384
+ <Badged role="waiting">
385
+ <View style={{ flexDirection: "row", alignItems: "center", gap: 4 }}>
386
+ {people.slice(0, MAX_FACES).map((who) => (
387
+ <View key={who.login} onPointerEnter={() => setHovered(who.login)} onPointerLeave={() => setHovered((current) => (current === who.login ? null : current))}>
388
+ <Avatar url={who.avatarUrl} team={who.team} />
389
+ </View>
390
+ ))}
391
+ {people.length > MAX_FACES ? <Text style={styles.muted}>+{people.length - MAX_FACES}</Text> : null}
392
+ </View>
393
+ </Badged>
394
+ {hovered ? name(hovered) : null}
395
+ {since(earliest)}
396
+ </View>
397
+ </Hint>
398
+ );
399
+ }
400
+
401
+ // Stacked or linked PRs as a connected line; collapsed, only those needing attention [ATT-03, ATT-04].
402
+ // In the sheet each row opens its PR on GitHub [ATT-12], and the PR an issue's actions apply to is tinted and says so [ATT-06].
403
+ function StackLine({ rows, merged, links = false, target }: { rows: SubRow[]; merged: boolean; links?: boolean; target?: string }) {
404
+ const styles = useStyles();
405
+ return (
406
+ <View>
407
+ {rows.map((row, index) => (
408
+ <StackRow key={row.key} url={row.url} number={row.number} link={links} target={row.key === target}>
409
+ <View style={{ width: 16, alignItems: "center" }}>
410
+ <View style={{ width: 2, flex: 1, backgroundColor: index === 0 ? "transparent" : styles.c.border }} />
411
+ <TablerIcon name={merged ? "merge" : row.draft ? "draft" : "pr"} size={14} color={merged ? styles.c.statusSuccess : row.draft ? styles.c.foregroundMuted : styles.c.statusSuccess} />
412
+ <View style={{ width: 2, flex: 1, backgroundColor: index === rows.length - 1 ? "transparent" : styles.c.border }} />
413
+ </View>
414
+ <View style={{ flex: 1, paddingVertical: 3, gap: 2 }}>
415
+ <Text style={{ color: styles.c.foreground, fontSize: 13 }} numberOfLines={1}>
416
+ {row.title}
417
+ </Text>
418
+ <View style={[styles.wrap, { columnGap: 10, rowGap: 2 }]}>
419
+ <Meta lead={<NumberText number={row.number} />} facts={merged && row.mergedBy ? [`merged by ${row.mergedBy}`] : []} chips={row.chips} />
420
+ {row.key === target ? <Text style={{ color: styles.action, fontSize: 12, fontWeight: "600" }}>actions apply here</Text> : null}
421
+ </View>
422
+ </View>
423
+ {links ? (
424
+ <View style={{ justifyContent: "center", paddingHorizontal: 4 }}>
425
+ <TablerIcon name="github" size={14} color={styles.c.foregroundMuted} />
426
+ </View>
427
+ ) : null}
428
+ </StackRow>
429
+ ))}
430
+ </View>
431
+ );
432
+ }
433
+
434
+ function StackRow({ url, number, link, target = false, children }: { url: string; number: number; link: boolean; target?: boolean; children: ReactNode }) {
435
+ const styles = useStyles();
436
+ const { hovered, hover } = useHover();
437
+ const tinted = target ? { backgroundColor: tint(styles.action, 0.1), borderRadius: 6 } : null;
438
+ if (!link) return <View style={[styles.row, { alignItems: "stretch" }, tinted]}>{children}</View>;
439
+ return (
440
+ <Pressable
441
+ accessibilityRole="link"
442
+ accessibilityLabel={`Open PR #${number} on GitHub`}
443
+ onPress={() => void openExternalUrl(url)}
444
+ {...hover}
445
+ style={({ pressed }) => [styles.row, { alignItems: "stretch", borderRadius: 6, backgroundColor: pressed || hovered ? styles.c.surface2 : target ? tint(styles.action, 0.1) : "transparent" }]}
446
+ >
447
+ {children}
448
+ </Pressable>
449
+ );
450
+ }