paseo-office 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/OVERVIEW.md +27 -0
  2. package/README.md +65 -134
  3. package/client/action-button.tsx +4 -1
  4. package/client/activity-panel.tsx +6 -4
  5. package/client/agent-appearance.tsx +257 -0
  6. package/client/agent-card.tsx +2 -1
  7. package/client/agent-picker-text.ts +23 -4
  8. package/client/agent-picker.tsx +5 -8
  9. package/client/board-sheet.tsx +48 -16
  10. package/client/board-text.ts +12 -2
  11. package/client/brand.ts +1 -0
  12. package/client/chat-chrome.tsx +318 -0
  13. package/client/chat-compose-tools.tsx +314 -0
  14. package/client/chat-dictation.tsx +133 -0
  15. package/client/chat-more.tsx +119 -0
  16. package/client/chat-panel.tsx +401 -146
  17. package/client/chat-quick.tsx +198 -0
  18. package/client/chat-text.ts +25 -6
  19. package/client/column-sheet.tsx +93 -23
  20. package/client/conversation-model.ts +19 -5
  21. package/client/duty-sheet.tsx +321 -0
  22. package/client/duty-text.ts +20 -0
  23. package/client/fullscreen-header.tsx +28 -13
  24. package/client/fullscreen-theme.ts +38 -0
  25. package/client/host-details.tsx +269 -0
  26. package/client/host-styles.ts +129 -0
  27. package/client/host-switches.tsx +212 -83
  28. package/client/incidents-card.tsx +2 -1
  29. package/client/janitor-card.tsx +1 -1
  30. package/client/library-card.tsx +2 -1
  31. package/client/list-text.ts +8 -6
  32. package/client/lobby-board.tsx +73 -53
  33. package/client/machine-card.tsx +225 -85
  34. package/client/messenger-styles.ts +216 -0
  35. package/client/new-agent-form.tsx +153 -61
  36. package/client/new-agent-model.ts +2 -0
  37. package/client/notes-card.tsx +111 -83
  38. package/client/notes-days.tsx +1 -1
  39. package/client/office-brand-context.ts +44 -0
  40. package/client/office-column.tsx +2 -1
  41. package/client/office-keyboard.ts +79 -0
  42. package/client/office-link.ts +7 -1
  43. package/client/office-mark.tsx +29 -0
  44. package/client/office-modal.tsx +440 -0
  45. package/client/office-settings.tsx +75 -30
  46. package/client/office-state.ts +12 -2
  47. package/client/office-surface.tsx +591 -81
  48. package/client/pixel/actors.ts +2 -1
  49. package/client/pixel/art.ts +33 -19
  50. package/client/pixel/pixel-office.tsx +2 -2
  51. package/client/prompt-coach.tsx +152 -0
  52. package/client/qa-card.tsx +2 -1
  53. package/client/review-card.tsx +2 -1
  54. package/client/room-board.tsx +26 -2
  55. package/client/scene-picker.tsx +158 -0
  56. package/client/scene-previews.ts +10 -0
  57. package/client/session-pane.tsx +25 -5
  58. package/client/session-panel-detail.tsx +238 -0
  59. package/client/session-panel.tsx +222 -137
  60. package/client/session-styles.ts +224 -1
  61. package/client/session-transcript.tsx +243 -0
  62. package/client/sessions-panel.tsx +181 -22
  63. package/client/sessions-text.ts +18 -0
  64. package/client/settings-sections.tsx +126 -0
  65. package/client/sidebar-launcher.ts +29 -0
  66. package/client/ssh-hosts.tsx +331 -0
  67. package/client/ssh-metrics.ts +76 -0
  68. package/client/standup-card.tsx +2 -1
  69. package/client/structure-view.tsx +20 -3
  70. package/client/styles.ts +170 -62
  71. package/client/team-chat-preview.tsx +96 -0
  72. package/client/tracker-connections.tsx +252 -0
  73. package/client/transcript-styles.ts +90 -0
  74. package/client/use-device-switch.ts +21 -12
  75. package/client/use-duty-actions.ts +43 -0
  76. package/client/use-group-photo.ts +48 -0
  77. package/client/use-new-agent.ts +4 -0
  78. package/client/use-street.ts +8 -0
  79. package/client/workspace-office-tools.tsx +102 -0
  80. package/client/workspace-overlay-route.web.ts +47 -0
  81. package/client/workspace-overlay.tsx +195 -0
  82. package/client/world/adapter.ts +37 -2
  83. package/client/world/escape.ts +58 -0
  84. package/client/world/use-world-feed.ts +6 -2
  85. package/client/world/workspace-dock.ts +6 -0
  86. package/client/world/world-api.ts +45 -4
  87. package/client/world/world-bridge-page.ts +14 -3
  88. package/client/world/world-bridge.ts +50 -5
  89. package/client/world/world-frame.web.ts +8 -0
  90. package/client/world/world-view-native.tsx +31 -10
  91. package/client/world/world-view-shared.ts +36 -7
  92. package/client/world/world-view.tsx +93 -21
  93. package/docs/office.md +165 -64
  94. package/index.client.tsx +13 -6
  95. package/index.server.ts +232 -16
  96. package/package.json +2 -1
  97. package/server/activity.ts +42 -19
  98. package/server/agent-tools.ts +11 -5
  99. package/server/board-service.ts +381 -10
  100. package/server/brand-logo.ts +34 -0
  101. package/server/chat-group.ts +83 -0
  102. package/server/chat-service.ts +406 -62
  103. package/server/chat-store.ts +1 -4
  104. package/server/directory.ts +22 -7
  105. package/server/duty-service.ts +230 -0
  106. package/server/group-photo.ts +39 -0
  107. package/server/home-departure.ts +47 -0
  108. package/server/hub.ts +43 -1
  109. package/server/incidents-jira.ts +19 -7
  110. package/server/incidents-schedule.ts +10 -10
  111. package/server/incidents-sentry.ts +34 -8
  112. package/server/live-ports.ts +114 -18
  113. package/server/lobby-pickup.ts +170 -0
  114. package/server/machine/details.ts +91 -0
  115. package/server/mention-queue.ts +14 -0
  116. package/server/office.ts +110 -6
  117. package/server/paths.ts +14 -0
  118. package/server/ssh/LICENSE.paseo +211 -0
  119. package/server/ssh/client.ts +401 -0
  120. package/server/ssh/discovery.ts +230 -0
  121. package/server/ssh/installed.ts +104 -0
  122. package/server/ssh/monitor.ts +104 -0
  123. package/server/ssh/pid-files.ts +194 -0
  124. package/server/ssh/read.ts +136 -0
  125. package/server/subagent-names.ts +4 -0
  126. package/server/tracker-credentials.ts +141 -0
  127. package/server/words.generated.ts +1 -1
  128. package/server/world.generated.ts +1 -1
  129. package/shared/appearance.ts +43 -0
  130. package/shared/branding.ts +53 -0
  131. package/shared/chat-words.ts +2 -2
  132. package/shared/contracts.ts +199 -5
  133. package/shared/duties.ts +100 -0
  134. package/shared/host-details.ts +25 -0
  135. package/shared/lobby-assignment.ts +34 -0
  136. package/shared/model.ts +9 -1
  137. package/shared/names.ts +2 -0
  138. package/shared/settings.ts +14 -3
  139. package/shared/ssh.ts +34 -0
  140. package/shared/upstream/README.md +1 -3
  141. package/shared/upstream/chat-engine.d.ts +4 -0
  142. package/shared/upstream/prompt-coach.d.ts +6 -0
  143. package/shared/upstream/prompt-coach.js +178 -0
