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.
- package/OVERVIEW.md +27 -0
- package/README.md +65 -134
- package/client/action-button.tsx +4 -1
- package/client/activity-panel.tsx +6 -4
- package/client/agent-appearance.tsx +257 -0
- package/client/agent-card.tsx +2 -1
- package/client/agent-picker-text.ts +23 -4
- package/client/agent-picker.tsx +5 -8
- package/client/board-sheet.tsx +48 -16
- package/client/board-text.ts +12 -2
- package/client/brand.ts +1 -0
- package/client/chat-chrome.tsx +318 -0
- package/client/chat-compose-tools.tsx +314 -0
- package/client/chat-dictation.tsx +133 -0
- package/client/chat-more.tsx +119 -0
- package/client/chat-panel.tsx +401 -146
- package/client/chat-quick.tsx +198 -0
- package/client/chat-text.ts +25 -6
- package/client/column-sheet.tsx +93 -23
- package/client/conversation-model.ts +19 -5
- package/client/duty-sheet.tsx +321 -0
- package/client/duty-text.ts +20 -0
- package/client/fullscreen-header.tsx +28 -13
- package/client/fullscreen-theme.ts +38 -0
- package/client/host-details.tsx +269 -0
- package/client/host-styles.ts +129 -0
- package/client/host-switches.tsx +212 -83
- package/client/incidents-card.tsx +2 -1
- package/client/janitor-card.tsx +1 -1
- package/client/library-card.tsx +2 -1
- package/client/list-text.ts +8 -6
- package/client/lobby-board.tsx +73 -53
- package/client/machine-card.tsx +225 -85
- package/client/messenger-styles.ts +216 -0
- package/client/new-agent-form.tsx +153 -61
- package/client/new-agent-model.ts +2 -0
- package/client/notes-card.tsx +111 -83
- package/client/notes-days.tsx +1 -1
- package/client/office-brand-context.ts +44 -0
- package/client/office-column.tsx +2 -1
- package/client/office-keyboard.ts +79 -0
- package/client/office-link.ts +7 -1
- package/client/office-mark.tsx +29 -0
- package/client/office-modal.tsx +440 -0
- package/client/office-settings.tsx +75 -30
- package/client/office-state.ts +12 -2
- package/client/office-surface.tsx +591 -81
- package/client/pixel/actors.ts +2 -1
- package/client/pixel/art.ts +33 -19
- package/client/pixel/pixel-office.tsx +2 -2
- package/client/prompt-coach.tsx +152 -0
- package/client/qa-card.tsx +2 -1
- package/client/review-card.tsx +2 -1
- package/client/room-board.tsx +26 -2
- package/client/scene-picker.tsx +158 -0
- package/client/scene-previews.ts +10 -0
- package/client/session-pane.tsx +25 -5
- package/client/session-panel-detail.tsx +238 -0
- package/client/session-panel.tsx +222 -137
- package/client/session-styles.ts +224 -1
- package/client/session-transcript.tsx +243 -0
- package/client/sessions-panel.tsx +181 -22
- package/client/sessions-text.ts +18 -0
- package/client/settings-sections.tsx +126 -0
- package/client/sidebar-launcher.ts +29 -0
- package/client/ssh-hosts.tsx +331 -0
- package/client/ssh-metrics.ts +76 -0
- package/client/standup-card.tsx +2 -1
- package/client/structure-view.tsx +20 -3
- package/client/styles.ts +170 -62
- package/client/team-chat-preview.tsx +96 -0
- package/client/tracker-connections.tsx +252 -0
- package/client/transcript-styles.ts +90 -0
- package/client/use-device-switch.ts +21 -12
- package/client/use-duty-actions.ts +43 -0
- package/client/use-group-photo.ts +48 -0
- package/client/use-new-agent.ts +4 -0
- package/client/use-street.ts +8 -0
- package/client/workspace-office-tools.tsx +102 -0
- package/client/workspace-overlay-route.web.ts +47 -0
- package/client/workspace-overlay.tsx +195 -0
- package/client/world/adapter.ts +37 -2
- package/client/world/escape.ts +58 -0
- package/client/world/use-world-feed.ts +6 -2
- package/client/world/workspace-dock.ts +6 -0
- package/client/world/world-api.ts +45 -4
- package/client/world/world-bridge-page.ts +14 -3
- package/client/world/world-bridge.ts +50 -5
- package/client/world/world-frame.web.ts +8 -0
- package/client/world/world-view-native.tsx +31 -10
- package/client/world/world-view-shared.ts +36 -7
- package/client/world/world-view.tsx +93 -21
- package/docs/office.md +165 -64
- package/index.client.tsx +13 -6
- package/index.server.ts +232 -16
- package/package.json +2 -1
- package/server/activity.ts +42 -19
- package/server/agent-tools.ts +11 -5
- package/server/board-service.ts +381 -10
- package/server/brand-logo.ts +34 -0
- package/server/chat-group.ts +83 -0
- package/server/chat-service.ts +406 -62
- package/server/chat-store.ts +1 -4
- package/server/directory.ts +22 -7
- package/server/duty-service.ts +230 -0
- package/server/group-photo.ts +39 -0
- package/server/home-departure.ts +47 -0
- package/server/hub.ts +43 -1
- package/server/incidents-jira.ts +19 -7
- package/server/incidents-schedule.ts +10 -10
- package/server/incidents-sentry.ts +34 -8
- package/server/live-ports.ts +114 -18
- package/server/lobby-pickup.ts +170 -0
- package/server/machine/details.ts +91 -0
- package/server/mention-queue.ts +14 -0
- package/server/office.ts +110 -6
- package/server/paths.ts +14 -0
- package/server/ssh/LICENSE.paseo +211 -0
- package/server/ssh/client.ts +401 -0
- package/server/ssh/discovery.ts +230 -0
- package/server/ssh/installed.ts +104 -0
- package/server/ssh/monitor.ts +104 -0
- package/server/ssh/pid-files.ts +194 -0
- package/server/ssh/read.ts +136 -0
- package/server/subagent-names.ts +4 -0
- package/server/tracker-credentials.ts +141 -0
- package/server/words.generated.ts +1 -1
- package/server/world.generated.ts +1 -1
- package/shared/appearance.ts +43 -0
- package/shared/branding.ts +53 -0
- package/shared/chat-words.ts +2 -2
- package/shared/contracts.ts +199 -5
- package/shared/duties.ts +100 -0
- package/shared/host-details.ts +25 -0
- package/shared/lobby-assignment.ts +34 -0
- package/shared/model.ts +9 -1
- package/shared/names.ts +2 -0
- package/shared/settings.ts +14 -3
- package/shared/ssh.ts +34 -0
- package/shared/upstream/README.md +1 -3
- package/shared/upstream/chat-engine.d.ts +4 -0
- package/shared/upstream/prompt-coach.d.ts +6 -0
- package/shared/upstream/prompt-coach.js +178 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { Appearance } from "../shared/appearance.js";
|
|
2
|
+
import { AppearanceFields } from "./agent-appearance.js";
|
|
3
|
+
import { useCallback, useMemo, useState, type ReactNode } from "react";
|
|
4
|
+
import { Pressable, Text, View } from "react-native";
|
|
5
|
+
import { Icon, ScrollView, TextInput } from "@getpaseo/plugin/client/ui";
|
|
4
6
|
import { Pill } from "./activity-panel.js";
|
|
5
7
|
import { ActionButton } from "./action-button.js";
|
|
6
8
|
import { Row as ChoiceRow } from "./agent-picker.js";
|
|
@@ -121,26 +123,109 @@ interface ReadyBodyProps {
|
|
|
121
123
|
styles: OfficeStyles;
|
|
122
124
|
}
|
|
123
125
|
|
|
126
|
+
function OptionGroup({
|
|
127
|
+
label,
|
|
128
|
+
value,
|
|
129
|
+
compact,
|
|
130
|
+
open,
|
|
131
|
+
toggle,
|
|
132
|
+
styles,
|
|
133
|
+
children,
|
|
134
|
+
}: {
|
|
135
|
+
label: string;
|
|
136
|
+
value?: string;
|
|
137
|
+
compact: boolean;
|
|
138
|
+
open: boolean;
|
|
139
|
+
toggle(): void;
|
|
140
|
+
styles: OfficeStyles;
|
|
141
|
+
children: ReactNode;
|
|
142
|
+
}) {
|
|
143
|
+
return (
|
|
144
|
+
<View style={styles.sheetField}>
|
|
145
|
+
<Text style={styles.sheetLabel}>{label}</Text>
|
|
146
|
+
{compact && (
|
|
147
|
+
<Pressable
|
|
148
|
+
accessibilityRole="button"
|
|
149
|
+
aria-expanded={open}
|
|
150
|
+
accessibilityLabel={`Choose ${label.toLowerCase()}`}
|
|
151
|
+
onPress={toggle}
|
|
152
|
+
style={styles.newAgentSelector}
|
|
153
|
+
>
|
|
154
|
+
<Text numberOfLines={1} style={styles.sidebarButtonText}>
|
|
155
|
+
{value ?? `Select ${label.toLowerCase()}`}
|
|
156
|
+
</Text>
|
|
157
|
+
<Icon name={open ? "ChevronUp" : "ChevronDown"} size={16} color={styles.iconColor} />
|
|
158
|
+
</Pressable>
|
|
159
|
+
)}
|
|
160
|
+
{(!compact || open) && (
|
|
161
|
+
<View role="group" aria-label={label} style={styles.panelChips}>
|
|
162
|
+
{children}
|
|
163
|
+
</View>
|
|
164
|
+
)}
|
|
165
|
+
</View>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
|
|
124
169
|
function ReadyBody({ agent, choice, change, onCreated, styles }: ReadyBodyProps) {
|
|
125
170
|
const { create, chooseProvider } = agent;
|
|
171
|
+
const customize = useCallback((appearance: Appearance) => change({ appearance }), [change]);
|
|
126
172
|
const chooseWorkspace = useCallback((workspaceId: string) => change({ workspaceId }), [change]);
|
|
127
|
-
const
|
|
173
|
+
const [menu, setMenu] = useState<"provider" | "model" | null>(null);
|
|
174
|
+
const toggleProvider = useCallback(
|
|
175
|
+
() => setMenu((current) => (current === "provider" ? null : "provider")),
|
|
176
|
+
[],
|
|
177
|
+
);
|
|
178
|
+
const toggleModel = useCallback(
|
|
179
|
+
() => setMenu((current) => (current === "model" ? null : "model")),
|
|
180
|
+
[],
|
|
181
|
+
);
|
|
182
|
+
const selectProvider = useCallback(
|
|
183
|
+
(provider: string) => {
|
|
184
|
+
chooseProvider(provider);
|
|
185
|
+
setMenu(null);
|
|
186
|
+
},
|
|
187
|
+
[chooseProvider],
|
|
188
|
+
);
|
|
189
|
+
const chooseModel = useCallback(
|
|
190
|
+
(model: string) => {
|
|
191
|
+
change({ model });
|
|
192
|
+
setMenu(null);
|
|
193
|
+
},
|
|
194
|
+
[change],
|
|
195
|
+
);
|
|
128
196
|
const setPrompt = useCallback((prompt: string) => change({ prompt }), [change]);
|
|
129
197
|
const submit = useCallback(async () => onCreated(await create()), [create, onCreated]);
|
|
130
198
|
const problem = newAgentProblem(choice, agent.starting);
|
|
131
199
|
const waiting = agent.starting.some((entry) => entry.id === choice.provider);
|
|
132
|
-
const
|
|
200
|
+
const provider = agent.providers.find((entry) => entry.id === choice.provider);
|
|
201
|
+
const models = provider?.models ?? [];
|
|
133
202
|
return (
|
|
134
203
|
<>
|
|
135
|
-
<
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
204
|
+
<ScrollView
|
|
205
|
+
style={styles.columnBody}
|
|
206
|
+
contentContainerStyle={styles.newAgentForm}
|
|
207
|
+
nestedScrollEnabled
|
|
208
|
+
>
|
|
209
|
+
<AppearanceFields
|
|
210
|
+
draft={choice.appearance}
|
|
211
|
+
change={customize}
|
|
212
|
+
collapsible
|
|
213
|
+
styles={styles}
|
|
214
|
+
/>
|
|
215
|
+
<Workspaces
|
|
216
|
+
workspaces={agent.workspaces}
|
|
217
|
+
value={choice.workspaceId}
|
|
218
|
+
onChoose={chooseWorkspace}
|
|
219
|
+
styles={styles}
|
|
220
|
+
/>
|
|
221
|
+
<OptionGroup
|
|
222
|
+
label="Provider"
|
|
223
|
+
value={provider?.label ?? choice.provider ?? undefined}
|
|
224
|
+
compact={agent.providers.length + agent.starting.length > 3}
|
|
225
|
+
open={menu === "provider"}
|
|
226
|
+
toggle={toggleProvider}
|
|
227
|
+
styles={styles}
|
|
228
|
+
>
|
|
144
229
|
{agent.providers.map((entry) => (
|
|
145
230
|
<Pill<string>
|
|
146
231
|
key={entry.id}
|
|
@@ -149,7 +234,7 @@ function ReadyBody({ agent, choice, change, onCreated, styles }: ReadyBodyProps)
|
|
|
149
234
|
disabled={entry.models.length === 0}
|
|
150
235
|
on={entry.id === choice.provider}
|
|
151
236
|
toggle={false}
|
|
152
|
-
onPress={
|
|
237
|
+
onPress={selectProvider}
|
|
153
238
|
styles={styles}
|
|
154
239
|
/>
|
|
155
240
|
))}
|
|
@@ -161,15 +246,19 @@ function ReadyBody({ agent, choice, change, onCreated, styles }: ReadyBodyProps)
|
|
|
161
246
|
disabled
|
|
162
247
|
on={entry.id === choice.provider}
|
|
163
248
|
toggle={false}
|
|
164
|
-
onPress={
|
|
249
|
+
onPress={selectProvider}
|
|
165
250
|
styles={styles}
|
|
166
251
|
/>
|
|
167
252
|
))}
|
|
168
|
-
</
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
253
|
+
</OptionGroup>
|
|
254
|
+
<OptionGroup
|
|
255
|
+
label="Model"
|
|
256
|
+
value={models.find((entry) => entry.id === choice.model)?.label}
|
|
257
|
+
compact={models.length > 3}
|
|
258
|
+
open={menu === "model"}
|
|
259
|
+
toggle={toggleModel}
|
|
260
|
+
styles={styles}
|
|
261
|
+
>
|
|
173
262
|
{models.map((entry) => (
|
|
174
263
|
<Pill<string>
|
|
175
264
|
key={entry.id}
|
|
@@ -181,38 +270,40 @@ function ReadyBody({ agent, choice, change, onCreated, styles }: ReadyBodyProps)
|
|
|
181
270
|
styles={styles}
|
|
182
271
|
/>
|
|
183
272
|
))}
|
|
273
|
+
</OptionGroup>
|
|
274
|
+
<View style={styles.sheetField}>
|
|
275
|
+
<Text style={styles.sheetLabel}>First prompt</Text>
|
|
276
|
+
<TextInput
|
|
277
|
+
accessibilityLabel="First prompt"
|
|
278
|
+
placeholder="What should the agent do?"
|
|
279
|
+
placeholderTextColor={styles.placeholderColor}
|
|
280
|
+
value={choice.prompt}
|
|
281
|
+
onChangeText={setPrompt}
|
|
282
|
+
multiline
|
|
283
|
+
style={styles.input}
|
|
284
|
+
/>
|
|
184
285
|
</View>
|
|
185
|
-
</
|
|
186
|
-
<View style={styles.
|
|
187
|
-
<Text style={styles.
|
|
188
|
-
<
|
|
189
|
-
accessibilityLabel="First prompt"
|
|
190
|
-
placeholder="What should the agent do?"
|
|
191
|
-
placeholderTextColor={styles.placeholderColor}
|
|
192
|
-
value={choice.prompt}
|
|
193
|
-
onChangeText={setPrompt}
|
|
194
|
-
multiline
|
|
195
|
-
style={styles.input}
|
|
196
|
-
/>
|
|
197
|
-
</View>
|
|
198
|
-
{problem === null ? null : <Text style={styles.muted}>{problem}</Text>}
|
|
199
|
-
<View style={styles.actions}>
|
|
200
|
-
<ActionButton
|
|
201
|
-
label="Create"
|
|
202
|
-
pendingLabel="Creating..."
|
|
203
|
-
onPress={submit}
|
|
204
|
-
disabled={problem !== null}
|
|
205
|
-
primary
|
|
206
|
-
styles={styles}
|
|
207
|
-
/>
|
|
208
|
-
{waiting ? (
|
|
286
|
+
</ScrollView>
|
|
287
|
+
<View style={styles.newAgentFooter}>
|
|
288
|
+
{problem === null ? null : <Text style={styles.muted}>{problem}</Text>}
|
|
289
|
+
<View style={styles.actions}>
|
|
209
290
|
<ActionButton
|
|
210
|
-
label="
|
|
211
|
-
pendingLabel="
|
|
212
|
-
onPress={
|
|
291
|
+
label="Create"
|
|
292
|
+
pendingLabel="Creating..."
|
|
293
|
+
onPress={submit}
|
|
294
|
+
disabled={problem !== null}
|
|
295
|
+
primary
|
|
213
296
|
styles={styles}
|
|
214
297
|
/>
|
|
215
|
-
|
|
298
|
+
{waiting ? (
|
|
299
|
+
<ActionButton
|
|
300
|
+
label="Try again"
|
|
301
|
+
pendingLabel="Trying..."
|
|
302
|
+
onPress={agent.retry}
|
|
303
|
+
styles={styles}
|
|
304
|
+
/>
|
|
305
|
+
) : null}
|
|
306
|
+
</View>
|
|
216
307
|
</View>
|
|
217
308
|
</>
|
|
218
309
|
);
|
|
@@ -244,18 +335,19 @@ export function NewAgentForm({ choice, change, onBack, onCreated, styles }: NewA
|
|
|
244
335
|
const agent = useNewAgent({ choice, change });
|
|
245
336
|
return (
|
|
246
337
|
<View style={styles.screen}>
|
|
247
|
-
<
|
|
248
|
-
<
|
|
249
|
-
|
|
250
|
-
</
|
|
251
|
-
<
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
338
|
+
<View style={styles.newAgentHeader}>
|
|
339
|
+
<Text accessibilityRole="header" style={styles.panelHeading}>
|
|
340
|
+
New agent
|
|
341
|
+
</Text>
|
|
342
|
+
<ActionButton label="Back" pendingLabel="Back" onPress={onBack} styles={styles} />
|
|
343
|
+
</View>
|
|
344
|
+
<FormBody
|
|
345
|
+
agent={agent}
|
|
346
|
+
choice={choice}
|
|
347
|
+
change={change}
|
|
348
|
+
onCreated={onCreated}
|
|
349
|
+
styles={styles}
|
|
350
|
+
/>
|
|
259
351
|
</View>
|
|
260
352
|
);
|
|
261
353
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Appearance } from "../shared/appearance.js";
|
|
1
2
|
import type { AgentModelDefinition, ProviderSnapshotEntry } from "@getpaseo/protocol/agent-types";
|
|
2
3
|
import type { PluginPaseoApi } from "@getpaseo/plugin/client";
|
|
3
4
|
|
|
@@ -5,6 +6,7 @@ import type { PluginPaseoApi } from "@getpaseo/plugin/client";
|
|
|
5
6
|
type PaseoWorkspace = Awaited<ReturnType<PluginPaseoApi["workspaces"]["list"]>>["entries"][number];
|
|
6
7
|
|
|
7
8
|
export interface NewAgentChoice {
|
|
9
|
+
appearance?: Appearance;
|
|
8
10
|
workspaceId: string | null;
|
|
9
11
|
provider: string | null;
|
|
10
12
|
model: string | null;
|
package/client/notes-card.tsx
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import { useCallback, useEffect, useMemo,
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
View,
|
|
6
|
-
type LayoutChangeEvent,
|
|
7
|
-
type ScrollView as NativeScrollView,
|
|
8
|
-
} from "react-native";
|
|
9
|
-
import { Markdown, Modal, ScrollView } from "@getpaseo/plugin/client/ui";
|
|
1
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
2
|
+
import { Pressable, Text, View, type ViewStyle } from "react-native";
|
|
3
|
+
import { Icon, Markdown, ScrollView } from "@getpaseo/plugin/client/ui";
|
|
4
|
+
import { OfficeModal as Modal } from "./office-modal.js";
|
|
10
5
|
import type { z } from "zod";
|
|
11
6
|
import type { NotesState, notesReadRpc } from "../shared/contracts.js";
|
|
12
7
|
import { ActionButton, failureText } from "./action-button.js";
|
|
@@ -74,25 +69,39 @@ function MonthBar({ month, onAsk, styles }: MonthBarProps) {
|
|
|
74
69
|
if (next !== null) onAsk(next);
|
|
75
70
|
}, [next, onAsk]);
|
|
76
71
|
return (
|
|
77
|
-
<View style={styles.
|
|
78
|
-
<Text accessibilityRole="header" style={styles.
|
|
72
|
+
<View style={styles.notesMonthBar}>
|
|
73
|
+
<Text accessibilityRole="header" style={styles.panelHeading}>
|
|
79
74
|
{monthTitle(month.month)}
|
|
80
75
|
</Text>
|
|
81
76
|
<View style={styles.actions}>
|
|
82
|
-
<
|
|
83
|
-
|
|
84
|
-
|
|
77
|
+
<Pressable
|
|
78
|
+
accessibilityRole="button"
|
|
79
|
+
accessibilityLabel="Previous month"
|
|
80
|
+
disabled={!previous}
|
|
81
|
+
aria-disabled={!previous}
|
|
85
82
|
onPress={showPrevious}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
83
|
+
style={styles.sidebarButton}
|
|
84
|
+
>
|
|
85
|
+
<Icon
|
|
86
|
+
name="ChevronLeft"
|
|
87
|
+
size={18}
|
|
88
|
+
color={previous ? styles.iconColor : styles.placeholderColor}
|
|
89
|
+
/>
|
|
90
|
+
</Pressable>
|
|
91
|
+
<Pressable
|
|
92
|
+
accessibilityRole="button"
|
|
93
|
+
accessibilityLabel="Next month"
|
|
94
|
+
disabled={!next}
|
|
95
|
+
aria-disabled={!next}
|
|
92
96
|
onPress={showNext}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
97
|
+
style={styles.sidebarButton}
|
|
98
|
+
>
|
|
99
|
+
<Icon
|
|
100
|
+
name="ChevronRight"
|
|
101
|
+
size={18}
|
|
102
|
+
color={next ? styles.iconColor : styles.placeholderColor}
|
|
103
|
+
/>
|
|
104
|
+
</Pressable>
|
|
96
105
|
</View>
|
|
97
106
|
</View>
|
|
98
107
|
);
|
|
@@ -132,75 +141,94 @@ function Piece({ piece, onJump, styles }: PieceProps) {
|
|
|
132
141
|
);
|
|
133
142
|
}
|
|
134
143
|
|
|
135
|
-
|
|
136
|
-
section
|
|
137
|
-
index: number;
|
|
138
|
-
onPlaced(index: number, y: number): void;
|
|
139
|
-
onJump(anchor: string): void;
|
|
140
|
-
styles: OfficeStyles;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/** An entry, or the text before the first: Markdown, and its links to other entries. */
|
|
144
|
-
function Section({ section, index, onPlaced, onJump, styles }: SectionProps) {
|
|
145
|
-
const placed = useCallback(
|
|
146
|
-
(event: LayoutChangeEvent) => onPlaced(index, event.nativeEvent.layout.y),
|
|
147
|
-
[index, onPlaced],
|
|
148
|
-
);
|
|
144
|
+
function sectionTitle(section: NotesSection) {
|
|
145
|
+
const first = section.pieces[0];
|
|
149
146
|
return (
|
|
150
|
-
|
|
151
|
-
{section.pieces.map((piece, at) => (
|
|
152
|
-
// A section's pieces are its text in order and never move, so their place is their key.
|
|
153
|
-
// oxlint-disable-next-line react/no-array-index-key
|
|
154
|
-
<Piece key={at} piece={piece} onJump={onJump} styles={styles} />
|
|
155
|
-
))}
|
|
156
|
-
</View>
|
|
147
|
+
(first?.kind === "markdown" && first.text.match(/^## ([^\n]+)/)?.[1]?.trim()) || "Overview"
|
|
157
148
|
);
|
|
158
149
|
}
|
|
159
150
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
151
|
+
function EntryTab({
|
|
152
|
+
section,
|
|
153
|
+
selected,
|
|
154
|
+
onSelect,
|
|
155
|
+
styles,
|
|
156
|
+
}: {
|
|
157
|
+
section: NotesSection;
|
|
158
|
+
selected: boolean;
|
|
159
|
+
onSelect(section: NotesSection): void;
|
|
164
160
|
styles: OfficeStyles;
|
|
161
|
+
}) {
|
|
162
|
+
const title = sectionTitle(section);
|
|
163
|
+
const select = useCallback(() => onSelect(section), [section, onSelect]);
|
|
164
|
+
const state = useMemo(() => ({ selected }), [selected]);
|
|
165
|
+
return (
|
|
166
|
+
<Pressable
|
|
167
|
+
accessibilityRole="tab"
|
|
168
|
+
accessibilityLabel={title}
|
|
169
|
+
accessibilityState={state}
|
|
170
|
+
aria-selected={selected}
|
|
171
|
+
onPress={select}
|
|
172
|
+
style={selected ? styles.sidebarButtonActive : styles.workspaceAction}
|
|
173
|
+
>
|
|
174
|
+
<Text style={styles.sidebarButtonText}>
|
|
175
|
+
{title.replace(/^(\d{1,2}) ([A-Za-z]{3})[a-z]* \d{4}$/, "$1 $2")}
|
|
176
|
+
</Text>
|
|
177
|
+
</Pressable>
|
|
178
|
+
);
|
|
165
179
|
}
|
|
166
180
|
|
|
167
|
-
|
|
168
|
-
function NotesText({
|
|
181
|
+
const strip: ViewStyle = { flexGrow: 0, flexShrink: 0 };
|
|
182
|
+
function NotesText({ text, styles }: { text: string; styles: OfficeStyles }) {
|
|
169
183
|
const sections = useMemo(() => splitSections(text), [text]);
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
scrolledFor.current = load;
|
|
181
|
-
scroller.current?.scrollTo({ y, animated: false });
|
|
182
|
-
},
|
|
183
|
-
[sections, load],
|
|
184
|
+
// Undefined follows the newest entry when the writer finishes. A chosen entry stays selected.
|
|
185
|
+
const [choice, setChoice] = useState<number>();
|
|
186
|
+
const current = sections[choice ?? sections.length - 1] ?? sections[sections.length - 1];
|
|
187
|
+
const select = useCallback(
|
|
188
|
+
(section: NotesSection) => setChoice(sections.indexOf(section)),
|
|
189
|
+
[sections],
|
|
190
|
+
);
|
|
191
|
+
const jump = useCallback(
|
|
192
|
+
(anchor: string) => setChoice(sections.findIndex((section) => section.anchor === anchor)),
|
|
193
|
+
[sections],
|
|
184
194
|
);
|
|
185
|
-
|
|
186
|
-
const y = tops.current.get(anchor);
|
|
187
|
-
if (y !== undefined) scroller.current?.scrollTo({ y, animated: true });
|
|
188
|
-
}, []);
|
|
195
|
+
if (!current) return null;
|
|
189
196
|
return (
|
|
190
|
-
|
|
191
|
-
{sections.
|
|
192
|
-
<
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
197
|
+
<>
|
|
198
|
+
{sections.length > 1 && (
|
|
199
|
+
<ScrollView
|
|
200
|
+
horizontal
|
|
201
|
+
style={strip}
|
|
202
|
+
contentContainerStyle={styles.notesDateStrip}
|
|
203
|
+
accessibilityLabel="Note entries"
|
|
204
|
+
accessibilityRole="tablist"
|
|
205
|
+
showsHorizontalScrollIndicator
|
|
206
|
+
>
|
|
207
|
+
{Array.from({ length: sections.length }, (_, offset) => {
|
|
208
|
+
const index = sections.length - 1 - offset;
|
|
209
|
+
const section = sections[index]!;
|
|
210
|
+
return (
|
|
211
|
+
<EntryTab
|
|
212
|
+
key={`${index}-${section.anchor ?? "intro"}`}
|
|
213
|
+
section={section}
|
|
214
|
+
selected={section === current}
|
|
215
|
+
onSelect={select}
|
|
216
|
+
styles={styles}
|
|
217
|
+
/>
|
|
218
|
+
);
|
|
219
|
+
})}
|
|
220
|
+
</ScrollView>
|
|
221
|
+
)}
|
|
222
|
+
<ScrollView key={current.anchor ?? "preamble"} style={styles.notesScroll}>
|
|
223
|
+
<View style={styles.notesPaper}>
|
|
224
|
+
{current.pieces.map((piece, index) => (
|
|
225
|
+
// A section's Markdown and link runs keep their order.
|
|
226
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
227
|
+
<Piece key={index} piece={piece} onJump={jump} styles={styles} />
|
|
228
|
+
))}
|
|
229
|
+
</View>
|
|
230
|
+
</ScrollView>
|
|
231
|
+
</>
|
|
204
232
|
);
|
|
205
233
|
}
|
|
206
234
|
|
|
@@ -229,7 +257,7 @@ function NotesBody({ shown, styles }: NotesBodyProps) {
|
|
|
229
257
|
if (month.text === null) {
|
|
230
258
|
return <Text style={styles.muted}>No notes for {monthTitle(month.month)}.</Text>;
|
|
231
259
|
}
|
|
232
|
-
return <NotesText key={month.month}
|
|
260
|
+
return <NotesText key={month.month} text={month.text} styles={styles} />;
|
|
233
261
|
}
|
|
234
262
|
|
|
235
263
|
export interface NotesCardProps {
|
package/client/notes-days.tsx
CHANGED
|
@@ -8,7 +8,7 @@ export const NOTES_DAYS_LABEL = "Stand-up days";
|
|
|
8
8
|
const HINT = "The days of the 8:00 run.";
|
|
9
9
|
const NO_DAY_HINT = "No day chosen: nothing runs at 8:00. The bell still starts the notes.";
|
|
10
10
|
/** By weekday number, 0 for Sunday: each button's name; its pill shows the first three letters. */
|
|
11
|
-
const DAY_NAMES = [
|
|
11
|
+
export const DAY_NAMES = [
|
|
12
12
|
"Sunday",
|
|
13
13
|
"Monday",
|
|
14
14
|
"Tuesday",
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useRpc } from "@getpaseo/plugin/client";
|
|
2
|
+
import { worldLogoRpc } from "../shared/contracts.js";
|
|
3
|
+
import { createContext, useContext, useEffect, useMemo, useState } from "react";
|
|
4
|
+
import type { Branding } from "../shared/branding.js";
|
|
5
|
+
import { readBrand } from "./web-env.web.js";
|
|
6
|
+
|
|
7
|
+
export const OfficeBrandContext = createContext<Branding | undefined>(undefined);
|
|
8
|
+
|
|
9
|
+
export function useOfficeBrand() {
|
|
10
|
+
const brand = useContext(OfficeBrandContext);
|
|
11
|
+
const name = brand?.name;
|
|
12
|
+
const logoUrl = brand?.logoUrl;
|
|
13
|
+
const color = brand?.color;
|
|
14
|
+
return useMemo(() => {
|
|
15
|
+
const page = readBrand();
|
|
16
|
+
return { name: name ?? page?.name ?? null, logoUrl: logoUrl ?? page?.logoUrl ?? null, color };
|
|
17
|
+
}, [name, logoUrl, color]);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** The web and native scene both receive the same origin-clean logo texture. */
|
|
21
|
+
export function useSceneBrand() {
|
|
22
|
+
const brand = useOfficeBrand();
|
|
23
|
+
const configured = useContext(OfficeBrandContext)?.logoUrl;
|
|
24
|
+
const fetchLogo = useRpc(worldLogoRpc);
|
|
25
|
+
const [logo, setLogo] = useState<{ url: string; data: string | null } | null>(null);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (!configured) return;
|
|
28
|
+
let mounted = true;
|
|
29
|
+
const finish = (data: string | null) => {
|
|
30
|
+
if (mounted) setLogo({ url: configured, data });
|
|
31
|
+
};
|
|
32
|
+
void fetchLogo({}).then(
|
|
33
|
+
(reply) => finish(reply?.url === configured ? reply.data : null),
|
|
34
|
+
() => finish(null),
|
|
35
|
+
);
|
|
36
|
+
return () => {
|
|
37
|
+
mounted = false;
|
|
38
|
+
};
|
|
39
|
+
}, [configured, fetchLogo]);
|
|
40
|
+
return useMemo(() => {
|
|
41
|
+
if (!configured) return brand;
|
|
42
|
+
return logo?.url === configured ? { ...brand, logoUrl: logo.data } : null;
|
|
43
|
+
}, [brand, configured, logo]);
|
|
44
|
+
}
|
package/client/office-column.tsx
CHANGED
|
@@ -222,7 +222,8 @@ export function ColumnTabs({
|
|
|
222
222
|
style={vertical ? styles.columnTabsVertical : styles.columnTabs}
|
|
223
223
|
>
|
|
224
224
|
{COLUMN_TABS.map((each) => {
|
|
225
|
-
|
|
225
|
+
// In the desktop fullscreen layout Sessions has its own rail and Team chat its own toolbar button.
|
|
226
|
+
if (hideSessions && (each.tab === "sessions" || each.tab === "chat")) return null;
|
|
226
227
|
let count: string | null = null;
|
|
227
228
|
let countNote = "new";
|
|
228
229
|
if (each.tab === "attention") count = badges.attention;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useRef, useState, type RefObject } from "react";
|
|
2
|
+
import { Keyboard, type KeyboardEvent, type View } from "react-native";
|
|
3
|
+
|
|
4
|
+
/** Reserve only the part of the Office surface that the host still draws behind the keyboard. */
|
|
5
|
+
export function useChatKeyboard(
|
|
6
|
+
root: RefObject<View | null>,
|
|
7
|
+
platform: "web" | "ios" | "android",
|
|
8
|
+
active: boolean,
|
|
9
|
+
) {
|
|
10
|
+
const [inset, setInset] = useState(0);
|
|
11
|
+
const [visible, setVisible] = useState(false);
|
|
12
|
+
const onLayout = useRef<() => void>(() => {});
|
|
13
|
+
const measureKeyboard = useCallback(() => onLayout.current(), []);
|
|
14
|
+
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
setInset(0);
|
|
17
|
+
setVisible(false);
|
|
18
|
+
if (!active) return;
|
|
19
|
+
if (platform === "web") {
|
|
20
|
+
const viewport = window.visualViewport;
|
|
21
|
+
if (!viewport) return;
|
|
22
|
+
const measure = () => {
|
|
23
|
+
const box = (root.current as unknown as HTMLElement | null)?.getBoundingClientRect();
|
|
24
|
+
setVisible(viewport.height + viewport.offsetTop < window.innerHeight - 80);
|
|
25
|
+
if (box) setInset(Math.max(0, box.bottom - viewport.offsetTop - viewport.height));
|
|
26
|
+
};
|
|
27
|
+
onLayout.current = measure;
|
|
28
|
+
viewport.addEventListener("resize", measure);
|
|
29
|
+
viewport.addEventListener("scroll", measure);
|
|
30
|
+
measure();
|
|
31
|
+
return () => {
|
|
32
|
+
onLayout.current = () => {};
|
|
33
|
+
viewport.removeEventListener("resize", measure);
|
|
34
|
+
viewport.removeEventListener("scroll", measure);
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
let top = Keyboard.metrics()?.screenY;
|
|
39
|
+
let revision = 0;
|
|
40
|
+
const measure = () => {
|
|
41
|
+
const current = ++revision;
|
|
42
|
+
const keyboardTop = top;
|
|
43
|
+
setVisible(keyboardTop !== undefined);
|
|
44
|
+
if (keyboardTop === undefined) {
|
|
45
|
+
setInset(0);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
root.current?.measureInWindow((_x, y, _width, height) => {
|
|
49
|
+
if (current === revision) setInset(Math.max(0, y + height - keyboardTop));
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
const shown = (event: KeyboardEvent) => {
|
|
53
|
+
top = event.endCoordinates.screenY;
|
|
54
|
+
measure();
|
|
55
|
+
};
|
|
56
|
+
const hidden = () => {
|
|
57
|
+
top = undefined;
|
|
58
|
+
measure();
|
|
59
|
+
};
|
|
60
|
+
const show = Keyboard.addListener(
|
|
61
|
+
platform === "ios" ? "keyboardWillChangeFrame" : "keyboardDidShow",
|
|
62
|
+
shown,
|
|
63
|
+
);
|
|
64
|
+
const hide = Keyboard.addListener(
|
|
65
|
+
platform === "ios" ? "keyboardWillHide" : "keyboardDidHide",
|
|
66
|
+
hidden,
|
|
67
|
+
);
|
|
68
|
+
onLayout.current = measure;
|
|
69
|
+
measure();
|
|
70
|
+
return () => {
|
|
71
|
+
revision++;
|
|
72
|
+
onLayout.current = () => {};
|
|
73
|
+
show.remove();
|
|
74
|
+
hide.remove();
|
|
75
|
+
};
|
|
76
|
+
}, [active, platform, root]);
|
|
77
|
+
const spaceStyle = useMemo(() => ({ height: active ? inset : 0 }), [active, inset]);
|
|
78
|
+
return { spaceStyle, measureKeyboard, visible: active && visible };
|
|
79
|
+
}
|