paseo-follow-up 2.4.0-beta.0 → 2.4.0-beta.10
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/OVERVIEW.md +1 -1
- package/client/action-row.tsx +97 -0
- package/client/agents.tsx +12 -3
- package/client/brief-since.tsx +320 -0
- package/client/brief.tsx +72 -29
- package/client/catch-up.tsx +21 -7
- package/client/chat.tsx +1 -1
- package/client/compass-settings.tsx +462 -0
- package/client/dismiss.tsx +6 -4
- package/client/display.tsx +4 -1
- package/client/header.tsx +16 -6
- package/client/home-chrome.tsx +26 -2
- package/client/home-data.ts +11 -3
- package/client/home-list.tsx +32 -20
- package/client/home-view.ts +54 -6
- package/client/home.tsx +122 -29
- package/client/host-slot.tsx +114 -0
- package/client/image-attach.tsx +276 -0
- package/client/inbox.tsx +5 -5
- package/client/job-rows.tsx +3 -3
- package/client/kit.tsx +19 -12
- package/client/list-keys.ts +11 -3
- package/client/merge-button.tsx +1 -1
- package/client/messages.tsx +165 -0
- package/client/more-context.tsx +18 -11
- package/client/morning-brief-settings.tsx +450 -0
- package/client/needs-you.tsx +57 -29
- package/client/new-entry.tsx +21 -0
- package/client/new-settings.tsx +223 -0
- package/client/new.tsx +685 -0
- package/client/onboarding.tsx +4 -4
- package/client/panel.tsx +24 -10
- package/client/pending-answers.ts +25 -5
- package/client/pr-stats-settings.tsx +253 -0
- package/client/pr-stats.tsx +360 -0
- package/client/questions.tsx +57 -30
- package/client/rename.tsx +9 -18
- package/client/report-issue.tsx +16 -27
- package/client/reviewers-button.tsx +114 -0
- package/client/row-actions.ts +23 -9
- package/client/row-menu.tsx +19 -2
- package/client/search-key.ts +25 -5
- package/client/settings.tsx +21 -4
- package/client/tasks.tsx +112 -225
- package/client/theme.ts +16 -0
- package/client/toast-store.ts +1 -1
- package/client/unsent-images.ts +26 -0
- package/client/why-it-matters.tsx +194 -0
- package/index.client.tsx +35 -5
- package/index.server.ts +536 -25
- package/package.json +5 -1
- package/server/about.ts +14 -19
- package/server/agent-actions.ts +65 -11
- package/server/agent-hook.mjs +79 -15
- package/server/agent-parity.ts +85 -8
- package/server/agent-settings.ts +2 -2
- package/server/ai-jobs.ts +23 -9
- package/server/ask.ts +62 -0
- package/server/brief-sources.ts +215 -0
- package/server/check-watches.ts +145 -0
- package/server/compass.ts +753 -0
- package/server/daemon.ts +12 -4
- package/server/dispatch.ts +470 -0
- package/server/engine.ts +101 -18
- package/server/github.ts +15 -2
- package/server/hook-source.ts +79 -15
- package/server/image-store.ts +100 -0
- package/server/image-support.ts +37 -0
- package/server/inbox.ts +10 -4
- package/server/job-guard.ts +71 -0
- package/server/linear-issues.ts +120 -0
- package/server/linear-queue.ts +274 -0
- package/server/linked.ts +4 -7
- package/server/mcp-source.ts +55 -20
- package/server/mcp.mjs +55 -20
- package/server/message-queue.ts +41 -7
- package/server/morning-brief.ts +212 -0
- package/server/obligations.ts +61 -4
- package/server/overseer-prompt-source.ts +1 -1
- package/server/overseer-prompt.md +1 -1
- package/server/overseer.ts +114 -17
- package/server/pr-stats-gate.ts +140 -0
- package/server/pr-stats-store.ts +196 -0
- package/server/pr-stats-sync.ts +228 -0
- package/server/pr-stats.ts +314 -0
- package/server/questions.ts +57 -12
- package/server/ranker.ts +127 -94
- package/server/report-issue-adapter.ts +1 -1
- package/server/scopes.ts +9 -2
- package/server/session-prompt.ts +105 -0
- package/server/source-tools.ts +135 -0
- package/server/tasks.ts +18 -5
- package/server/wait-for-checks.ts +108 -0
- package/shared/activity.ts +41 -5
- package/shared/agent-load.ts +6 -1
- package/shared/agent-settings.ts +28 -7
- package/shared/ask.ts +128 -0
- package/shared/attention.ts +44 -19
- package/shared/brief-since.ts +218 -0
- package/shared/brief-sources.ts +430 -0
- package/shared/brief.ts +1 -1
- package/shared/chat.ts +6 -5
- package/shared/check-watch.ts +129 -0
- package/shared/compass.ts +927 -0
- package/shared/contracts.ts +113 -9
- package/shared/dispatch.ts +506 -0
- package/shared/display.ts +4 -2
- package/shared/headline.ts +10 -6
- package/shared/home.ts +53 -17
- package/shared/images.ts +95 -0
- package/shared/inbox.ts +67 -4
- package/shared/issue-workspace.ts +65 -0
- package/shared/job-rows.ts +8 -8
- package/shared/keep-in-place.ts +22 -0
- package/shared/linear-issues.ts +146 -0
- package/shared/linear-queue.ts +355 -0
- package/shared/list-entries.ts +15 -3
- package/shared/list-keys.ts +21 -3
- package/shared/list.ts +1 -1
- package/shared/model.ts +63 -13
- package/shared/morning-brief.ts +442 -0
- package/shared/new-settings.ts +81 -0
- package/shared/new-view.ts +304 -0
- package/shared/nobody.ts +233 -0
- package/shared/overseer.ts +160 -13
- package/shared/poll.ts +9 -2
- package/shared/pr-stats-page.ts +110 -0
- package/shared/pr-stats-records.ts +169 -0
- package/shared/pr-stats-settings.ts +244 -0
- package/shared/pr-stats.ts +377 -0
- package/shared/priorities.ts +2 -2
- package/shared/questions.ts +155 -3
- package/shared/queue.ts +42 -4
- package/shared/ranker.ts +55 -31
- package/shared/recommend.ts +4 -3
- package/shared/reviewers-click.ts +59 -0
- package/shared/row-menu.ts +77 -11
- package/shared/search-key.ts +38 -4
- package/shared/send-decision.ts +83 -5
- package/shared/send-words.ts +21 -0
- package/shared/sending.ts +8 -6
- package/shared/settings-nav.ts +6 -2
- package/shared/status-invariants.ts +159 -4
- package/shared/status.ts +5 -4
- package/shared/task-due.ts +209 -0
- package/shared/task-dup.ts +46 -0
- package/shared/task-rows.ts +11 -7
- package/shared/task-status.ts +16 -3
- package/shared/task-trigger.ts +4 -1
- package/shared/task-view.ts +123 -0
- package/shared/workweek.ts +24 -0
- package/skills/follow-up/SKILL.md +1 -1
package/OVERVIEW.md
CHANGED
|
@@ -14,7 +14,7 @@ Follow-up watches every pull request a Paseo workspace opens until the work is a
|
|
|
14
14
|
- A Spec link in the header to the page that sums up the workspace, usually the Claude artifact the main agent keeps up to date.
|
|
15
15
|
- An Activity card: repairs sent and finished with how long they took, merges, PR actions and questions.
|
|
16
16
|
- Each stack drawn top to base, merged PRs folded away, and a sheet per PR with checks, reviewers and Merge.
|
|
17
|
-
- Tasks for work that outlives a merge
|
|
17
|
+
- Tasks for work that outlives a merge. Each comes due by fact: its PRs merged or deployed, or a re-check date. A task can also be sent to the agent as a message after a merge or deploy, with an optional delay.
|
|
18
18
|
- A composer pill and a sidebar count that appear only when something needs you; the pill steps through open questions so you can answer without leaving the chat. Home lists every workspace by who is up next, and a larger view opens a workspace in two columns.
|
|
19
19
|
- Compact rows for Follow-up's own tool calls in agent chats, a card for each repair batch, and a card when the agent declares Done.
|
|
20
20
|
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { Platform, View } from "react-native";
|
|
3
|
+
import { Pressable, Text } from "./text";
|
|
4
|
+
import { Icon } from "@getpaseo/plugin/client/ui";
|
|
5
|
+
import { isMac } from "../shared/search-key";
|
|
6
|
+
import type { Bar, BarButton } from "../shared/new-view";
|
|
7
|
+
import { withAlpha, type Colors } from "./theme";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* New's action row, on its own so any surface can mount it (New's dialog, the Morning brief's queue): the bar from
|
|
11
|
+
* `actionBar` (shared/new-view.ts) with the first action filled (↵), the second outlined (⌥↵), the rest under More, or
|
|
12
|
+
* Open it when the source already has a workspace. It starts nothing itself: `onAction(id)` and `onOpen(workspaceId)`
|
|
13
|
+
* are the caller's (New calls follow.dispatch with that action). `more`/`setMore` let a caller control the More
|
|
14
|
+
* list; without them the row keeps its own.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
type Hover = { hovered?: boolean; pressed?: boolean };
|
|
18
|
+
|
|
19
|
+
/** A tappable list of choices under a control (More's actions; New's pickers). */
|
|
20
|
+
export function Choices<T extends string>({ items, onPick, c, compact }: { items: { id: T; label: string; hint?: string; on?: boolean }[]; onPick: (id: T) => void; c: Colors; compact: boolean }) {
|
|
21
|
+
return <View style={{ borderWidth: 1, borderColor: c.border, borderRadius: 8, backgroundColor: c.surface0, overflow: "hidden", marginTop: 6 }}>
|
|
22
|
+
{items.map((it, i) => <Pressable key={it.id} accessibilityRole="button" accessibilityState={{ selected: !!it.on }} onPress={() => onPick(it.id)}
|
|
23
|
+
style={(s: Hover) => ({ flexDirection: "row", alignItems: "center", gap: 8, minHeight: compact ? 44 : 32, paddingHorizontal: 10, borderTopWidth: i ? 1 : 0, borderTopColor: c.border, backgroundColor: s.hovered || s.pressed ? c.surface2 : "transparent" })}>
|
|
24
|
+
<Text numberOfLines={1} style={{ color: c.foreground, fontSize: compact ? 14 : 13, flexShrink: 1 }}>{it.label}</Text>
|
|
25
|
+
{it.hint && <Text numberOfLines={1} style={{ color: c.foregroundMuted, fontSize: 12, flexShrink: 1 }}>{it.hint}</Text>}
|
|
26
|
+
<View style={{ flex: 1 }} />
|
|
27
|
+
{it.on && <Icon name="Check" size={14} color={c.foreground} />}
|
|
28
|
+
</Pressable>)}
|
|
29
|
+
</View>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** A keyboard focus ring (web): the accent, offset from the control. */
|
|
33
|
+
export const focusRing = (c: Colors, focused: boolean | undefined) => focused && Platform.OS === "web" ? { outlineWidth: 2, outlineStyle: "solid", outlineColor: c.accent, outlineOffset: 2 } as object : {};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* One bar button. Filled when primary; a disabled primary drops its fill (neutral surface, muted text) so it never
|
|
37
|
+
* reads as live. `trailing` draws its icon after the label (More ▾).
|
|
38
|
+
*/
|
|
39
|
+
/** `small`: a desktop row's own action (32px, DESIGN's desktop control), not a dialog's bar. Phones stay 44. */
|
|
40
|
+
export function BarBtn({ b, primary, c, compact, disabled, onPress, grow, trailing, small }: { b: BarButton | { name: string; icon: string; key: string | null }; primary: boolean; c: Colors; compact: boolean; disabled: boolean; onPress: () => void; grow?: boolean; trailing?: boolean; small?: boolean }) {
|
|
41
|
+
const filled = primary && !disabled;
|
|
42
|
+
const fg = filled ? c.accentForeground : disabled ? c.foregroundMuted : c.foreground;
|
|
43
|
+
const icon = <Icon name={b.icon} size={small && !compact ? 14 : 15} color={fg} />;
|
|
44
|
+
return <Pressable accessibilityRole="button" accessibilityLabel={b.key && Platform.OS === "web" ? `${b.name} (${b.key})` : b.name} accessibilityState={{ disabled }} disabled={disabled} onPress={onPress}
|
|
45
|
+
style={(s: Hover & { focused?: boolean }) => ({ flexDirection: "row", alignItems: "center", justifyContent: "center", gap: small && !compact ? 6 : 8, minHeight: compact ? (primary ? 48 : 44) : small ? 32 : 36, paddingHorizontal: small && !compact ? 10 : 14, borderRadius: 8,
|
|
46
|
+
// A grown button takes the free width but never less than its name: the row wraps instead (an action's name is never cut).
|
|
47
|
+
...(grow ? { flexGrow: 1 } : {}),
|
|
48
|
+
...(filled ? { backgroundColor: s.pressed ? withAlpha(c.accent, 0.85) : s.hovered ? withAlpha(c.accent, 0.92) : c.accent }
|
|
49
|
+
: { borderWidth: 1, borderColor: c.border, backgroundColor: disabled ? c.surface1 : s.pressed ? c.surface2 : s.hovered ? c.surface1 : c.surface0 }),
|
|
50
|
+
...focusRing(c, s.focused) })}>
|
|
51
|
+
{!trailing && icon}
|
|
52
|
+
<Text numberOfLines={1} style={{ color: fg, fontSize: compact ? 15 : small ? 12 : 13, fontWeight: "600", flexShrink: 0 }}>{b.name}</Text>
|
|
53
|
+
{trailing && icon}
|
|
54
|
+
{b.key && !compact && Platform.OS === "web" && <Text style={{ color: fg, opacity: 0.75, fontSize: 12 }}>{b.key === "⌥↵" && !isMac() ? "Alt ↵" : b.key}</Text>}
|
|
55
|
+
</Pressable>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function ActionRow({ bar, c, compact, onAction, onOpen, more: moreProp, setMore: setMoreProp }: { bar: Bar; c: Colors; compact: boolean; onAction: (id: string) => void; onOpen: (workspaceId: string) => void; more?: boolean; setMore?: (v: boolean) => void }) {
|
|
59
|
+
const [ownMore, setOwnMore] = useState(false);
|
|
60
|
+
const more = moreProp ?? ownMore; const setMore = setMoreProp ?? setOwnMore;
|
|
61
|
+
if (bar.kind === "existing") {
|
|
62
|
+
const off = !!bar.disabled;
|
|
63
|
+
const moreOthers = bar.more.length > 0 && <BarBtn c={c} compact={compact} primary={false} disabled={off} trailing b={{ name: "More", icon: more ? "ChevronUp" : "ChevronDown", key: null }} onPress={() => setMore(!more)} />;
|
|
64
|
+
const open = <BarBtn c={c} compact={compact} primary disabled={false} onPress={() => onOpen(bar.workspaceId)} b={{ name: "Open it", icon: "ExternalLink", key: "↵" }} />;
|
|
65
|
+
const others = bar.others.map(b => <BarBtn key={b.id} c={c} compact={compact} primary={false} disabled={off} b={b} grow={compact} onPress={() => onAction(b.id)} />);
|
|
66
|
+
return <View style={{ gap: 8 }}>
|
|
67
|
+
{more && !off && <Choices c={c} compact={compact} items={bar.more.map(b => ({ id: b.id, label: b.name }))} onPick={id => { setMore(false); onAction(id); }} />}
|
|
68
|
+
{compact ? <>
|
|
69
|
+
{open}
|
|
70
|
+
<Text style={{ color: c.foregroundMuted, fontSize: 12 }}>{off ? `Or start another workspace: ${bar.disabled}` : "Or start another workspace:"}</Text>
|
|
71
|
+
<View style={{ flexDirection: "row", flexWrap: "wrap", gap: 8 }}>{others}{moreOthers}</View>
|
|
72
|
+
</> : <View style={{ flexDirection: "row", alignItems: "center", flexWrap: "wrap", gap: 8 }}>
|
|
73
|
+
{open}
|
|
74
|
+
<Text style={{ color: c.foregroundMuted, fontSize: 12, marginLeft: 8 }}>{off ? bar.disabled : "or start another:"}</Text>
|
|
75
|
+
{others}{moreOthers}
|
|
76
|
+
</View>}
|
|
77
|
+
</View>;
|
|
78
|
+
}
|
|
79
|
+
const disabled = !!bar.disabled;
|
|
80
|
+
const moreBtn = bar.more.length > 0 && <BarBtn c={c} compact={compact} primary={false} disabled={disabled} trailing b={{ name: "More", icon: more ? "ChevronUp" : "ChevronDown", key: null }} onPress={() => setMore(!more)} />;
|
|
81
|
+
return <View style={{ gap: 8 }}>
|
|
82
|
+
{more && !disabled && <Choices c={c} compact={compact} items={bar.more.map(b => ({ id: b.id, label: b.name }))} onPick={id => { setMore(false); onAction(id); }} />}
|
|
83
|
+
{bar.disabled && <Text style={{ color: c.foregroundMuted, fontSize: 12 }}>{bar.disabled}</Text>}
|
|
84
|
+
{compact ? <>
|
|
85
|
+
{bar.primary && <BarBtn c={c} compact primary disabled={disabled} b={bar.primary} onPress={() => onAction(bar.primary!.id)} />}
|
|
86
|
+
<View style={{ flexDirection: "row", flexWrap: "wrap", gap: 8 }}>
|
|
87
|
+
{bar.second && <BarBtn c={c} compact primary={false} disabled={disabled} b={bar.second} grow onPress={() => onAction(bar.second!.id)} />}
|
|
88
|
+
{moreBtn}
|
|
89
|
+
</View>
|
|
90
|
+
</> : <View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
|
|
91
|
+
{bar.primary && <BarBtn c={c} compact={false} primary disabled={disabled} b={bar.primary} onPress={() => onAction(bar.primary!.id)} />}
|
|
92
|
+
{bar.second && <BarBtn c={c} compact={false} primary={false} disabled={disabled} b={bar.second} onPress={() => onAction(bar.second!.id)} />}
|
|
93
|
+
{moreBtn}
|
|
94
|
+
</View>}
|
|
95
|
+
</View>;
|
|
96
|
+
}
|
|
97
|
+
|
package/client/agents.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import { SettingsAction, SettingsCard, SettingsSection, SettingsSelect, Settings
|
|
|
6
6
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
7
7
|
import { agentSettingsRpc, setAgentSettingRpc, setWaitRpc } from "../shared/contracts";
|
|
8
8
|
import { WAIT_HOST_NOTE, WAIT_NOT_ATTACHED, waitNote, waitSwitchCopy } from "../shared/wait";
|
|
9
|
-
import { isJobRole, type AgentRole, type AgentSettingsView, type SavedRole } from "../shared/agent-settings";
|
|
9
|
+
import { OUTSIDE_READS, guardedProvider, hasSame, isJobRole, type AgentRole, type AgentSettingsView, type SavedRole } from "../shared/agent-settings";
|
|
10
10
|
import { NO_PROMPT_MODE, SETTINGS_ORDER, isReset, resetEntry } from "../shared/job-rows";
|
|
11
11
|
import { JobRows, agentSettingsKey, useAgentSettings, type JobExtra } from "./job-rows";
|
|
12
12
|
import { Button, errorText, text, type Theme } from "./kit";
|
|
@@ -36,6 +36,11 @@ export function AgentSettings({ theme, compact }: Pick<PluginSurfaceProps, "them
|
|
|
36
36
|
<SettingsCard>
|
|
37
37
|
<JobRows theme={theme} compact={compact} order={SETTINGS_ORDER} extra={more} />
|
|
38
38
|
</SettingsCard>
|
|
39
|
+
{/* A job role on a provider Follow-up can't take tools from: what it no longer reads, and why (invariant 81). */}
|
|
40
|
+
{(data?.roles ?? []).filter(r => isJobRole(r.role) && !guardedProvider(r.provider) && OUTSIDE_READS[r.role]).map(r => {
|
|
41
|
+
const label = data?.catalog?.providers.find(p => p.id === r.provider)?.label ?? r.provider;
|
|
42
|
+
return <Text key={r.role} accessibilityRole="alert" style={[t.meta, { color: c.statusWarning, paddingHorizontal: 4 }]}>{unguardedLine(r.role, label)}</Text>;
|
|
43
|
+
})}
|
|
39
44
|
{/* Once, after the rows: what can't be picked and why (the pickers only list what can). */}
|
|
40
45
|
{!!data?.catalog && unavailableLine(data.catalog.providers) && <Text style={[t.meta, { paddingHorizontal: 4 }]}>{unavailableLine(data.catalog.providers)}</Text>}
|
|
41
46
|
</SettingsSection>;
|
|
@@ -81,7 +86,7 @@ function RoleMore({ r, save, busy, theme, compact, invalid }: { r: Role; save: (
|
|
|
81
86
|
const role = r.role;
|
|
82
87
|
const jobs = isJobRole(role);
|
|
83
88
|
const current = catalog.find(p => p.id === r.provider);
|
|
84
|
-
const base: SavedRole = { provider: r.provider, model: r.model, thinking: r.thinking, ...(jobs ? {} : { mode: r.mode }), ...(role
|
|
89
|
+
const base: SavedRole = { provider: r.provider, model: r.model, thinking: r.thinking, ...(jobs ? {} : { mode: r.mode }), ...(hasSame(role) ? { same: r.same } : {}),
|
|
85
90
|
...(jobs ? { dailyCap: r.dailyCap ?? undefined, maxPromptChars: r.maxPromptChars ?? undefined } : {}), ...(role === "ranker" ? { cadenceMinutes: r.cadenceMinutes ?? undefined } : {}) };
|
|
86
91
|
const set = (patch: SavedRole) => save({ ...base, ...patch });
|
|
87
92
|
const modes = current?.modes ?? [];
|
|
@@ -113,9 +118,13 @@ function RoleMore({ r, save, busy, theme, compact, invalid }: { r: Role; save: (
|
|
|
113
118
|
</>;
|
|
114
119
|
}
|
|
115
120
|
|
|
116
|
-
const roleDefaultText = (role: AgentRole) => role === "recovery" ? "the main agent's setup" : role === "overseer" ? "Claude, newest Opus" : role === "about" ? "Claude Haiku" : "Claude Sonnet, hourly";
|
|
121
|
+
const roleDefaultText = (role: AgentRole) => role === "recovery" ? "the main agent's setup" : role === "dispatch" ? "the Overseer's agent" : role === "overseer" ? "Claude, newest Opus" : role === "about" ? "Claude Haiku" : "Claude Sonnet, hourly";
|
|
117
122
|
/** "Not available in Paseo: Claude and Pi (turned off in Paseo); Antigravity (not installed)." Grouped by reason; a
|
|
118
123
|
* provider whose name is also on a ready one isn't listed, so the line never contradicts the rows. */
|
|
124
|
+
/** "On OpenCode, AI priority doesn't rank, since what it reads was written by other people…" (invariant 81). */
|
|
125
|
+
export const unguardedLine = (role: AgentRole, label: string) =>
|
|
126
|
+
`On ${label}, ${OUTSIDE_READS[role]}, since what they read was written by other people and Follow-up can't take ${label}'s tools away. Pick Claude or Codex for all of it.`;
|
|
127
|
+
|
|
119
128
|
function unavailableLine(providers: readonly { label: string; available: boolean; reason: string | null }[]): string | null {
|
|
120
129
|
const ready = new Set(providers.filter(p => p.available).map(p => p.label));
|
|
121
130
|
const groups = new Map<string, string[]>();
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
+
import { Platform, View } from "react-native";
|
|
3
|
+
import { Pressable, Text } from "./text";
|
|
4
|
+
import { useRpc } from "@getpaseo/plugin/client";
|
|
5
|
+
import { Icon, ScrollView, useToast } from "@getpaseo/plugin/client/ui";
|
|
6
|
+
import { dispatchActionsRpc, dispatchRpc, linearQueueRpc, sweepQueueRpc } from "../shared/contracts";
|
|
7
|
+
import { changeChip, openedLine, queueRowMeta, sinceBlock, type SinceChange, type SinceLine } from "../shared/brief-since";
|
|
8
|
+
import { nobodyRow, type CompassSince } from "../shared/nobody";
|
|
9
|
+
import { PriorityLine } from "./home-chrome";
|
|
10
|
+
import { actionIcon, stateIcon } from "../shared/new-view";
|
|
11
|
+
import type { QueueNeeds } from "./home-view";
|
|
12
|
+
import type { DispatchAction } from "../shared/dispatch";
|
|
13
|
+
import { errorText } from "../shared/errors";
|
|
14
|
+
import { age } from "../shared/inbox";
|
|
15
|
+
import { BarBtn, focusRing } from "./action-row";
|
|
16
|
+
import { DismissX, RevealScope, useDismiss } from "./dismiss";
|
|
17
|
+
import { Button, text, type Theme } from "./kit";
|
|
18
|
+
import { openNew } from "./new";
|
|
19
|
+
import { withAlpha, type Colors } from "./theme";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The Morning brief's Linear queue on screen (docs/morning-brief.md#in-the-brief): the "Since" block in the brief pane,
|
|
23
|
+
* the queue screen it opens ("47 issues by priority ›"), and decision Q8's raised issues in Needs you. Words come from
|
|
24
|
+
* shared/brief-since.ts; the data is `follow.linear-queue` (server/linear-queue.ts). Starting work is New's: the brief's
|
|
25
|
+
* lines carry New's own actions (follow.dispatch, Q9) and ⋯ opens New on the issue; a queue row's Start… opens New.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
type Workspace = { workspaceId: string; title: string } | null;
|
|
29
|
+
type QueueIssueRow = { key: string; title: string; priority: number; state: string | null; stateType: string | null; due: string | null; url: string | null; workspace: Workspace; change: string | null;
|
|
30
|
+
createdAt?: string | null; creator?: string | null; openedByYou?: boolean | null };
|
|
31
|
+
type QueueViewData = {
|
|
32
|
+
status: { sweptAt: string | null; complete: boolean | null; running: boolean; total: number; stale: boolean; timeZone: string; sweepAt: string; last: { ok: boolean; error: string | null } | null };
|
|
33
|
+
since: string | null;
|
|
34
|
+
changes: SinceChange[];
|
|
35
|
+
groups: { priority: number; name: string; count: number; issues: QueueIssueRow[] }[];
|
|
36
|
+
counts: { all: number; noWorkspace: number; changed: number };
|
|
37
|
+
more: number;
|
|
38
|
+
raised: unknown[];
|
|
39
|
+
/** What Compass heard since the same point: the one Since block (design §8). */
|
|
40
|
+
compass?: CompassSince | null;
|
|
41
|
+
};
|
|
42
|
+
type Filter = "all" | "no-workspace" | "changed";
|
|
43
|
+
type Nav = { openWorkspace(i: { workspaceId: string }): void } | undefined;
|
|
44
|
+
type Hover = { hovered?: boolean; pressed?: boolean; focused?: boolean };
|
|
45
|
+
|
|
46
|
+
const hhmm = (iso: string, timeZone: string) => new Date(iso).toLocaleTimeString("en-GB", { hour: "2-digit", minute: "2-digit", hour12: false, timeZone });
|
|
47
|
+
|
|
48
|
+
/** One read of the queue view; `open` marks the developer's read (only the brief pane passes it, once per mount). */
|
|
49
|
+
function useQueueView(input: { open?: boolean; filter?: Filter }) {
|
|
50
|
+
const read = useRpc(linearQueueRpc);
|
|
51
|
+
const [view, setView] = useState<QueueViewData | null>(null);
|
|
52
|
+
const [error, setError] = useState<string | null>(null);
|
|
53
|
+
const opened = useRef(false);
|
|
54
|
+
const load = useCallback(async (filter?: Filter) => {
|
|
55
|
+
const open = !!input.open && !opened.current;
|
|
56
|
+
opened.current = opened.current || open;
|
|
57
|
+
try { const v = await read({ ...(open ? { open: true } : {}), ...(filter ?? input.filter ? { filter: filter ?? input.filter } : {}) }) as QueueViewData; setView(v); setError(null); return v; }
|
|
58
|
+
catch (e) { setError(errorText(e)); return null; }
|
|
59
|
+
}, [read, input.open, input.filter]);
|
|
60
|
+
useEffect(() => { void load(); }, [load]);
|
|
61
|
+
return { view, error, reload: load };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** New's configured actions (Settings → New), read once per mount: the brief's lines show the first two. */
|
|
65
|
+
function useActions() {
|
|
66
|
+
const read = useRpc(dispatchActionsRpc);
|
|
67
|
+
const [actions, setActions] = useState<DispatchAction[]>([]);
|
|
68
|
+
useEffect(() => { let live = true; read({}).then(r => { if (live) setActions(r.actions); }).catch(() => undefined); return () => { live = false; }; }, [read]);
|
|
69
|
+
return actions;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const ICON_TONE = (l: SinceLine, c: Colors) => l.warn ? c.statusWarning : c.foregroundMuted;
|
|
73
|
+
|
|
74
|
+
/** A Since line's actions (Q9): New's first two, bordered (Catch up stays the one filled button), and ⋯ for New itself. */
|
|
75
|
+
function LineActions({ source, actions, c, compact, onStarted }: { source: string; actions: DispatchAction[]; c: Colors; compact: boolean; onStarted: () => void }) {
|
|
76
|
+
const send = useRpc(dispatchRpc);
|
|
77
|
+
const toast = useToast();
|
|
78
|
+
const [busy, setBusy] = useState<string | null>(null);
|
|
79
|
+
const start = async (a: DispatchAction) => {
|
|
80
|
+
if (busy) return;
|
|
81
|
+
setBusy(a.id);
|
|
82
|
+
try { await send({ source, actionId: a.id }); toast.show(`${a.name} started for ${source}. Undo is on Home.`, { variant: "success" }); onStarted(); }
|
|
83
|
+
// A source New can't place on its own (two projects fit) opens New on it, where the developer picks.
|
|
84
|
+
catch (e) { toast.error(errorText(e)); openNew({ source }); }
|
|
85
|
+
finally { setBusy(null); }
|
|
86
|
+
};
|
|
87
|
+
// Each button keeps its whole label (never squeezed to "Plan as ar…"): a row that doesn't fit wraps instead.
|
|
88
|
+
return <View style={{ flexDirection: "row", flexWrap: "wrap", gap: 8, marginTop: 6 }}>
|
|
89
|
+
{actions.slice(0, 2).map(a => <BarBtn key={a.id} c={c} compact={compact} small primary={false} disabled={!!busy} b={{ name: busy === a.id ? `${a.name}…` : a.name, icon: actionIcon(a.icon), key: null }} onPress={() => void start(a)} />)}
|
|
90
|
+
<Pressable accessibilityRole="button" accessibilityLabel={`More ways to start ${source} in New`} onPress={() => openNew({ source })}
|
|
91
|
+
style={(s: Hover) => ({ minHeight: compact ? 44 : 32, minWidth: compact ? 44 : 32, alignItems: "center", justifyContent: "center", borderRadius: 8, backgroundColor: s.pressed ? c.surface2 : s.hovered ? c.surface1 : "transparent", ...focusRing(c, s.focused) })}>
|
|
92
|
+
<Icon name="Ellipsis" size={16} color={c.foreground} />
|
|
93
|
+
</Pressable>
|
|
94
|
+
</View>;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function Line({ l, c, compact, actions, onStarted, navigation }: { l: SinceLine; c: Colors; compact: boolean; actions: DispatchAction[]; onStarted: () => void; navigation: Nav }) {
|
|
98
|
+
const t = text(c, compact);
|
|
99
|
+
const ws = l.workspace;
|
|
100
|
+
return <View style={{ flexDirection: "row", alignItems: "flex-start", gap: 10, paddingVertical: 4 }}>
|
|
101
|
+
<View style={{ paddingTop: 3, width: 16, alignItems: "center" }}><Icon name={l.icon} size={15} color={ICON_TONE(l, c)} /></View>
|
|
102
|
+
<View style={{ flex: 1, minWidth: 0 }}>
|
|
103
|
+
{/* One label for the line, so a screen reader says it once instead of fragments and "·" separators. */}
|
|
104
|
+
<Text accessibilityLabel={[l.head, l.meta, l.sub].filter(Boolean).join(". ")} style={t.body}><Text style={{ fontWeight: "600", color: c.foreground }}>{l.head}</Text>{l.meta ? <Text style={{ color: c.foregroundMuted }}> · {l.meta}</Text> : null}</Text>
|
|
105
|
+
{!!l.sub && (ws && navigation
|
|
106
|
+
? <Pressable accessibilityRole="link" accessibilityLabel={`Open ${ws.title}`} onPress={() => navigation.openWorkspace({ workspaceId: ws.workspaceId })} style={(s: Hover) => ({ alignSelf: "flex-start", ...focusRing(c, s.focused) })}>
|
|
107
|
+
<Text numberOfLines={2} style={t.meta}>{l.sub}</Text>
|
|
108
|
+
</Pressable>
|
|
109
|
+
: <Text numberOfLines={2} style={t.meta}>{l.sub}</Text>)}
|
|
110
|
+
{!!l.source && actions.length > 0 && <LineActions source={l.source} actions={actions} c={c} compact={compact} onStarted={onStarted} />}
|
|
111
|
+
</View>
|
|
112
|
+
</View>;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** The brief pane's "Since Friday · your Linear queue" block. Opening it is the developer's read (follow.linear-queue open). */
|
|
116
|
+
export function SinceBlock({ theme, compact, openQueue, onStarted, navigation, raised, revision }: { theme: Theme; compact: boolean; openQueue: () => void; onStarted: () => void; navigation: Nav; raised: ReadonlySet<string>; revision: string }) {
|
|
117
|
+
const c = theme.colors; const t = text(c, compact);
|
|
118
|
+
const { view, error, reload } = useQueueView({ open: true });
|
|
119
|
+
// The home feed's queue revision moved (a sweep ended, or a dismissal): an open brief pane re-reads, no timer.
|
|
120
|
+
const seen = useRef(revision);
|
|
121
|
+
useEffect(() => { if (seen.current === revision) return; seen.current = revision; void reload(); }, [revision, reload]);
|
|
122
|
+
const actions = useActions();
|
|
123
|
+
if (error && !view) return <View style={{ gap: 4, marginTop: 6 }}>
|
|
124
|
+
<Text accessibilityRole="header" style={t.section}>Your Linear queue</Text>
|
|
125
|
+
<Text style={t.meta}>Couldn't read it: {error}</Text>
|
|
126
|
+
</View>;
|
|
127
|
+
// Nothing swept yet and nothing to say: no block (a fresh install before its first sweep, or no Linear).
|
|
128
|
+
if (!view || (!view.status.sweptAt && !view.changes.length && !view.compass?.lines.length)) return null;
|
|
129
|
+
const now = Date.now();
|
|
130
|
+
const b = sinceBlock(view, now, view.status.timeZone, raised);
|
|
131
|
+
const link = <Pressable accessibilityRole="link" accessibilityLabel={`Open your Linear queue: ${b.link}`} onPress={openQueue} hitSlop={compact ? 0 : 8}
|
|
132
|
+
style={(s: Hover) => ({ flexDirection: "row", alignItems: "center", gap: 4, minHeight: compact ? 44 : undefined, ...focusRing(c, s.focused) })}>
|
|
133
|
+
<Text style={[t.small, { color: c.foreground, textDecorationLine: "underline" }]}>{b.link}</Text>
|
|
134
|
+
<Icon name="ChevronRight" size={14} color={c.foregroundMuted} />
|
|
135
|
+
</Pressable>;
|
|
136
|
+
// The section gap after the last line too, so "Waiting on others" doesn't run on from it.
|
|
137
|
+
return <View style={{ gap: 4, marginTop: 6, marginBottom: compact ? 8 : 16 }}>
|
|
138
|
+
<View style={{ flexDirection: compact ? "column" : "row", alignItems: compact ? "flex-start" : "center", gap: compact ? 0 : 8 }}>
|
|
139
|
+
<Text accessibilityRole="header" style={[t.section, { flex: compact ? undefined : 1 }]}>{b.title}</Text>
|
|
140
|
+
{!compact && link}
|
|
141
|
+
</View>
|
|
142
|
+
{view.status.stale && view.status.sweptAt && <Text style={[t.meta, { color: c.statusWarning }]}>The last sweep didn't finish, so this is {hhmm(view.status.sweptAt, view.status.timeZone)}'s queue.</Text>}
|
|
143
|
+
{b.empty ? <Text style={t.meta}>{b.empty}</Text> : b.lines.map(l => <Line key={l.id} l={l} c={c} compact={compact} actions={actions} onStarted={onStarted} navigation={navigation} />)}
|
|
144
|
+
{b.more > 0 && <Text style={t.meta}>{b.more} more changed. The queue's Changed filter has them.</Text>}
|
|
145
|
+
{compact && link}
|
|
146
|
+
</View>;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// ---------- the queue screen ----------
|
|
150
|
+
|
|
151
|
+
const FILTERS: { id: Filter; label: string; count: (v: QueueViewData) => number }[] = [
|
|
152
|
+
{ id: "all", label: "All", count: v => v.counts.all },
|
|
153
|
+
{ id: "no-workspace", label: "No workspace", count: v => v.counts.noWorkspace },
|
|
154
|
+
{ id: "changed", label: "Changed", count: v => v.counts.changed },
|
|
155
|
+
];
|
|
156
|
+
|
|
157
|
+
/** "opened by Dana · 12 days ago", with the exact time as the desktop tooltip (React Native Web drops `title`, so it goes on the node). */
|
|
158
|
+
function OpenedText({ text: words, tooltip }: { text: string; tooltip: string }) {
|
|
159
|
+
const ref = useRef<View | null>(null);
|
|
160
|
+
useEffect(() => { if (Platform.OS === "web") (ref.current as unknown as { setAttribute?: (k: string, v: string) => void } | null)?.setAttribute?.("title", tooltip); }, [tooltip]);
|
|
161
|
+
return <Text ref={ref as never}>{words}</Text>;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function QueueRow({ i, change, c, compact, timeZone, navigation }: { i: QueueIssueRow; change: SinceChange | undefined; c: Colors; compact: boolean; timeZone: string; navigation: Nav }) {
|
|
165
|
+
const t = text(c, compact);
|
|
166
|
+
const now = Date.now();
|
|
167
|
+
const chip = changeChip(change ?? null, now, timeZone);
|
|
168
|
+
const meta = queueRowMeta(i, now, timeZone, change);
|
|
169
|
+
const opened = openedLine({ createdAt: i.createdAt ?? null, creator: i.creator ?? null }, i.openedByYou ?? null, now, timeZone);
|
|
170
|
+
const ws = i.workspace;
|
|
171
|
+
const open = ws ? () => navigation?.openWorkspace({ workspaceId: ws.workspaceId }) : () => openNew({ source: i.key });
|
|
172
|
+
const label = `${i.key} ${i.title}. ${meta}${opened ? `. ${opened.label}` : ""}${chip ? `. ${chip.text}` : ""}${ws ? `. In ${ws.title}` : ". No workspace"}`;
|
|
173
|
+
const body = <View style={{ flexDirection: "row", alignItems: "flex-start", gap: 10, flex: 1, minWidth: 0 }}>
|
|
174
|
+
<View style={{ paddingTop: 2 }}><Icon name={stateIcon(i.stateType)} size={15} color={c.foregroundMuted} /></View>
|
|
175
|
+
<View style={{ flex: 1, minWidth: 0, gap: 2 }}>
|
|
176
|
+
<Text style={t.body}><Text style={{ color: c.foregroundMuted }}>{i.key}</Text> {i.title}</Text>
|
|
177
|
+
<View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", columnGap: 8, rowGap: 4 }}>
|
|
178
|
+
{/* One run of quiet ink, so a phone wraps it word by word and never cuts the state: "Todo · due Wed · opened by Dana · 12 days ago". */}
|
|
179
|
+
{(!!meta || !!opened) && <Text style={t.meta}>{meta}{opened && <OpenedText text={`${meta ? " · " : ""}${opened.text}`} tooltip={opened.label} />}</Text>}
|
|
180
|
+
{/* The change since the brief: a tinted chip, so the Changed filter's subjects stand out from the plain meta. */}
|
|
181
|
+
{chip && <View style={{ flexDirection: "row", alignItems: "center", gap: 4, paddingHorizontal: 6, paddingVertical: 1, borderRadius: 5, backgroundColor: withAlpha(chip.warn ? c.statusWarning : c.foregroundMuted, chip.warn ? 0.12 : 0.1) }}>
|
|
182
|
+
{chip.icon && <Icon name={chip.icon} size={12} color={chip.warn ? c.statusWarning : c.foregroundMuted} />}
|
|
183
|
+
<Text style={[t.meta, { color: chip.warn ? c.statusWarning : c.foreground }]}>{chip.text}</Text>
|
|
184
|
+
</View>}
|
|
185
|
+
{/* Phones: the workspace is a word on the meta line; the row itself opens it. */}
|
|
186
|
+
{compact && ws && <View style={{ flexDirection: "row", alignItems: "center", gap: 4 }}><Icon name="Folder" size={12} color={c.foregroundMuted} /><Text numberOfLines={1} style={[t.meta, { color: c.foreground }]}>{ws.title}</Text></View>}
|
|
187
|
+
</View>
|
|
188
|
+
</View>
|
|
189
|
+
</View>;
|
|
190
|
+
// Phones: the row is the target (44px+), opening the workspace or New on the issue; no column of identical buttons.
|
|
191
|
+
if (compact) return <Pressable accessibilityRole="button" accessibilityLabel={label} accessibilityHint={ws ? `Opens ${ws.title}` : "Opens New on this issue"} disabled={!!ws && !navigation} onPress={open}
|
|
192
|
+
style={(s: Hover) => ({ flexDirection: "row", alignItems: "center", gap: 8, minHeight: 56, paddingVertical: 10, borderBottomWidth: 1, borderBottomColor: withAlpha(c.border, 0.6), backgroundColor: s.pressed ? c.surface2 : "transparent", ...focusRing(c, s.focused) })}>
|
|
193
|
+
{body}
|
|
194
|
+
<Icon name={ws ? "ChevronRight" : "Play"} size={15} color={c.foregroundMuted} />
|
|
195
|
+
</Pressable>;
|
|
196
|
+
// Desktop: the workspace chip, or a quiet Start… (Catch up stays the one filled button, and 20 rows of bordered
|
|
197
|
+
// buttons would be a wall).
|
|
198
|
+
const right = ws
|
|
199
|
+
? <Pressable accessibilityRole="button" accessibilityLabel={`Open ${ws.title}`} disabled={!navigation} onPress={open}
|
|
200
|
+
style={(s: Hover) => ({ flexDirection: "row", alignItems: "center", gap: 6, minHeight: 32, paddingHorizontal: 10, borderRadius: 8, borderWidth: 1, borderColor: c.border, backgroundColor: s.pressed ? c.surface2 : s.hovered ? c.surface1 : "transparent", maxWidth: 240, ...focusRing(c, s.focused) })}>
|
|
201
|
+
<Icon name="Folder" size={14} color={c.foregroundMuted} />
|
|
202
|
+
<Text numberOfLines={1} style={[t.small, { fontSize: 12, color: c.foreground, flexShrink: 1 }]}>{ws.title}</Text>
|
|
203
|
+
<Icon name="ChevronRight" size={14} color={c.foregroundMuted} />
|
|
204
|
+
</Pressable>
|
|
205
|
+
: <Pressable accessibilityRole="button" accessibilityLabel={`Start ${i.key} in New`} onPress={open}
|
|
206
|
+
style={(s: Hover) => ({ flexDirection: "row", alignItems: "center", gap: 6, minHeight: 32, paddingHorizontal: 10, borderRadius: 8, backgroundColor: s.pressed ? c.surface2 : s.hovered ? c.surface1 : "transparent", ...focusRing(c, s.focused) })}>
|
|
207
|
+
<Icon name="Play" size={13} color={c.foregroundMuted} />
|
|
208
|
+
<Text style={[t.small, { fontSize: 12, color: c.foreground, fontWeight: "500" }]}>Start…</Text>
|
|
209
|
+
</Pressable>;
|
|
210
|
+
return <View accessibilityLabel={label} style={{ flexDirection: "row", alignItems: "center", gap: 12, paddingVertical: 8 }}>
|
|
211
|
+
{body}
|
|
212
|
+
{right}
|
|
213
|
+
</View>;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/** The queue screen (`?view=queue`): every issue by Linear priority, filters All / No workspace / Changed (Q10). */
|
|
217
|
+
export function QueueScreen({ theme, compact, onHome, navigation }: { theme: Theme; compact: boolean; onHome: () => void; navigation: Nav }) {
|
|
218
|
+
const c = theme.colors; const t = text(c, compact);
|
|
219
|
+
const [filter, setFilter] = useState<Filter>("all");
|
|
220
|
+
const { view, error, reload } = useQueueView({ filter });
|
|
221
|
+
const sweep = useRpc(sweepQueueRpc);
|
|
222
|
+
const toast = useToast();
|
|
223
|
+
const [sweeping, setSweeping] = useState(false);
|
|
224
|
+
// Sweep now replies at once (`wait: false`): the screen reads the view every 3 s while the sweep runs (up to 2 min),
|
|
225
|
+
// so a slow Linear never holds the button's RPC.
|
|
226
|
+
const sweepNow = async () => {
|
|
227
|
+
setSweeping(true);
|
|
228
|
+
try {
|
|
229
|
+
await sweep({ wait: false });
|
|
230
|
+
for (let n = 0; n < 40; n++) {
|
|
231
|
+
await new Promise(r => setTimeout(r, 3000));
|
|
232
|
+
const v = await reload();
|
|
233
|
+
if (!v?.status.running) { if (v?.status.last && !v.status.last.ok) toast.error(v.status.last.error ?? "The sweep failed."); break; }
|
|
234
|
+
}
|
|
235
|
+
} catch (e) { toast.error(errorText(e)); } finally { setSweeping(false); }
|
|
236
|
+
};
|
|
237
|
+
const tz = view?.status.timeZone ?? Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
238
|
+
const changes = new Map((view?.changes ?? []).map(ch => [ch.key, ch]));
|
|
239
|
+
const swept = view?.status.sweptAt ? `Swept ${hhmm(view.status.sweptAt, tz)}${view.status.complete === false ? " · partial" : ""}` : "Not swept yet";
|
|
240
|
+
return <ScrollView style={{ flex: 1, backgroundColor: c.surface0 }} contentContainerStyle={{ padding: compact ? 16 : 28, gap: 12, maxWidth: 880, width: "100%", alignSelf: "center" }}>
|
|
241
|
+
<View style={{ flexDirection: "row", alignItems: "center", flexWrap: "wrap", gap: 8 }}>
|
|
242
|
+
{!compact && <Button theme={theme} compact={compact} kind="ghost" icon="ArrowLeft" title="Brief" onPress={onHome} />}
|
|
243
|
+
<Text accessibilityRole="header" style={[t.title, { fontSize: 20, lineHeight: 26, flex: 1 }]}>Your Linear queue</Text>
|
|
244
|
+
{!compact && <Text style={t.meta}>{swept}</Text>}
|
|
245
|
+
<Button theme={theme} compact={compact} kind="secondary" icon="RefreshCw" title={sweeping || view?.status.running ? "Sweeping…" : "Sweep now"} loading={sweeping} disabled={sweeping} onPress={() => void sweepNow()} />
|
|
246
|
+
</View>
|
|
247
|
+
{compact && <Text style={[t.meta, { marginTop: -6 }]}>{swept}{view ? ` · ${view.counts.all} issue${view.counts.all === 1 ? "" : "s"}` : ""}</Text>}
|
|
248
|
+
{view?.status.last && !view.status.last.ok && <Text style={[t.meta, { color: c.statusWarning }]}>The last sweep failed{view.status.last.error ? `: ${view.status.last.error}` : ""}. This is {view.status.sweptAt ? `${hhmm(view.status.sweptAt, tz)}'s` : "the last"} queue.</Text>}
|
|
249
|
+
<View accessibilityRole="tablist" style={{ flexDirection: "row", alignSelf: compact ? "stretch" : "flex-start", padding: 3, gap: 2, borderRadius: 9, borderWidth: 1, borderColor: c.border, backgroundColor: c.surface1 }}>
|
|
250
|
+
{FILTERS.map(f => {
|
|
251
|
+
const on = f.id === filter;
|
|
252
|
+
return <Pressable key={f.id} accessibilityRole="tab" accessibilityState={{ selected: on }} accessibilityLabel={`${f.label}${view ? `, ${f.count(view)}` : ""}`} onPress={() => setFilter(f.id)}
|
|
253
|
+
style={(s: Hover) => ({ flexGrow: compact ? 1 : 0, alignItems: "center", justifyContent: "center", minHeight: compact ? 44 : 30, paddingHorizontal: 12, borderRadius: 7, backgroundColor: on ? c.surface0 : s.hovered ? withAlpha(c.foreground, 0.05) : "transparent", ...(on ? { borderWidth: 1, borderColor: c.border } : {}), ...focusRing(c, s.focused) })}>
|
|
254
|
+
<Text numberOfLines={1} style={[t.small, { color: on ? c.foreground : c.foregroundMuted, fontWeight: on ? "600" : "400" }]}>{f.label}{view ? ` ${f.count(view)}` : ""}</Text>
|
|
255
|
+
</Pressable>;
|
|
256
|
+
})}
|
|
257
|
+
</View>
|
|
258
|
+
{error && <Text style={[t.meta, { color: c.statusDanger }]}>{error}</Text>}
|
|
259
|
+
{!view && !error && <Text style={t.meta}>Reading the queue…</Text>}
|
|
260
|
+
{view && !view.groups.length && <Text style={t.meta}>{filter === "all" ? "Nothing is assigned to you in the queue's states." : filter === "changed" ? "Nothing changed since you last read the brief." : "Every issue in your queue has a workspace."}</Text>}
|
|
261
|
+
{view?.groups.map(g => <View key={g.priority} style={{ gap: 0 }}>
|
|
262
|
+
<Text accessibilityRole="header" style={[t.section, { marginTop: 8 }]}>{g.name} · {g.count}</Text>
|
|
263
|
+
{g.issues.map(i => <QueueRow key={i.key} i={i} change={changes.get(i.key)} c={c} compact={compact} timeZone={tz} navigation={navigation} />)}
|
|
264
|
+
</View>)}
|
|
265
|
+
</ScrollView>;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// ---------- "Nobody's on it": raised issues and urgent Compass asks in Needs you ----------
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* "Nobody's on it" rows (nobody-s-on-it-is-needs-you), shaped like Home's: an amber ↑ for a raise or the compass glyph
|
|
272
|
+
* for a Compass ask, the key, "Nobody's on it", then "title · due Thu"; under it the reason
|
|
273
|
+
* line with its source, as Home's rows carry AI priority's ("Dana: renewal call Thu · Compass", "Linear Raised Low →
|
|
274
|
+
* Urgent"). One Start… (New on the issue, `{why}` filled) and the two-click Remove of every Needs-you item (invariant
|
|
275
|
+
* 59: follow.dismiss `issue`, which takes the raise and every Compass ask on it).
|
|
276
|
+
*/
|
|
277
|
+
export function NobodyRows({ theme, compact, data, onDismissed }: { theme: Theme; compact: boolean; data: QueueNeeds; onDismissed: () => void }) {
|
|
278
|
+
const c = theme.colors;
|
|
279
|
+
// The same Dismiss as every Needs-you item (invariant 59): two clicks in place, one toast with Undo. The worker
|
|
280
|
+
// pushes the new list on the home feed; without the feed, onDismissed reads it once.
|
|
281
|
+
const dismiss = useDismiss(onDismissed);
|
|
282
|
+
const now = Date.now();
|
|
283
|
+
return <>{data.needs.map(r => {
|
|
284
|
+
const row = nobodyRow(r, now, data.timeZone);
|
|
285
|
+
const first = r.reasons[0]!;
|
|
286
|
+
const reason = <PriorityLine reason={first.line} source={first.from === "compass" ? { kind: "compass", label: first.source } : { kind: "linear", label: first.source }} c={c} size={compact ? 12 : 11} lines={compact ? 2 : 1} />;
|
|
287
|
+
const when = age(r.at, now);
|
|
288
|
+
const start = <BarBtn c={c} compact={compact} small primary={false} disabled={false} b={{ name: "Start…", icon: "Play", key: null }} onPress={() => openNew({ source: r.key })} />;
|
|
289
|
+
const x = <DismissX theme={theme} compact={compact} label={`Remove ${r.key}`} onPress={() => dismiss({ issue: r.key })} />;
|
|
290
|
+
const glyph = <View style={{ width: compact ? 18 : 16, alignItems: "center", paddingTop: compact ? 2 : 0 }}><Icon name={row.compass ? "Compass" : "ArrowUp"} size={compact ? 17 : 15} color={c.statusWarning} /></View>;
|
|
291
|
+
return <RevealScope key={r.key} accessibilityLabel={`Needs you: ${row.label}`}
|
|
292
|
+
style={{ flexDirection: "row", alignItems: compact ? "flex-start" : "center", gap: 10, minHeight: compact ? 56 : 46, paddingLeft: compact ? 14 : 16, paddingRight: compact ? 16 : 16, paddingVertical: compact ? 12 : 5,
|
|
293
|
+
borderLeftWidth: 2, borderLeftColor: withAlpha(c.statusWarning, 0.9), ...(compact ? { borderBottomWidth: 1, borderBottomColor: withAlpha(c.border, 0.6) } : {}) }}>
|
|
294
|
+
{glyph}
|
|
295
|
+
{compact ? <View style={{ flex: 1, minWidth: 0, gap: 2 }}>
|
|
296
|
+
<View style={{ flexDirection: "row", alignItems: "flex-start", gap: 8 }}>
|
|
297
|
+
<Text numberOfLines={1} style={{ flex: 1, minWidth: 0, color: c.foreground, fontSize: 15, lineHeight: 20, fontWeight: "500" }}>{row.title}</Text>
|
|
298
|
+
<Text style={{ color: c.foregroundMuted, fontSize: 12, paddingTop: 2, fontVariant: ["tabular-nums"] }}>{when}</Text>
|
|
299
|
+
</View>
|
|
300
|
+
<Text numberOfLines={2} style={{ color: c.foregroundMuted, fontSize: 13, lineHeight: 18 }}><Text style={{ color: c.statusWarning, fontWeight: "600" }}>{row.word}</Text> · {row.line}</Text>
|
|
301
|
+
{reason}
|
|
302
|
+
<View style={{ flexDirection: "row", alignItems: "center", justifyContent: "space-between", marginTop: 6 }}>{start}{x}</View>
|
|
303
|
+
</View> : <>
|
|
304
|
+
<View style={{ flex: 1, minWidth: 0, gap: 1 }}>
|
|
305
|
+
<View style={{ flexDirection: "row", alignItems: "center", gap: 10, minWidth: 0 }}>
|
|
306
|
+
<Text numberOfLines={1} style={{ flexShrink: 0, color: c.foreground, fontSize: 13, fontWeight: "500" }}>{row.title}</Text>
|
|
307
|
+
<Text numberOfLines={1} style={{ flexShrink: 0, color: c.statusWarning, fontSize: 12 }}>{row.word}</Text>
|
|
308
|
+
<Text numberOfLines={1} style={{ flex: 1, minWidth: 0, color: c.foregroundMuted, fontSize: 12, marginLeft: -10 }}>{"\u00a0· "}{row.line}</Text>
|
|
309
|
+
</View>
|
|
310
|
+
<View style={{ paddingRight: 40 }}>{reason}</View>
|
|
311
|
+
</View>
|
|
312
|
+
{start}
|
|
313
|
+
<View style={{ flexDirection: "row", alignItems: "center", gap: 4 }}>
|
|
314
|
+
<Text style={{ color: c.foregroundMuted, fontSize: 12, fontVariant: ["tabular-nums"] }}>{when}</Text>
|
|
315
|
+
{x}
|
|
316
|
+
</View>
|
|
317
|
+
</>}
|
|
318
|
+
</RevealScope>;
|
|
319
|
+
})}</>;
|
|
320
|
+
}
|