@@ -1,17 +1,21 @@
1
- import { useCallback, useMemo, useState } from "react";
2
- import { Pressable, Text, View } from "react-native";
3
- import { ScrollView, TextInput } from "@getpaseo/plugin/client/ui";
1
+ import { AVATARS, shirtColor } from "../shared/appearance.js";
2
+ import { useCallback, useMemo, useState, type CSSProperties } from "react";
3
+ import { Platform, Pressable, Text, View, type ViewStyle } from "react-native";
4
+ import type { ChecklistProgress } from "../shared/contracts.js";
5
+ import { useRowClock } from "./structure-view.js";
6
+ import { Icon, ScrollView, TextInput } from "@getpaseo/plugin/client/ui";
4
7
  import { agentTitle, buildOfficeModel, dotTone } from "../shared/model.js";
5
8
  import { loadProblem } from "./activity-panel.js";
6
9
  import { stateLabel } from "./agent-card.js";
7
10
  import { ActionButton } from "./action-button.js";
8
11
  import { NewAgentForm } from "./new-agent-form.js";
9
- import { NO_MATCH, SEARCH_LABEL, tabCounts, type ListTab } from "./list-text.js";
12
+ import { NO_MATCH, SEARCH_LABEL, tabCounts, timeText, type ListTab } from "./list-text.js";
10
13
  import type { ColumnPanelProps, OfficeLink } from "./office-link.js";
