paseo-follow-up 2.3.0-beta.3 → 2.3.0
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/CHANGELOG.md +55 -0
- package/README.md +47 -204
- package/client/brief.tsx +3 -3
- package/client/catch-up.tsx +2 -1
- package/client/dismiss.tsx +186 -23
- package/client/header.tsx +3 -2
- package/client/needs-you.tsx +4 -3
- package/client/panel.tsx +6 -5
- package/client/questions.tsx +1 -1
- package/client/settings-screens.ts +41 -0
- package/client/settings.tsx +26 -8
- package/client/theme.ts +12 -0
- package/client/updates.tsx +5 -5
- package/docs/screenshots/follow-up-send-to-paseo-dark.png +0 -0
- package/docs/screenshots/follow-up-send-to-paseo-light.png +0 -0
- package/index.client.tsx +7 -4
- package/package.json +2 -2
- package/server/local-titles.ts +9 -12
- package/shared/brief.ts +9 -2
- package/shared/catch-up.ts +1 -1
- package/shared/chat.ts +5 -15
- package/shared/created.ts +13 -21
- package/shared/errors.ts +1 -1
- package/shared/questions.ts +5 -2
- package/shared/settings-nav.ts +14 -2
- package/shared/tool-result.ts +70 -0
package/client/dismiss.tsx
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { createContext, useContext, useEffect, useRef, useState, type ReactNode } from "react";
|
|
2
|
-
import { Platform, View, type StyleProp, type ViewProps, type ViewStyle } from "react-native";
|
|
1
|
+
import { createContext, useContext, useEffect, useRef, useState, useSyncExternalStore, type ReactNode } from "react";
|
|
2
|
+
import { AccessibilityInfo, Animated, Easing, Platform, View, type StyleProp, type ViewProps, type ViewStyle } from "react-native";
|
|
3
3
|
import { useRpc } from "@getpaseo/plugin/client";
|
|
4
4
|
import { Icon, useToast } from "@getpaseo/plugin/client/ui";
|
|
5
5
|
import { useQueryClient } from "@tanstack/react-query";
|
|
6
6
|
import { dismissRpc } from "../shared/contracts";
|
|
7
|
-
import { Pressable } from "./text";
|
|
8
|
-
import { focusRing, type Theme } from "./kit";
|
|
9
|
-
import {
|
|
7
|
+
import { Pressable, Text } from "./text";
|
|
8
|
+
import { focusRing, keyboardFocus, type Theme } from "./kit";
|
|
9
|
+
import { useReducedMotion } from "./motion";
|
|
10
|
+
import { isLight, readable, solidFor, tint, withAlpha } from "./theme";
|
|
10
11
|
import { liveBriefKey, overviewKey, workspaceKey } from "./keys";
|
|
11
12
|
import { hasToastHost, pushToast, runAction } from "./toast-store";
|
|
12
13
|
import type { InboxStore } from "./inbox-store";
|
|
@@ -17,16 +18,38 @@ import type { InboxStore } from "./inbox-store";
|
|
|
17
18
|
* count at once, the agent is sent nothing, and the toast's Undo brings it back. One control (DismissX), one request
|
|
18
19
|
* (follow.dismiss), one toast.
|
|
19
20
|
*
|
|
20
|
-
* Where it shows: on a phone (no hover) always, muted, with a
|
|
21
|
+
* Where it shows: on a phone (no hover) always, muted, with a 44 px hit area (a real box, since react-native-web ignores hitSlop; DESIGN.md's compact target) rather than a bigger glyph.
|
|
21
22
|
* On desktop it appears while the pointer is over its card or focus is inside it (RevealScope), and always on the card
|
|
22
23
|
* that is selected (Catch up's card, Home's detail pane: `DismissReveal` "always"). Hidden is opacity 0, never
|
|
23
24
|
* unmounted, so the card doesn't move when it appears and the keyboard and screen readers always reach it.
|
|
25
|
+
*
|
|
26
|
+
* Two clicks, in place (dismiss-takes-two-clicks-in-place, armed-dismiss-shows-remove-and-keep): the first click (tap,
|
|
27
|
+
* Enter, Space, ⇧D in Catch up) arms the x: it turns into two small buttons on the same spot, a quiet "Keep" (backs out;
|
|
28
|
+
* first in reading order, and where focus lands, so a second Enter keeps) and a red-tinted "Remove" (confirms; solid
|
|
29
|
+
* red under the pointer), growing leftward over what sits beside it, so the card never reflows. It disarms quietly on
|
|
30
|
+
* Keep, a click or tap anywhere else, Esc (focus goes back to the x), focus leaving the pair, the pointer leaving its
|
|
31
|
+
* card (after a short grace), or DISMISS_ARM_MS untouched. The second click of a double-click never removes. Only one x
|
|
32
|
+
* is armed at a time, on every surface. No pop-up; Undo stays.
|
|
24
33
|
*/
|
|
25
34
|
|
|
26
35
|
/** As long as sign-off's Undo (6 s): the toast holds while the pointer or focus is on it. */
|
|
27
36
|
export const DISMISS_UNDO_MS = 6_000;
|
|
28
37
|
/** The x's tooltip and the second half of its accessibility label. */
|
|
29
38
|
export const DISMISS_HINT = "it no longer needs you, and the agent isn't messaged";
|
|
39
|
+
/** How long an armed x waits for its second click (paused while the pointer is on it). */
|
|
40
|
+
export const DISMISS_ARM_MS = 4_000;
|
|
41
|
+
/** How long the pointer may be off the armed x's card before it disarms (a wobble isn't leaving). */
|
|
42
|
+
export const DISMISS_LEAVE_GRACE_MS = 600;
|
|
43
|
+
/** What a screen reader hears when the x arms. */
|
|
44
|
+
export const DISMISS_CONFIRM = "Remove, or Keep to cancel";
|
|
45
|
+
|
|
46
|
+
/** The one armed x, app-wide: arming another disarms this one. */
|
|
47
|
+
let armedX: object | null = null;
|
|
48
|
+
const armWatchers = new Set<() => void>();
|
|
49
|
+
const setArmed = (x: object | null) => { if (armedX === x) return; armedX = x; for (const f of armWatchers) f(); };
|
|
50
|
+
const watchArmed = (f: () => void) => { armWatchers.add(f); return () => { armWatchers.delete(f); }; };
|
|
51
|
+
/** Disarm whatever x is armed (a surface closing, a test resetting). */
|
|
52
|
+
export function disarmDismiss(): void { setArmed(null); }
|
|
30
53
|
|
|
31
54
|
export type DismissTarget = { workspaceId: string; key: string } | { agentId: string };
|
|
32
55
|
const targetKey = (t: DismissTarget) => "agentId" in t ? `agent:${t.agentId}` : `${t.workspaceId}:${t.key}`;
|
|
@@ -46,15 +69,15 @@ export function useDismiss(): (target: DismissTarget, options?: { onDismissed?:
|
|
|
46
69
|
void cache.invalidateQueries({ queryKey: overviewKey });
|
|
47
70
|
};
|
|
48
71
|
const call = (t: DismissTarget, undo: boolean) => "agentId" in t && inbox ? inbox.dismiss(t.agentId, undo) : rpc({ ...t, ...(undo ? { undo: true } : {}) });
|
|
49
|
-
const undo = (t: DismissTarget, name: string) => void runAction({ label: `Undo
|
|
72
|
+
const undo = (t: DismissTarget, name: string) => void runAction({ label: `Undo remove ${name}`, toast, run: () => call(t, true), onSuccess: () => refresh(t),
|
|
50
73
|
success: () => `${name.charAt(0).toUpperCase()}${name.slice(1)} is back in Needs you`, failure: `Couldn't bring back ${name}` }, `dismiss:${targetKey(t)}`);
|
|
51
74
|
return (t, options = {}) => {
|
|
52
75
|
options.onDismissed?.();
|
|
53
|
-
void runAction({ label: "
|
|
76
|
+
void runAction({ label: "Remove", toast, run: () => call(t, false), onSuccess: () => refresh(t), failure: "Couldn't remove it",
|
|
54
77
|
// Already gone (merged, answered, sent elsewhere): nothing to say, the surface shows what happened.
|
|
55
78
|
reconcile: () => refresh(t),
|
|
56
79
|
success: r => {
|
|
57
|
-
const message = `
|
|
80
|
+
const message = `Removed ${r.name}. The agent wasn't messaged.`;
|
|
58
81
|
if (!hasToastHost()) return message;
|
|
59
82
|
pushToast("success", message, [{ label: "Undo", onPress: () => undo(t, r.name) }], { durationMs: DISMISS_UNDO_MS, keep: true });
|
|
60
83
|
return null;
|
|
@@ -65,8 +88,12 @@ export function useDismiss(): (target: DismissTarget, options?: { onDismissed?:
|
|
|
65
88
|
/** "always": the card is the selected one (Catch up's card, Home's detail pane), so its x shows without hover. */
|
|
66
89
|
export const DismissReveal = createContext<"hover" | "always">("hover");
|
|
67
90
|
const Hovered = createContext<boolean>(false);
|
|
91
|
+
/** Whether the pointer is over the card (desktop web); null outside a RevealScope, where only the x itself knows. */
|
|
92
|
+
const PointerIn = createContext<boolean | null>(null);
|
|
68
93
|
|
|
69
|
-
type DomNode = {
|
|
94
|
+
type DomNode = { setAttribute?(k: string, v: string): void; contains?(other: unknown): boolean; focus?(): void };
|
|
95
|
+
type Listen = { addEventListener?(type: string, f: (e: DomEvent) => void, capture?: boolean): void; removeEventListener?(type: string, f: (e: DomEvent) => void, capture?: boolean): void };
|
|
96
|
+
type DomEvent = { key?: string; target?: unknown; preventDefault?(): void; stopPropagation?(): void };
|
|
70
97
|
|
|
71
98
|
/**
|
|
72
99
|
* A card whose x shows while the pointer is over it or focus is inside it (desktop web). Native and phones draw the x
|
|
@@ -78,29 +105,165 @@ export function RevealScope({ children, style, ...rest }: { children: ReactNode;
|
|
|
78
105
|
// react-native-web forwards these to the DOM (as client/linked.tsx's hover does); React's onFocus/onBlur bubble, so
|
|
79
106
|
// focus anywhere inside the card counts. Native ignores them: the x is always shown there.
|
|
80
107
|
const web = Platform.OS === "web" ? { onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), onFocus: () => setFocused(true), onBlur: () => setFocused(false) } : {};
|
|
81
|
-
return <View style={style} {...rest} {...(web as object)}><Hovered.Provider value={hovered || focused}>{children}</Hovered.Provider></View>;
|
|
108
|
+
return <View style={style} {...rest} {...(web as object)}><PointerIn.Provider value={Platform.OS === "web" ? hovered : null}><Hovered.Provider value={hovered || focused}>{children}</Hovered.Provider></PointerIn.Provider></View>;
|
|
82
109
|
}
|
|
83
110
|
|
|
111
|
+
|
|
112
|
+
/** The armed pair's quiet button names the same item: "Remove Q1" → "Keep Q1". */
|
|
113
|
+
export const keepLabel = (label: string) => /^Remove\b/.test(label) ? label.replace(/^Remove\b/, "Keep") : `Keep ${label}`;
|
|
114
|
+
|
|
115
|
+
type PressEvent = { detail?: number; relatedTarget?: unknown; nativeEvent?: { detail?: number; relatedTarget?: unknown } } | undefined;
|
|
116
|
+
/** The click count of a pointer press (the DOM's `detail`: 2 is a double-click's second click); 0 for keys and native. */
|
|
117
|
+
const clickCount = (e: PressEvent) => e?.nativeEvent?.detail ?? e?.detail ?? 0;
|
|
118
|
+
|
|
84
119
|
/**
|
|
85
|
-
* The small x. `label` names what it
|
|
120
|
+
* The small x. `label` names what it removes ("Remove Q1", "Remove #12 is approved"); the hint follows it. Quiet by
|
|
86
121
|
* design: the muted foreground at 14 px (16 on phones), no fill until hovered, never the size or colour of an action.
|
|
122
|
+
* Armed (the first click), it is a quiet "Keep" and a red "Remove" in the same place; Remove calls `onPress`.
|
|
87
123
|
*/
|
|
88
124
|
export function DismissX({ theme, compact, label, onPress, disabled = false }: { theme: Theme; compact: boolean; label: string; onPress: () => void; disabled?: boolean }) {
|
|
89
125
|
const c = theme.colors;
|
|
90
126
|
const reveal = useContext(DismissReveal);
|
|
91
127
|
const hovered = useContext(Hovered);
|
|
128
|
+
const pointerIn = useContext(PointerIn);
|
|
92
129
|
const [focused, setFocused] = useState(false);
|
|
130
|
+
const [over, setOver] = useState(false);
|
|
131
|
+
// Keyboard focus (focus-visible) holds the timeout too: someone who armed it with Enter and is hearing "Remove, or
|
|
132
|
+
// Keep to cancel" shouldn't lose it to a timer. A mouse click also focuses; that doesn't count.
|
|
133
|
+
const [keyed, setKeyed] = useState(false);
|
|
134
|
+
const reduced = useReducedMotion();
|
|
135
|
+
const fade = useRef(new Animated.Value(1)).current;
|
|
136
|
+
const me = useRef({}).current;
|
|
137
|
+
const armed = useSyncExternalStore(watchArmed, () => armedX === me, () => false);
|
|
138
|
+
const disarm = () => { if (armedX === me) setArmed(null); };
|
|
93
139
|
const touch = compact || Platform.OS !== "web";
|
|
94
|
-
const shown = touch || reveal === "always" || hovered || focused;
|
|
140
|
+
const shown = touch || reveal === "always" || hovered || focused || armed;
|
|
141
|
+
const root = useRef<View>(null);
|
|
95
142
|
const tip = useRef<View>(null);
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
143
|
+
const keep = useRef<View>(null);
|
|
144
|
+
/** A pointer went down inside the pair: the focus it moves (or drops, in Safari) isn't focus leaving. */
|
|
145
|
+
const downInside = useRef(false);
|
|
146
|
+
/** Disarmed from the keyboard (Esc, Keep): focus goes back to the x. */
|
|
147
|
+
const refocus = useRef(false);
|
|
148
|
+
/** Just armed with the pointer still where the x was, which is now Remove: it stays quiet (no solid red) until the
|
|
149
|
+
* pointer leaves it once, so the loudest thing on the card is never one nobody chose to point at. */
|
|
150
|
+
const [fresh, setFresh] = useState(false);
|
|
151
|
+
const dom = (r: { current: View | null }) => r.current as unknown as DomNode | null;
|
|
152
|
+
useEffect(() => { if (Platform.OS === "web" && !armed) dom(tip)?.setAttribute?.("title", `Remove: ${DISMISS_HINT}`); }, [armed]);
|
|
153
|
+
// Gone (removed, the card moved on) or disabled: never leave an armed x behind.
|
|
154
|
+
useEffect(() => () => disarm(), []);
|
|
155
|
+
useEffect(() => { if (disabled) disarm(); }, [disabled, armed]);
|
|
156
|
+
// Armed: focus lands on Keep (the safe default: a second Enter or Space keeps). Disarmed: the pair is gone, so its
|
|
157
|
+
// focus is too, unless Esc or Keep hands it back to the x.
|
|
158
|
+
useEffect(() => {
|
|
159
|
+
if (armed) { setFresh(true); if (Platform.OS === "web") dom(keep)?.focus?.(); return; }
|
|
160
|
+
setFocused(false); setKeyed(false);
|
|
161
|
+
if (refocus.current) { refocus.current = false; dom(tip)?.focus?.(); }
|
|
162
|
+
}, [armed]);
|
|
163
|
+
// The quiet timeout, paused while the pointer rests on the pair (someone about to click it).
|
|
164
|
+
useEffect(() => { if (!armed || over || keyed) return; const t = setTimeout(disarm, DISMISS_ARM_MS); return () => clearTimeout(t); }, [armed, over, keyed]);
|
|
165
|
+
// The pair fades in (140 ms, ease-out, opacity only) from the x; reduced motion swaps at once. Disarming is instant,
|
|
166
|
+
// and Remove never waits on it.
|
|
167
|
+
useEffect(() => {
|
|
168
|
+
if (!armed) return;
|
|
169
|
+
if (reduced) { fade.setValue(1); return; }
|
|
170
|
+
fade.setValue(0);
|
|
171
|
+
Animated.timing(fade, { toValue: 1, duration: 140, easing: Easing.out(Easing.cubic), useNativeDriver: Platform.OS !== "web" }).start();
|
|
172
|
+
}, [armed, reduced]);
|
|
173
|
+
// The pointer leaving the card (it was in, now it isn't) disarms after a grace; coming back keeps it armed.
|
|
174
|
+
const wasIn = useRef(pointerIn);
|
|
175
|
+
useEffect(() => {
|
|
176
|
+
const left = wasIn.current === true && pointerIn === false;
|
|
177
|
+
wasIn.current = pointerIn;
|
|
178
|
+
if (!armed || !left) return;
|
|
179
|
+
const t = setTimeout(disarm, DISMISS_LEAVE_GRACE_MS);
|
|
180
|
+
return () => clearTimeout(t);
|
|
181
|
+
}, [armed, pointerIn]);
|
|
182
|
+
const back = () => { refocus.current = Platform.OS === "web"; disarm(); };
|
|
183
|
+
// Web: a click or tap anywhere but the pair, or Esc, disarms. Esc is taken (capture, before Catch up's keys and the
|
|
184
|
+
// host's interrupt): pressing it here only disarms, and focus goes back to the x.
|
|
185
|
+
useEffect(() => {
|
|
186
|
+
if (!armed) return;
|
|
187
|
+
const g = globalThis as unknown as Listen & { document?: Listen };
|
|
188
|
+
const doc = g.document;
|
|
189
|
+
if (typeof doc?.addEventListener !== "function" || typeof g.addEventListener !== "function") return;
|
|
190
|
+
const onDown = (e: DomEvent) => { downInside.current = !!dom(root)?.contains?.(e.target); if (!downInside.current) disarm(); };
|
|
191
|
+
const onKey = (e: DomEvent) => { if (e.key !== "Escape") return; e.preventDefault?.(); e.stopPropagation?.(); back(); };
|
|
192
|
+
doc.addEventListener("pointerdown", onDown, true);
|
|
193
|
+
g.addEventListener("keydown", onKey, true);
|
|
194
|
+
return () => { doc.removeEventListener?.("pointerdown", onDown, true); g.removeEventListener?.("keydown", onKey, true); };
|
|
195
|
+
}, [armed]);
|
|
196
|
+
const arm = () => { setArmed(me); AccessibilityInfo.announceForAccessibility?.(DISMISS_CONFIRM); };
|
|
197
|
+
// A double-click on the x lands its second click where Remove now is: that click never removes.
|
|
198
|
+
const remove = (e?: PressEvent) => { if (clickCount(e) >= 2) return; disarm(); onPress(); };
|
|
199
|
+
const focusIn = () => { setFocused(true); setKeyed(Platform.OS === "web" && keyboardFocus()); };
|
|
200
|
+
// Focus leaving the pair (Tab past Remove, Shift+Tab before Keep) disarms; moving between Keep and Remove doesn't.
|
|
201
|
+
const focusOut = (e?: PressEvent) => {
|
|
202
|
+
setFocused(false); setKeyed(false);
|
|
203
|
+
const inside = downInside.current; downInside.current = false;
|
|
204
|
+
const to = e?.nativeEvent?.relatedTarget ?? e?.relatedTarget;
|
|
205
|
+
if (inside || (to != null && dom(root)?.contains?.(to))) return;
|
|
206
|
+
disarm();
|
|
207
|
+
};
|
|
208
|
+
// Sizes. Phones: every button is a real 44 px tall box (DESIGN.md's compact target; react-native-web ignores hitSlop)
|
|
209
|
+
// pulled in by 8 px top and bottom, so it lays out as 28 px; the x stays a small muted glyph in it, the pair's pills are 28 px, with 8 px
|
|
210
|
+
// between the two targets so a stray tap meant for Keep doesn't land on Remove. Desktop: 22 px, 6 px apart (room
|
|
211
|
+
// for Keep's focus ring).
|
|
212
|
+
const box = touch ? 44 : 22;
|
|
213
|
+
const pull = touch ? -8 : 0;
|
|
214
|
+
const pillH = touch ? 28 : 22;
|
|
215
|
+
const keepW = touch ? 60 : 46, removeW = touch ? 76 : 62, gap = touch ? 8 : 6, inset = touch ? 6 : 3;
|
|
216
|
+
// Armed: wider by the pair, and the extra width is taken back with a negative left margin, so it lays out exactly as
|
|
217
|
+
// the x did: nothing beside it moves, the pair draws over it (solid, so what's under it doesn't show through).
|
|
218
|
+
const wide = keepW + gap + removeW + inset;
|
|
219
|
+
const layout: ViewStyle = armed
|
|
220
|
+
? { width: wide, height: box, margin: pull, marginLeft: pull - (wide - box), paddingRight: inset, zIndex: 1 }
|
|
221
|
+
: { width: box, height: box, margin: pull };
|
|
222
|
+
// Web screen readers: react-native-web's announceForAccessibility is a no-op, so a polite live region (always
|
|
223
|
+
// mounted, empty until armed) says it. Native announces through AccessibilityInfo above.
|
|
224
|
+
const live = Platform.OS === "web" ? <Text accessibilityLiveRegion="polite" style={{ position: "absolute", width: 1, height: 1, overflow: "hidden", opacity: 0 }}>{armed ? DISMISS_CONFIRM : ""}</Text> : null;
|
|
225
|
+
const hoverWeb = Platform.OS === "web" ? { onMouseEnter: () => setOver(true), onMouseLeave: () => setOver(false) } : {};
|
|
226
|
+
const fontSize = touch ? 13 : 12;
|
|
227
|
+
const pill = (w: number) => ({ width: w, height: box, borderRadius: box / 2, justifyContent: "center" as const });
|
|
228
|
+
return <View ref={root} testID="dismiss-x" style={layout} {...(hoverWeb as object)}>
|
|
229
|
+
{live}
|
|
230
|
+
{!armed ? <Pressable ref={tip} accessibilityRole="button" accessibilityLabel={`${label}: ${DISMISS_HINT}`} disabled={disabled} onPress={arm}
|
|
231
|
+
hitSlop={4} onFocus={focusIn} onBlur={() => { setFocused(false); setKeyed(false); }}
|
|
232
|
+
style={(state: { hovered?: boolean; pressed: boolean; focused?: boolean }) => ({ ...focusRing(state.focused, c), flex: 1, borderRadius: box / 2, alignItems: "center", justifyContent: "center",
|
|
233
|
+
opacity: shown ? (disabled ? 0.4 : 1) : 0, backgroundColor: state.pressed ? c.surface2 : state.hovered ? withAlpha(c.foreground, 0.06) : "transparent" })}>
|
|
234
|
+
{state => <Icon name="X" size={touch ? 16 : 14} color={state.pressed || (state as { hovered?: boolean }).hovered ? c.foreground : c.foregroundMuted} />}
|
|
235
|
+
</Pressable>
|
|
236
|
+
: <Animated.View style={{ flex: 1, flexDirection: "row", alignItems: "center", justifyContent: "flex-end", gap, opacity: fade }}>
|
|
237
|
+
{/* One solid ground under both pills and the gap between them, so the age or title they cover never shows through. */}
|
|
238
|
+
<View style={{ position: "absolute", left: 0, right: 0, top: (box - pillH) / 2, height: pillH, borderRadius: pillH / 2, backgroundColor: c.surface0 }} />
|
|
239
|
+
{/* Keep: the way back, quiet and neutral (the card's own ground, a foreground hairline that still reads as a button
|
|
240
|
+
in dark, body ink), first in reading order. */}
|
|
241
|
+
<Pressable ref={keep} accessibilityRole="button" accessibilityLabel={keepLabel(label)} hitSlop={touch ? 0 : 2} onPress={back} onFocus={focusIn} onBlur={focusOut as () => void}
|
|
242
|
+
style={(state: { pressed: boolean; focused?: boolean }) => ({ ...focusRing(state.focused, c), ...pill(keepW) })}>
|
|
243
|
+
{state => {
|
|
244
|
+
const hot = state.pressed || !!(state as { hovered?: boolean }).hovered;
|
|
245
|
+
return <View style={{ height: pillH, borderRadius: pillH / 2, borderWidth: 1, borderColor: withAlpha(c.foreground, isLight(c) ? 0.18 : 0.28), backgroundColor: hot ? c.surface2 : c.surface0, alignItems: "center", justifyContent: "center" }}>
|
|
246
|
+
<Text numberOfLines={1} style={{ color: c.foreground, fontSize, lineHeight: 14, fontWeight: "500" }}>Keep</Text>
|
|
247
|
+
</View>;
|
|
248
|
+
}}
|
|
249
|
+
</Pressable>
|
|
250
|
+
{/* Remove: a danger tint with danger ink and a hairline at rest, over the page ground so what it covers doesn't
|
|
251
|
+
show through; solid (white on deepened danger) only under the pointer or finger, the moment it acts. Red,
|
|
252
|
+
quietly: removing is undoable, and a solid red pill at rest read as a new blocker on an amber card. */}
|
|
253
|
+
<Pressable accessibilityRole="button" accessibilityLabel={label} hitSlop={touch ? 0 : 2} onPress={remove as () => void} onFocus={focusIn} onBlur={focusOut as () => void} onHoverOut={() => setFresh(false)}
|
|
254
|
+
style={(state: { pressed: boolean; focused?: boolean }) => ({ ...focusRing(state.focused, c), ...pill(removeW) })}>
|
|
255
|
+
{state => {
|
|
256
|
+
const hot = state.pressed || (!fresh && !!(state as { hovered?: boolean }).hovered);
|
|
257
|
+
const ink = isLight(c) ? solidFor(c.statusDanger) : readable(c.statusDanger, c);
|
|
258
|
+
return <View style={{ height: pillH, borderRadius: pillH / 2, overflow: "hidden", backgroundColor: c.surface0 }}>
|
|
259
|
+
<View style={{ flex: 1, borderRadius: pillH / 2, borderWidth: 1, alignItems: "center", justifyContent: "center",
|
|
260
|
+
borderColor: hot ? "transparent" : withAlpha(c.statusDanger, 0.35),
|
|
261
|
+
backgroundColor: hot ? solidFor(c.statusDanger, state.pressed ? 0.82 : 1) : tint(c.statusDanger, c) }}>
|
|
262
|
+
<Text numberOfLines={1} style={{ color: hot ? "#ffffff" : ink, fontSize, lineHeight: 14, fontWeight: "600" }}>Remove</Text>
|
|
263
|
+
</View>
|
|
264
|
+
</View>;
|
|
265
|
+
}}
|
|
266
|
+
</Pressable>
|
|
267
|
+
</Animated.View>}
|
|
268
|
+
</View>;
|
|
106
269
|
}
|
package/client/header.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
+
import type { SettingsCategory } from "../shared/settings-nav";
|
|
2
3
|
import { View } from "react-native";
|
|
3
4
|
import { Pressable, Text } from "./text";
|
|
4
5
|
import { Icon } from "@getpaseo/plugin/client/ui";
|
|
@@ -47,7 +48,7 @@ function LiveGlyph({ icon, colors }: { icon: LiveIcon; colors: Colors }) {
|
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
export function WorkspaceHeader({ workspace: w, theme, compact, now, onSettings, onRefresh, refreshing, onAuto, autoPending, notice, onOpenPr, resize, hideTitle = false, onHome, more }: {
|
|
50
|
-
workspace: Workspace; theme: Theme; compact: boolean; now: number; onSettings: () => void; onRefresh: () => void; refreshing: boolean; onAuto: (next: boolean) => void; autoPending: boolean; notice: string | null; onOpenPr?: (key: string) => void;
|
|
51
|
+
workspace: Workspace; theme: Theme; compact: boolean; now: number; onSettings: (category?: SettingsCategory) => void; onRefresh: () => void; refreshing: boolean; onAuto: (next: boolean) => void; autoPending: boolean; notice: string | null; onOpenPr?: (key: string) => void;
|
|
51
52
|
/** Expand to the larger view, or collapse back to the panel. Absent where the panel is already as wide as it gets. */
|
|
52
53
|
resize?: { icon: "Maximize2" | "Minimize2"; label: string; onPress: () => void } | null;
|
|
53
54
|
/** The larger view's screen bar already names the workspace. */
|
|
@@ -67,7 +68,7 @@ export function WorkspaceHeader({ workspace: w, theme, compact, now, onSettings,
|
|
|
67
68
|
const controls = <View style={{ flexDirection: "row", alignItems: "center", gap: 2, marginVertical: compact ? -12 : -4, marginRight: compact ? -10 : -4 }}>
|
|
68
69
|
{resize && <IconButton icon={resize.icon} label={resize.label} onPress={resize.onPress} theme={theme} compact={compact} />}
|
|
69
70
|
{more}
|
|
70
|
-
<IconButton icon="Settings" label="Follow-up settings" onPress={onSettings} theme={theme} compact={compact} />
|
|
71
|
+
<IconButton icon="Settings" label="Follow-up settings" onPress={() => onSettings()} theme={theme} compact={compact} />
|
|
71
72
|
</View>;
|
|
72
73
|
const tail = <>
|
|
73
74
|
<View style={{ flexDirection: "row", gap: 6, marginTop: 2 }}>
|
package/client/needs-you.tsx
CHANGED
|
@@ -163,7 +163,7 @@ export function NeedsYouList({ workspace: w, theme, compact, actions, now = Date
|
|
|
163
163
|
const button = act || link || more ? <>{pair ?? <>{act}{link}</>}{more}</> : null;
|
|
164
164
|
const said = !!untitled?.has(item.key);
|
|
165
165
|
// The small x, top right, on every kind (dismissing-anything-in-needs-you-sends-the-agent-nothing).
|
|
166
|
-
const x = <DismissX theme={theme} compact={compact} label={`
|
|
166
|
+
const x = <DismissX theme={theme} compact={compact} label={`Remove ${item.kind === "question" ? item.questionId : item.title}`}
|
|
167
167
|
onPress={() => dismiss({ workspaceId: w.id, key: item.key }, { onDismissed: actions.after })} />;
|
|
168
168
|
// Phones: the action sits at the row's right edge so rows never grow a second line of controls. A send batch
|
|
169
169
|
// (the primary, with its task list) and Retry's pair keep their buttons full width under the row.
|
|
@@ -180,7 +180,8 @@ export function NeedsYouList({ workspace: w, theme, compact, actions, now = Date
|
|
|
180
180
|
</View>
|
|
181
181
|
<View style={item.kind === "reviewers" ? { alignSelf: "flex-start" } : undefined}>{pair ?? button}</View>
|
|
182
182
|
{/* Top right, a step away from the action so a thumb aimed at it doesn't land here. */}
|
|
183
|
-
|
|
183
|
+
{/* Flush (Catch up's bordered card): no pull to the edge, so the armed Dismiss pill keeps clear of the border. */}
|
|
184
|
+
<View style={{ alignSelf: "flex-start", marginTop: -4, marginRight: flush ? 0 : -6, marginLeft: 2 }}>{x}</View>
|
|
184
185
|
</RevealScope>
|
|
185
186
|
</CardRow>;
|
|
186
187
|
return <CardRow key={item.key} theme={theme} compact={compact} first={index === 0 && flush} style={flush ? { paddingHorizontal: 0 } : undefined}>
|
|
@@ -198,7 +199,7 @@ export function NeedsYouList({ workspace: w, theme, compact, actions, now = Date
|
|
|
198
199
|
</View>}
|
|
199
200
|
{notice}
|
|
200
201
|
</View>
|
|
201
|
-
<View style={{ marginTop: -3, marginRight: -5 }}>{x}</View>
|
|
202
|
+
<View style={{ marginTop: -3, marginRight: flush ? 2 : -5 }}>{x}</View>
|
|
202
203
|
</RevealScope>
|
|
203
204
|
</CardRow>;
|
|
204
205
|
})}
|
package/client/panel.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useEffect, useState, type ReactNode } from "react";
|
|
2
|
+
import type { SettingsCategory } from "../shared/settings-nav";
|
|
2
3
|
import { recoveryActions } from "./recovery-actions";
|
|
3
4
|
import { View } from "react-native";
|
|
4
5
|
import { Text } from "./text";
|
|
@@ -42,7 +43,7 @@ import { ToastHost, useQuestionOpener } from "./toasts";
|
|
|
42
43
|
|
|
43
44
|
export { overviewKey, workspaceKey };
|
|
44
45
|
|
|
45
|
-
export type PanelLinks = { openSettings: () => void; openOverview: () => void; openLarge?: (workspaceId: string) => void };
|
|
46
|
+
export type PanelLinks = { openSettings: (category?: SettingsCategory) => void; openOverview: () => void; openLarge?: (workspaceId: string) => void };
|
|
46
47
|
type PanelProps = PluginWorkspacePanelProps & PanelLinks & { inbox?: InboxStore; live?: LiveStore; briefDeps?: BriefDeps; sources?: HomeSources };
|
|
47
48
|
|
|
48
49
|
/**
|
|
@@ -127,19 +128,19 @@ function NothingYet({ theme, layout, loadError, openOverview, openSettings }: Pa
|
|
|
127
128
|
</View>)}
|
|
128
129
|
</View>
|
|
129
130
|
{loadError && <Text accessibilityRole="alert" style={[tp.meta, { color: c.statusDanger }]}>{loadError}</Text>}
|
|
130
|
-
<View style={{ flexDirection: "row" }}><Button theme={theme} compact kind="secondary" icon="Settings" title="Project settings" accessibilityHint="Choose which projects Follow-up tracks" onPress={openSettings} /></View>
|
|
131
|
+
<View style={{ flexDirection: "row" }}><Button theme={theme} compact kind="secondary" icon="Settings" title="Project settings" accessibilityHint="Choose which projects Follow-up tracks" onPress={() => openSettings("following")} /></View>
|
|
131
132
|
</ScrollView>
|
|
132
133
|
</View>;
|
|
133
134
|
}
|
|
134
135
|
|
|
135
136
|
/** The panel's top bar: back to Home, and settings. No other workspace's counts. */
|
|
136
|
-
export function PanelTop({ theme, compact, openOverview, openSettings }: { theme: Theme; compact: boolean; openOverview: () => void; openSettings?: () => void }) {
|
|
137
|
+
export function PanelTop({ theme, compact, openOverview, openSettings }: { theme: Theme; compact: boolean; openOverview: () => void; openSettings?: (category?: SettingsCategory) => void }) {
|
|
137
138
|
const c = theme.colors;
|
|
138
139
|
return <View style={{ flexDirection: "row", alignItems: "center", gap: 6, paddingHorizontal: compact ? 12 : 8, paddingVertical: 6, borderBottomWidth: 1, borderBottomColor: c.border }}>
|
|
139
140
|
<Button theme={theme} compact={compact} kind="ghost" icon="House" title="Home" accessibilityHint="Opens Follow-up Home with every workspace" onPress={openOverview} />
|
|
140
141
|
<View style={{ flex: 1 }} />
|
|
141
142
|
{openSettings && <VersionMark theme={theme} touch={compact} openSettings={openSettings} />}
|
|
142
|
-
{openSettings && <IconButton icon="Settings" label="Follow-up settings" onPress={openSettings} theme={theme} compact={compact} />}
|
|
143
|
+
{openSettings && <IconButton icon="Settings" label="Follow-up settings" onPress={() => openSettings()} theme={theme} compact={compact} />}
|
|
143
144
|
</View>;
|
|
144
145
|
}
|
|
145
146
|
|
|
@@ -342,7 +343,7 @@ const folds = z.object({ open: z.array(z.string()) });
|
|
|
342
343
|
export const WIDE_MIN = 820;
|
|
343
344
|
|
|
344
345
|
export function WorkspaceView({ theme, layout, workspace: w, navigation, loadError, openSettings, openOverview, folds: { isOpen, toggle }, resize, large = false, top, ask, sources }: PluginHostProps & {
|
|
345
|
-
navigation?: PluginWorkspacePanelProps["navigation"]; workspace: Workspace; loadError?: string | null; openSettings: () => void; openOverview: () => void; top?: ReactNode; /** The main agent's open brief and its card, for the Needs you block. */ ask?: { brief: Brief; card: ReactNode } | null;
|
|
346
|
+
navigation?: PluginWorkspacePanelProps["navigation"]; workspace: Workspace; loadError?: string | null; openSettings: (category?: SettingsCategory) => void; openOverview: () => void; top?: ReactNode; /** The main agent's open brief and its card, for the Needs you block. */ ask?: { brief: Brief; card: ReactNode } | null;
|
|
346
347
|
folds: Folds; resize: { icon: "Maximize2" | "Minimize2"; label: string; onPress: () => void } | null; large?: boolean;
|
|
347
348
|
/** Home's sources: the header's More menu (the row menu). Absent in the larger view. */
|
|
348
349
|
sources?: HomeSources;
|
package/client/questions.tsx
CHANGED
|
@@ -381,7 +381,7 @@ export function QuestionBody({ workspace: w, question: q, theme, compact, now =
|
|
|
381
381
|
|
|
382
382
|
/** A question's x: closes it as dismissed (follow.dismiss with "question:Qn"), sends the agent nothing, Undo in the toast. */
|
|
383
383
|
export function QuestionDismissX({ workspaceId, questionId, theme, compact, disabled, onDismissed, dismiss }: { workspaceId: string; questionId: string; theme: Theme; compact: boolean; disabled?: boolean; onDismissed?: () => void; dismiss: ReturnType<typeof useDismiss> }) {
|
|
384
|
-
return <DismissX theme={theme} compact={compact} label={`
|
|
384
|
+
return <DismissX theme={theme} compact={compact} label={`Remove ${questionId}`} disabled={disabled} onPress={() => dismiss({ workspaceId, key: `question:${questionId}` }, { onDismissed })} />;
|
|
385
385
|
}
|
|
386
386
|
|
|
387
387
|
function hostOf(url: string): string {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { createElement, type ComponentType } from "react";
|
|
2
|
+
import type { PluginClientContext, PluginSurfaceProps } from "@getpaseo/plugin/client";
|
|
3
|
+
import { FOLLOW_UP_ICON } from "./follow-up-icon";
|
|
4
|
+
import { SETTINGS_CATEGORIES, deviceStorage, isCategory, readCategory, writeCategory, type KeyValue, type SettingsCategory } from "../shared/settings-nav";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Where Follow-up's settings live in Paseo's Settings (`settings-link-lands-on-its-category`).
|
|
8
|
+
*
|
|
9
|
+
* Paseo 0.16 draws a plugin's settings screens as one native tab strip on the plugin's page (the app's
|
|
10
|
+
* plugins/settings/index.tsx `SettingsTabs`, unchanged in 0.17.0-beta.1), so there each category is its own screen
|
|
11
|
+
* and Follow-up draws no tabs of its own. Paseo 0.15 lists every settings screen as its own row in the plugin's •••
|
|
12
|
+
* menu, so there it keeps one screen, "Follow-up", with its own tabs (`FollowSettings` without a category).
|
|
13
|
+
*
|
|
14
|
+
* General keeps the old screen id, so a saved link or restored route to it lands on the first tab. Every link into
|
|
15
|
+
* settings goes through `open(category)`: it remembers the category and opens the screen that shows it; with no
|
|
16
|
+
* category it reopens the last one this device showed.
|
|
17
|
+
*/
|
|
18
|
+
export const SETTINGS_SCREEN = "projects";
|
|
19
|
+
const screenId = (category: SettingsCategory) => category === "general" ? SETTINGS_SCREEN : category;
|
|
20
|
+
|
|
21
|
+
/** The 0.16 app's client API (feeds, sidebar views): fixed for the app's lifetime. */
|
|
22
|
+
export const hasNativeSettingsTabs = (client: object) => {
|
|
23
|
+
const c = client as { subscribe?: unknown; addSidebarView?: unknown };
|
|
24
|
+
return typeof c.subscribe === "function" && typeof c.addSidebarView === "function";
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type SettingsScreenComponent = ComponentType<PluginSurfaceProps & { category?: SettingsCategory }>;
|
|
28
|
+
|
|
29
|
+
export function createSettings(client: Pick<PluginClientContext, "addSettingsScreen" | "openSettings">, Screen: SettingsScreenComponent, store: KeyValue = deviceStorage) {
|
|
30
|
+
const native = hasNativeSettingsTabs(client);
|
|
31
|
+
const removers = native
|
|
32
|
+
? SETTINGS_CATEGORIES.map(cat => client.addSettingsScreen({ id: screenId(cat.id), title: cat.title, icon: cat.icon,
|
|
33
|
+
Component: (props: PluginSurfaceProps) => createElement(Screen, { ...props, category: cat.id }) }))
|
|
34
|
+
: [client.addSettingsScreen({ id: SETTINGS_SCREEN, title: "Follow-up", icon: FOLLOW_UP_ICON, Component: (props: PluginSurfaceProps) => createElement(Screen, props) })];
|
|
35
|
+
/** `category` may be anything a caller passes (a press event too): only a known category counts. */
|
|
36
|
+
const open = (category?: unknown) => {
|
|
37
|
+
if (isCategory(category)) writeCategory(category, store);
|
|
38
|
+
client.openSettings(native ? screenId(readCategory(store)) : SETTINGS_SCREEN);
|
|
39
|
+
};
|
|
40
|
+
return { native, open, remove: () => { for (const r of removers) r(); } };
|
|
41
|
+
}
|
package/client/settings.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
2
|
import { useViewSync, useViewVersion } from "./view-store";
|
|
3
3
|
import { ActivityIndicator, TextInput, View } from "react-native";
|
|
4
4
|
import { Pressable, Text } from "./text";
|
|
@@ -226,16 +226,22 @@ function useSummaries(): Partial<Record<SettingsCategory, string | null>> {
|
|
|
226
226
|
* on this device. Phone: the category list, drilling in with a back row. Only the open category mounts, so only its
|
|
227
227
|
* data loads.
|
|
228
228
|
*/
|
|
229
|
+
const REVIEWERS_INFO = "Who Add reviewers asks on a PR: a list per repository, or the default for every repository without one. A login is a GitHub user (octocat) or a team (org/team). Teammates each keep their own lists.";
|
|
230
|
+
|
|
229
231
|
/** Settings → General → Help → Report a bug. */
|
|
230
232
|
export const REPORT_HINT = "Or an idea or feedback. An agent writes it up and shows you the issue before filing it.";
|
|
231
233
|
|
|
232
|
-
export function FollowSettings({ theme, layout, openSetup, openReport }: PluginSurfaceProps & { openSetup?: (resume?: boolean) => void; openReport?: () => void
|
|
234
|
+
export function FollowSettings({ theme, layout, openSetup, openReport, category: only }: PluginSurfaceProps & { openSetup?: (resume?: boolean) => void; openReport?: () => void;
|
|
235
|
+
/** Paseo 0.16: this screen is one category, and Paseo's own tabs switch between them (client/settings-screens.ts). */
|
|
236
|
+
category?: SettingsCategory }) {
|
|
233
237
|
const compact = layout.compact;
|
|
234
238
|
const c = theme.colors; const t = text(c, compact);
|
|
235
239
|
// The category comes from device storage on every render, so the first paint is the localStorage cache and the
|
|
236
240
|
// device document takes over when it loads, never the default in between.
|
|
237
241
|
useViewSync(); useViewVersion();
|
|
238
|
-
const category = readCategory();
|
|
242
|
+
const category = only ?? readCategory();
|
|
243
|
+
// A category screen remembers itself, so "Follow-up: settings" and the gear reopen the tab last shown on this device.
|
|
244
|
+
useEffect(() => { if (only && readCategory() !== only) writeCategory(only); }, [only]);
|
|
239
245
|
// The phone reopens in the last category, like desktop; before any pick it starts on the list. Until the developer
|
|
240
246
|
// drills in or out, that follows storage too (the phone's document loads after the first paint).
|
|
241
247
|
const [chosen, setDrilled] = useState<boolean | null>(null);
|
|
@@ -248,14 +254,28 @@ export function FollowSettings({ theme, layout, openSetup, openReport }: PluginS
|
|
|
248
254
|
const setup = openSetup ? { entry, open: () => openSetup(entry.resume) } : undefined;
|
|
249
255
|
const content = category === "general" ? <GeneralCategory theme={theme} compact={compact} setup={setup} openReport={openReport} />
|
|
250
256
|
: category === "following" ? <FollowingCategory theme={theme} compact={compact} />
|
|
251
|
-
|
|
252
|
-
|
|
257
|
+
// Under Paseo's tabs, Reviewers is a titled section like every other category, its explanation in the info tip.
|
|
258
|
+
: category === "reviewers" ? only ? <SettingsSection title="Reviewer lists" info={REVIEWERS_INFO}><ReviewerSettings theme={theme} compact={compact} /></SettingsSection>
|
|
259
|
+
: <View style={{ gap: 8 }}>
|
|
260
|
+
<Text style={t.meta}>{REVIEWERS_INFO}</Text>
|
|
253
261
|
<ReviewerSettings theme={theme} compact={compact} />
|
|
254
262
|
</View>
|
|
255
263
|
: category === "agents" ? <AgentsCategory theme={theme} compact={compact} />
|
|
256
264
|
: <DisplaySections theme={theme} />;
|
|
257
265
|
// Phones: the shared gutter and the bottom inset (the gesture bar), like every other Follow-up surface.
|
|
258
266
|
const page = { padding: compact ? space(true).gutter : 24, gap: 18, maxWidth: 720, width: "100%" as const, alignSelf: "center" as const, paddingBottom: 40 };
|
|
267
|
+
const line = summaries[category];
|
|
268
|
+
// General's status card and the Agents card header say it already; their lines are for the phone list.
|
|
269
|
+
// Reviewers' card says its own state, so under Paseo's tabs it has no line of its own.
|
|
270
|
+
const lead = line && category !== "general" && category !== "agents" && !(only && category === "reviewers") ? <Text style={[t.meta, !only && !compact ? { marginTop: -6 } : null]}>{line}</Text> : null;
|
|
271
|
+
// One category under Paseo's own tabs: no tabs, list or back row of Follow-up's own, and no column or gutter of its
|
|
272
|
+
// own either. Paseo's plugin page scrolls and sets the width, so the category lines up with its tabs. The line sits
|
|
273
|
+
// on the section titles' inset at a readable measure, and a section's worth of space parts the last card from
|
|
274
|
+
// Paseo's own Details below.
|
|
275
|
+
if (only) return <View style={{ gap: 18, paddingTop: 12, paddingBottom: 40 }}>
|
|
276
|
+
{lead && <View style={{ paddingHorizontal: 5, maxWidth: 680 }}>{lead}</View>}
|
|
277
|
+
{content}
|
|
278
|
+
</View>;
|
|
259
279
|
// The host's header sits right above: no extra top space on a phone.
|
|
260
280
|
if (compact) return <ScrollView style={{ flex: 1, backgroundColor: c.surface0 }} contentContainerStyle={{ ...page, paddingTop: 4, ...bottomInset(true, 28) }}>
|
|
261
281
|
{drilled ? <>
|
|
@@ -263,11 +283,9 @@ export function FollowSettings({ theme, layout, openSetup, openReport }: PluginS
|
|
|
263
283
|
{content}
|
|
264
284
|
</> : <CategoryList summaries={summaries} theme={theme} onOpen={id => { pick(id); setDrilled(true); }} />}
|
|
265
285
|
</ScrollView>;
|
|
266
|
-
const line = summaries[category];
|
|
267
286
|
return <ScrollView style={{ flex: 1, backgroundColor: c.surface0 }} stickyHeaderIndices={[0]} contentContainerStyle={{ ...page, paddingTop: 0 }}>
|
|
268
287
|
<View style={{ paddingTop: 24, backgroundColor: c.surface0 }}><CategoryTabs value={category} onChange={pick} theme={theme} /></View>
|
|
269
|
-
{
|
|
270
|
-
{line && category !== "general" && category !== "agents" ? <Text style={[t.meta, { marginTop: -6 }]}>{line}</Text> : null}
|
|
288
|
+
{lead}
|
|
271
289
|
{content}
|
|
272
290
|
</ScrollView>;
|
|
273
291
|
}
|
package/client/theme.ts
CHANGED
|
@@ -41,6 +41,18 @@ export function readable(color: string, colors: Colors): string {
|
|
|
41
41
|
return color;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
/**
|
|
45
|
+
* A status hue as a solid fill under white text: darkened until white reads on it (4.5:1), then by `shade` (hover
|
|
46
|
+
* 0.9, pressed 0.82). Dark hosts' danger red is a light text red; as a fill it is deepened, light hosts' red already passes.
|
|
47
|
+
*/
|
|
48
|
+
export function solidFor(color: string, shade = 1): string {
|
|
49
|
+
const rgb = channels(color);
|
|
50
|
+
if (!rgb) return color;
|
|
51
|
+
let k = 1;
|
|
52
|
+
while (k > 0.3 && 1.05 / (luminance(rgb.map(v => v * k)) + 0.05) < 4.5) k -= 0.02;
|
|
53
|
+
return `rgb(${rgb.map(v => Math.round(v * k * shade)).join(", ")})`;
|
|
54
|
+
}
|
|
55
|
+
|
|
44
56
|
export function withAlpha(color: string, alpha: number): string {
|
|
45
57
|
const rgb = channels(color);
|
|
46
58
|
return rgb ? `rgba(${rgb.join(", ")}, ${alpha})` : color;
|
package/client/updates.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
|
7
7
|
import { dismissUpdateNoticeRpc, installUpdateRpc, retryMoveRpc, setUpdatesRpc, updatesRpc } from "../shared/contracts";
|
|
8
8
|
import { moveLine } from "../shared/plugin-move";
|
|
9
9
|
import { MODE_HINT, MODE_LABEL, UPDATE_MODES, WHATS_NEW_LABEL, channelHint, checkedText, copyCommand, statusCopy, versionMark, whatsNewHint, type StatusAction, type UpdateMode, type UpdatesChange, type UpdatesView } from "../shared/updates";
|
|
10
|
-
import {
|
|
10
|
+
import type { SettingsCategory } from "../shared/settings-nav";
|
|
11
11
|
import type { Channel } from "../shared/version";
|
|
12
12
|
import { Button, errorText, space, text, useNow, type Theme } from "./kit";
|
|
13
13
|
import { Spinner } from "./motion";
|
|
@@ -28,7 +28,7 @@ export function useUpdates(check?: "settings") {
|
|
|
28
28
|
|
|
29
29
|
const toneColor = (tone: "success" | "warning" | "muted", c: Theme["colors"]) => tone === "success" ? c.statusSuccess : tone === "warning" ? c.statusWarning : c.foregroundMuted;
|
|
30
30
|
/** Home's top line: an update to install (Tell me mode) or a rollback. One slot; the rollback wins. */
|
|
31
|
-
export function UpdateNotice({ theme, compact, openSettings }: { theme: Theme; compact: boolean; openSettings: () => void }) {
|
|
31
|
+
export function UpdateNotice({ theme, compact, openSettings }: { theme: Theme; compact: boolean; openSettings: (category?: SettingsCategory) => void }) {
|
|
32
32
|
const c = theme.colors; const t = text(c);
|
|
33
33
|
const query = useUpdates(); const cache = useQueryClient(); const toast = useToast();
|
|
34
34
|
const dismiss = useRpc(dismissUpdateNoticeRpc); const install = useRpc(installUpdateRpc);
|
|
@@ -53,7 +53,7 @@ export function UpdateNotice({ theme, compact, openSettings }: { theme: Theme; c
|
|
|
53
53
|
</Pressable>
|
|
54
54
|
</View>
|
|
55
55
|
<View style={{ flexDirection: "row", gap: 8, paddingLeft: 25 }}>
|
|
56
|
-
{rolled ? <Button title="Details" theme={theme} compact={compact} onPress={() =>
|
|
56
|
+
{rolled ? <Button title="Details" theme={theme} compact={compact} onPress={() => openSettings("general")} />
|
|
57
57
|
: confirm ? <>
|
|
58
58
|
<Button title="Install now" theme={theme} compact={compact} loading={run.isPending} onPress={() => run.mutate(() => install({ version: n.version, anyway: true }))} />
|
|
59
59
|
<Button title="Cancel" kind="ghost" theme={theme} compact={compact} onPress={() => setConfirm(false)} />
|
|
@@ -212,7 +212,7 @@ export function UpdatesStep({ theme, compact }: { theme: Theme; compact: boolean
|
|
|
212
212
|
* accessibility label still says it. Loading takes no width; a failed read shows nothing. `touch`: a 44pt box
|
|
213
213
|
* (react-native-web ignores hitSlop).
|
|
214
214
|
*/
|
|
215
|
-
export function VersionMark({ theme, touch, openSettings }: { theme: Theme; touch: boolean; openSettings: () => void }) {
|
|
215
|
+
export function VersionMark({ theme, touch, openSettings }: { theme: Theme; touch: boolean; openSettings: (category?: SettingsCategory) => void }) {
|
|
216
216
|
const c = theme.colors; const t = text(c, touch);
|
|
217
217
|
const query = useUpdates();
|
|
218
218
|
if (!query.data) return null;
|
|
@@ -220,7 +220,7 @@ export function VersionMark({ theme, touch, openSettings }: { theme: Theme; touc
|
|
|
220
220
|
const style = touch ? t.meta : t.small;
|
|
221
221
|
const box = touch ? { minHeight: 44, paddingHorizontal: 10, justifyContent: "center" as const } : { paddingHorizontal: 4, paddingVertical: 4 };
|
|
222
222
|
return <Pressable accessibilityRole="button" accessibilityLabel={mark.label} accessibilityHint="Opens Follow-up settings, General" hitSlop={touch ? undefined : 8}
|
|
223
|
-
onPress={() =>
|
|
223
|
+
onPress={() => openSettings("general")} style={[box, { flexShrink: 1, minWidth: 0 }]}>
|
|
224
224
|
{state => { const hover = !!(state as { hovered?: boolean }).hovered || state.pressed; const line = hover ? { color: c.foreground, textDecorationLine: "underline" as const } : null;
|
|
225
225
|
return <Text numberOfLines={1} style={[style, line]}>{mark.version}</Text>; }}
|
|
226
226
|
</Pressable>;
|
|
Binary file
|
|
Binary file
|