11
14
  import {
12
15
  NO_AGENTS,
13
16
  avatarInitials,
14
17
  sessionDetail,
18
+ sessionMeter,
15
19
  sessionSections,
16
20
  type GroupedSession,
17
21
  type SessionGroup,
@@ -19,20 +23,110 @@ import {
19
23
  import type { OfficeStyles } from "./styles.js";
20
24
 
21
25
  interface AgentRowProps {
26
+ now: number;
27
+ progress?: ChecklistProgress;
22
28
  entry: GroupedSession;
23
29
  link: OfficeLink;
24
30
  styles: OfficeStyles;
25
31
  }
26
32
 
27
- function AgentRow({ entry, link, styles }: AgentRowProps) {
33
+ type Meter = NonNullable<ReturnType<typeof sessionMeter>>;
34
+
35
+ function SessionMeter({ meter, styles }: { meter: Meter; styles: OfficeStyles }) {
36
+ const ui = styles.sessions;
37
+ const fill = useMemo(
38
+ (): ViewStyle[] => [
39
+ meter.kind === "tasks" ? ui.tasksFill : ui.contextFill,
40
+ { width: `${meter.percent}%` },
41
+ ],
42
+ [meter.kind, meter.percent, ui],
43
+ );
44
+ return (
45
+ <View style={ui.meterRow}>
46
+ <View
47
+ accessibilityRole="progressbar"
48
+ accessibilityLabel={meter.label}
49
+ aria-valuemin={0}
50
+ aria-valuemax={100}
51
+ aria-valuenow={meter.percent}
52
+ style={ui.track}
53
+ >
54
+ <View style={fill} />
55
+ </View>
56
+ <Text style={ui.meterText}>{meter.label}</Text>
57
+ </View>
58
+ );
59
+ }
60
+
61
+ const desktopWorkspaceButton: CSSProperties = {
62
+ display: "grid",
63
+ placeItems: "center",
64
+ flexShrink: 0,
65
+ width: 44,
66
+ minHeight: 44,
67
+ padding: 0,
68
+ border: 0,
69
+ borderRadius: 8,
70
+ background: "transparent",
71
+ cursor: "pointer",
72
+ WebkitAppRegion: "no-drag",
73
+ } as CSSProperties;
74
+ const workspaceGlyph: CSSProperties = { display: "inline-flex", pointerEvents: "none" };
75
+
76
+ function WorkspaceButton({
77
+ title,
78
+ open,
79
+ styles,
80
+ }: {
81
+ title: string;
82
+ open(): void;
83
+ styles: OfficeStyles;
84
+ }) {
85
+ const label = `Open ${title}'s workspace`;
86
+ const icon = <Icon name="ArrowUpRight" size={16} color={styles.iconColor} />;
87
+ if (Platform.OS === "web") {
88
+ return (
89
+ <button
90
+ type="button"
91
+ aria-label={label}
92
+ title={label}
93
+ style={desktopWorkspaceButton}
94
+ onClick={open}
95
+ >
96
+ <span aria-hidden="true" style={workspaceGlyph}>
97
+ {icon}
98
+ </span>
99
+ </button>
100
+ );
101
+ }
102
+ return (
103
+ <Pressable
104
+ accessibilityRole="button"
105
+ accessibilityLabel={label}
106
+ onPress={open}
107
+ style={styles.sessions.rowOpen}
108
+ >
109
+ {icon}
110
+ </Pressable>
111
+ );
112
+ }
113
+
114
+ function AgentRow({ entry, link, styles, now, progress }: AgentRowProps) {
28
115
  const { row, room, level } = entry;
29
116
  const { agent } = row;
30
117
  const ui = styles.sessions;
31
118
  const title = agentTitle(agent);
32
- const tone = dotTone(agent);
119
+ const tone =
120
+ row.waitingOn && agent.status === "idle" && !agent.permissions.length
121
+ ? "running"
122
+ : dotTone(agent);
33
123
  const state = stateLabel(agent);
34
124
  const text = sessionDetail(entry);
125
+ const time = timeText(row, now);
126
+ const meter = sessionMeter(agent, progress);
35
127
  const press = useCallback(() => link.select(agent.id), [link, agent.id]);
128
+ const { openWorkspace } = link;
129
+ const showWorkspace = useCallback(() => openWorkspace?.(agent.id), [openWorkspace, agent.id]);
36
130
  let accent: typeof ui.error | undefined;
37
131
  let detailColor: typeof ui.warningText | undefined;
38
132
  if (tone === "warning") {
@@ -43,18 +137,28 @@ function AgentRow({ entry, link, styles }: AgentRowProps) {
43
137
  accent = ui.error;
44
138
  detailColor = ui.errorText;
45
139
  }
46
- const rowStyle = useMemo(() => [ui.row, accent], [ui, accent]);
140
+ const borderColor = shirtColor(agent.appearance);
141
+ const avatarStyle = useMemo(
142
+ () => [ui.avatar, borderColor && { borderColor, borderWidth: 2 }],
143
+ [ui.avatar, borderColor],
144
+ );
145
+ const clockStyle = useMemo(
146
+ () => [ui.clock, detailColor, tone === "running" && ui.workingClock],
147
+ [ui, tone, detailColor],
148
+ );
149
+ const rowStyle = useMemo(() => [ui.row, ui.rowMain, accent], [ui, accent]);
47
150
  const detailStyle = useMemo(() => [ui.detail, detailColor], [ui, detailColor]);
48
151
  const [hovered, setHovered] = useState(false);
49
152
  const hoverIn = useCallback(() => setHovered(true), []);
50
153
  const hoverOut = useCallback(() => setHovered(false), []);
51
154
  const nested = level > 1 ? ui.deep : ui.nested;
155
+ const wrapStyle = useMemo(() => [ui.rowWrap, level ? nested : undefined], [ui, level, nested]);
52
156
  return (
53
- <View style={level ? nested : undefined}>
157
+ <View style={wrapStyle}>
54
158
  <Pressable
55
159
  accessibilityRole="button"
56
160
  accessibilityLabel={`${title}: ${state}`}
57
- accessibilityHint={text || room.name}
161
+ accessibilityHint={[text || room.name, time, meter?.label].filter(Boolean).join(", ")}
58
162
  onPress={press}
59
163
  onHoverIn={hoverIn}
60
164
  onHoverOut={hoverOut}
@@ -63,8 +167,12 @@ function AgentRow({ entry, link, styles }: AgentRowProps) {
63
167
  {({ pressed }) => (
64
168
  <>
65
169
  {(pressed || hovered) && <View style={styles.pressedFill} />}
66
- <View style={ui.avatar}>
67
- <Text style={ui.initials}>{avatarInitials(title)}</Text>
170
+ <View style={avatarStyle}>
171
+ <Text style={ui.initials}>
172
+ {agent.appearance?.avatar
173
+ ? AVATARS[agent.appearance.avatar]
174
+ : avatarInitials(title)}
175
+ </Text>
68
176
  <View style={ui.badge}>
69
177
  <View style={styles.dot[tone]} />
70
178
  </View>
@@ -77,16 +185,23 @@ function AgentRow({ entry, link, styles }: AgentRowProps) {
77
185
  <Text numberOfLines={1} style={ui.project}>
78
186
  {room.name}
79
187
  </Text>
188
+ {time ? (
189
+ <Text numberOfLines={1} style={clockStyle}>
190
+ {time}
191
+ </Text>
192
+ ) : null}
80
193
  </View>
81
194
  {text ? (
82
195
  <Text style={detailStyle} numberOfLines={1}>
83
196
  {text}
84
197
  </Text>
85
198
  ) : null}
199
+ {meter ? <SessionMeter meter={meter} styles={styles} /> : null}
86
200
  </View>
87
201
  </>
88
202
  )}
89
203
  </Pressable>
204
+ {openWorkspace && <WorkspaceButton title={title} open={showWorkspace} styles={styles} />}
90
205
  </View>
91
206
  );
92
207
  }
@@ -101,7 +216,11 @@ function SectionHeading({
101
216
  group,
102
217
  rows,
103
218
  styles,
219
+ expanded,
220
+ onToggle,
104
221
  }: {
222
+ expanded: boolean;
223
+ onToggle(): void;
105
224
  group: SessionGroup;
106
225
  rows: GroupedSession[];
107
226
  styles: OfficeStyles;
@@ -121,13 +240,27 @@ function SectionHeading({
121
240
  : ui.warningText;
122
241
  }
123
242
  const headingStyle = useMemo(() => [ui.headingText, accent], [ui, accent]);
124
- return (
125
- <View style={ui.heading}>
243
+ const chevron = useMemo(() => [ui.chevron, expanded ? ui.down : ui.right], [ui, expanded]);
244
+ const heading = (
245
+ <>
126
246
  <Text accessibilityRole="header" style={headingStyle}>
127
247
  {title}
128
248
  </Text>
129
249
  <Text style={ui.headingCount}>{rows.length}</Text>
130
- </View>
250
+ {group === "resting" ? <View style={chevron} /> : null}
251
+ </>
252
+ );
253
+ if (group !== "resting") return <View style={ui.heading}>{heading}</View>;
254
+ return (
255
+ <Pressable
256
+ accessibilityRole="button"
257
+ accessibilityLabel="Resting sessions"
258
+ aria-expanded={expanded}
259
+ onPress={onToggle}
260
+ style={ui.heading}
261
+ >
262
+ {heading}
263
+ </Pressable>
131
264
  );
132
265
  }
133
266
 
@@ -143,7 +276,7 @@ export function SessionsPanel(props: ColumnPanelProps) {
143
276
  const created = useCallback(
144
277
  (agentId: string) => {
145
278
  setOpen(false);
146
- change({ prompt: "" });
279
+ change({ prompt: "", appearance: undefined });
147
280
  link.openSession(agentId);
148
281
  },
149
282
  [link, setOpen, change],
@@ -170,8 +303,11 @@ function SessionList({
170
303
  }: ColumnPanelProps & { onNewAgent(): void }) {
171
304
  const { state, loaded, subscription } = office;
172
305
  const [tab, setTab] = useState<ListTab>("all");
306
+ const [restingExpanded, setRestingExpanded] = useState(true);
307
+ const toggleResting = useCallback(() => setRestingExpanded((value) => !value), []);
173
308
  const [query, setQuery] = useState("");
174
309
  const model = useMemo(() => buildOfficeModel(state), [state]);
310
+ const now = useRowClock(model.rooms);
175
311
  // The counts ignore the search, as the List view's do.
176
312
  const counts = useMemo(() => tabCounts(model.rooms.flatMap((room) => room.rows)), [model]);
177
313
  const shown = useMemo(() => sessionSections(model, tab, query), [model, tab, query]);
@@ -179,6 +315,15 @@ function SessionList({
179
315
  const reset = useCallback(() => {
180
316
  setTab("all");
181
317
  setQuery("");
318
+ setRestingExpanded(true);
319
+ }, []);
320
+ const choose = useCallback((next: ListTab) => {
321
+ setTab(next);
322
+ if (next === "resting") setRestingExpanded(true);
323
+ }, []);
324
+ const changeQuery = useCallback((value: string) => {
325
+ setQuery(value);
326
+ if (value.trim()) setRestingExpanded(true);
182
327
  }, []);
183
328
  const ui = styles.sessions;
184
329
  const problem = loadProblem(subscription);
@@ -188,7 +333,7 @@ function SessionList({
188
333
  else if (GROUPS.every((group) => shown[group].length === 0)) status = NO_MATCH;
189
334
  return (
190
335
  <View style={styles.screen}>
191
- <ScrollView contentContainerStyle={styles.panelFeed}>
336
+ <ScrollView keyboardShouldPersistTaps="handled" contentContainerStyle={styles.panelFeed}>
192
337
  <View style={ui.top}>
193
338
  <View style={ui.actions}>
194
339
  <Pressable
@@ -219,7 +364,7 @@ function SessionList({
219
364
  tone={tone}
220
365
  count={counts[group]}
221
366
  chosen={tab === group}
222
- choose={setTab}
367
+ choose={choose}
223
368
  styles={styles}
224
369
  />
225
370
  ))}
@@ -229,7 +374,7 @@ function SessionList({
229
374
  placeholder="Search sessions"
230
375
  placeholderTextColor={styles.placeholderColor}
231
376
  value={query}
232
- onChangeText={setQuery}
377
+ onChangeText={changeQuery}
233
378
  style={ui.search}
234
379
  />
235
380
  </View>
@@ -246,10 +391,24 @@ function SessionList({
246
391
  {GROUPS.map((group) =>
247
392
  shown[group].length ? (
248
393
  <View key={group} style={ui.section}>
249
- <SectionHeading group={group} rows={shown[group]} styles={styles} />
250
- {shown[group].map((entry) => (
251
- <AgentRow key={entry.row.agent.id} entry={entry} link={link} styles={styles} />
252
- ))}
394
+ <SectionHeading
395
+ group={group}
396
+ rows={shown[group]}
397
+ styles={styles}
398
+ expanded={restingExpanded}
399
+ onToggle={toggleResting}
400
+ />
401
+ {(group !== "resting" || restingExpanded) &&
402
+ shown[group].map((entry) => (
403
+ <AgentRow
404
+ key={entry.row.agent.id}
405
+ entry={entry}
406
+ link={link}
407
+ styles={styles}
408
+ now={now}
409
+ progress={state.checklistProgress?.[entry.row.agent.id]}
410
+ />
411
+ ))}
253
412
  </View>
254
413
  ) : null,
255
414
  )}
@@ -1,3 +1,5 @@
1
+ import type { ChecklistProgress, OfficeAgent } from "../shared/contracts.js";
2
+ import { contextPercent } from "./context-text.js";
1
3
  import { ACTIVITY_KINDS } from "../shared/names.js";
2
4
  import { eventText } from "./activity-feed-text.js";
3
5
  import { agentTask, agentTitle } from "../shared/model.js";
@@ -138,3 +140,19 @@ export function avatarInitials(name: string): string {
138
140
  .join("") || "•"
139
141
  ).toUpperCase();
140
142
  }
143
+
144
+ /** Prefer reported task completion; a provider's context percentage has its own label and color. */
145
+ export function sessionMeter(agent: OfficeAgent, progress?: ChecklistProgress) {
146
+ if (progress && progress.total > 0) {
147
+ const { completed, total } = progress;
148
+ return {
149
+ kind: "tasks" as const,
150
+ label: `${completed}/${total} tasks`,
151
+ percent: Math.min(100, Math.round((100 * completed) / total)),
152
+ };
153
+ }
154
+ const percent = contextPercent(agent);
155
+ return percent === null
156
+ ? null
157
+ : { kind: "context" as const, label: `Context ${percent}%`, percent };
158
+ }
@@ -0,0 +1,126 @@
1
+ import { useCallback, useState, type ReactNode } from "react";
2
+ import { Pressable, StyleSheet, Text, View } from "react-native";
3
+ import { Icon, ScrollView } from "@getpaseo/plugin/client/ui";
4
+ import { useFullscreenDialog } from "./office-modal.js";
5
+ import type { OfficeStyles } from "./styles.js";
6
+
7
+ const sections = ["Appearance", "Automation", "Services"] as const;
8
+ type Section = (typeof sections)[number];
9
+ const icons = { Appearance: "Palette", Automation: "CalendarClock", Services: "Plug" };
10
+ export const settingsLayout = StyleSheet.create({
11
+ fill: { flex: 1, minHeight: 0 },
12
+ flush: { padding: 0, gap: 0 },
13
+ nav: {
14
+ flexDirection: "row",
15
+ alignItems: "center",
16
+ gap: 4,
17
+ paddingHorizontal: 12,
18
+ paddingVertical: 8,
19
+ borderBottomWidth: StyleSheet.hairlineWidth,
20
+ },
21
+ tab: {
22
+ flex: 1,
23
+ minWidth: 0,
24
+ flexDirection: "row",
25
+ alignItems: "center",
26
+ justifyContent: "center",
27
+ flexWrap: "wrap",
28
+ alignContent: "center",
29
+ gap: 5,
30
+ paddingHorizontal: 2,
31
+ minHeight: 44,
32
+ borderRadius: 8,
33
+ },
34
+ page: { padding: 18, gap: 20 },
35
+ block: { gap: 10 },
36
+ strip: {
37
+ flexDirection: "row",
38
+ alignItems: "center",
39
+ justifyContent: "space-between",
40
+ flexWrap: "wrap",
41
+ gap: 8,
42
+ },
43
+ });
44
+
45
+ function SectionButton({
46
+ section,
47
+ active,
48
+ select,
49
+ styles,
50
+ }: {
51
+ section: Section;
52
+ active: boolean;
53
+ select(section: Section): void;
54
+ styles: OfficeStyles;
55
+ }) {
56
+ const press = useCallback(() => select(section), [select, section]);
57
+ return (
58
+ <Pressable
59
+ accessibilityRole="button"
60
+ accessibilityLabel={section}
61
+ aria-pressed={active}
62
+ onPress={press}
63
+ style={StyleSheet.compose(
64
+ active ? styles.sidebarButtonActive : styles.workspaceAction,
65
+ settingsLayout.tab,
66
+ )}
67
+ >
68
+ <Icon
69
+ name={icons[section]}
70
+ size={16}
71
+ color={active ? styles.workspaceAccent : styles.iconColor}
72
+ />
73
+ <Text style={styles.sidebarButtonText}>{section}</Text>
74
+ </Pressable>
75
+ );
76
+ }
77
+
78
+ export function SettingsSections({
79
+ appearance,
80
+ automation,
81
+ services,
82
+ styles,
83
+ }: {
84
+ appearance: ReactNode;
85
+ automation: ReactNode;
86
+ services: ReactNode;
87
+ styles: OfficeStyles;
88
+ }) {
89
+ const [section, select] = useState<Section>("Appearance");
90
+ const fullscreen = useFullscreenDialog();
91
+ const pages = { Appearance: appearance, Automation: automation, Services: services };
92
+ const contentStyle = fullscreen ? settingsLayout.fill : undefined;
93
+ const content = sections.map((name) => (
94
+ <View key={name} style={name !== section ? styles.hidden : contentStyle}>
95
+ {fullscreen ? (
96
+ <ScrollView style={settingsLayout.fill} contentContainerStyle={settingsLayout.page}>
97
+ {pages[name]}
98
+ </ScrollView>
99
+ ) : (
100
+ <View style={settingsLayout.page}>{pages[name]}</View>
101
+ )}
102
+ </View>
103
+ ));
104
+ return (
105
+ <View style={fullscreen ? settingsLayout.fill : undefined}>
106
+ <View
107
+ role="group"
108
+ aria-label="Settings sections"
109
+ style={StyleSheet.compose(settingsLayout.nav, {
110
+ borderBottomColor: styles.sidebarButton.borderColor,
111
+ })}
112
+ >
113
+ {sections.map((name) => (
114
+ <SectionButton
115
+ key={name}
116
+ section={name}
117
+ active={section === name}
118
+ select={select}
119
+ styles={styles}
120
+ />
121
+ ))}
122
+ </View>
123
+ {content}
124
+ </View>
125
+ );
126
+ }
@@ -0,0 +1,29 @@
1
+ // Paseo can keep earlier screens and workspace tabs mounted. Each installation only
2
+ // offers the sidebar press to its own surfaces, until a visible one handles it.
3
+ export function createSidebarLauncher() {
4
+ const surfaces = new Set<() => boolean>();
5
+ let openingScreen = false;
6
+ return {
7
+ register(activate: () => boolean) {
8
+ surfaces.add(activate);
9
+ return () => {
10
+ surfaces.delete(activate);
11
+ };
12
+ },
13
+ takeScreenLaunch() {
14
+ const pending = openingScreen;
15
+ openingScreen = false;
16
+ return pending;
17
+ },
18
+ open() {
19
+ openingScreen = false;
20
+ for (const activate of surfaces) {
21
+ if (activate()) return true;
22
+ }
23
+ openingScreen = true;
24
+ return false;
25
+ },
26
+ };
27
+ }
28
+
29
+ export type SidebarLauncher = ReturnType<typeof createSidebarLauncher>;