@startsimpli/integrations 0.2.201 → 0.2.203
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/package.json +6 -6
- package/src/__tests__/briefing-markdown.test.ts +64 -0
- package/src/__tests__/converse-cards.test.ts +53 -0
- package/src/__tests__/converse-page.test.tsx +148 -37
- package/src/__tests__/converse-roci.test.ts +22 -0
- package/src/__tests__/converse-structure.test.ts +27 -0
- package/src/__tests__/converse-view.test.ts +46 -0
- package/src/__tests__/corpus-tracker.test.tsx +32 -176
- package/src/__tests__/data-table-logic.test.ts +75 -0
- package/src/__tests__/data-table.test.tsx +133 -0
- package/src/__tests__/home-brief.test.tsx +25 -40
- package/src/__tests__/library-call-shape.test.tsx +164 -0
- package/src/__tests__/load-error.test.tsx +1 -1
- package/src/__tests__/mini-markdown.test.tsx +24 -0
- package/src/__tests__/overview-page.test.tsx +36 -6
- package/src/__tests__/plan-shell.test.tsx +6 -4
- package/src/__tests__/timeline-events.test.ts +65 -0
- package/src/__tests__/timeline-table.test.tsx +66 -0
- package/src/__tests__/todo-table-model.test.ts +75 -0
- package/src/__tests__/todo-table.test.tsx +202 -0
- package/src/__tests__/tracker-timeline-component.test.tsx +4 -4
- package/src/__tests__/tracker-timeline-reader.test.ts +1 -1
- package/src/comms/__tests__/app-sends-page.test.tsx +69 -0
- package/src/comms/api/comms.ts +23 -0
- package/src/comms/components/ResultsPanel.tsx +2 -2
- package/src/comms/components/SendLog.tsx +20 -8
- package/src/comms/components/index.ts +1 -0
- package/src/comms/components/pages/AppSendsPage.tsx +58 -0
- package/src/comms/hooks/index.ts +8 -3
- package/src/components/FolderTree.tsx +12 -3
- package/src/components/index.ts +2 -1
- package/src/components/pages/ConversePage.tsx +114 -105
- package/src/components/pages/LibraryPage.tsx +63 -24
- package/src/components/pages/TrackerPage.tsx +170 -474
- package/src/components/pages/converse/CardView.tsx +72 -0
- package/src/components/pages/converse/SettingsMenu.tsx +37 -0
- package/src/components/pages/converse/Thread.tsx +48 -33
- package/src/components/pages/converse/useNeedsYou.ts +60 -0
- package/src/components/pages/home/BriefCard.tsx +16 -7
- package/src/components/pages/home/HomeBriefPage.tsx +6 -91
- package/src/components/pages/home/MiniMarkdown.tsx +51 -0
- package/src/components/pages/home/{DueSoonLine.tsx → dueSoonText.ts} +2 -11
- package/src/components/pages/home/index.ts +1 -1
- package/src/components/pages/overview/OverviewPage.tsx +46 -83
- package/src/components/pages/plan/TalkPage.tsx +5 -14
- package/src/components/pages/plan/TimelinePage.tsx +4 -2
- package/src/components/pages/tracker/SweepPanel.tsx +108 -0
- package/src/components/pages/tracker/TimelineTable.tsx +70 -0
- package/src/components/pages/tracker/TrackerTimeline.tsx +32 -15
- package/src/components/table/DataTable.tsx +92 -0
- package/src/components/table/RowMenu.tsx +35 -0
- package/src/components/table/TablePagination.tsx +63 -0
- package/src/components/table/TableToolbar.tsx +56 -0
- package/src/components/table/TodoTable.tsx +142 -0
- package/src/components/table/index.ts +10 -0
- package/src/components/table/table-logic.ts +60 -0
- package/src/components/table/todo-model.ts +93 -0
- package/src/corpus/briefing/generate-weekly.ts +4 -0
- package/src/corpus/briefing/generate.ts +4 -0
- package/src/corpus/briefing/index.ts +1 -0
- package/src/corpus/briefing/markdown.ts +71 -0
- package/src/corpus/client.ts +38 -146
- package/src/corpus/converse/cards.ts +69 -0
- package/src/corpus/converse/index.ts +6 -0
- package/src/corpus/converse/roci.ts +13 -0
- package/src/corpus/converse/structure.ts +39 -0
- package/src/corpus/converse/view.ts +34 -0
- package/src/corpus/index.ts +2 -0
- package/src/corpus/participants.ts +220 -0
- package/src/corpus/timeline-events.ts +83 -0
- package/src/corpus/tracker-sort.ts +9 -3
- package/src/corpus/tracker-timeline-client.ts +2 -0
- package/src/corpus/tracker-timeline.ts +4 -0
- package/src/corpus/types.ts +32 -5
- package/src/native/app/__tests__/plan-talk-registry.test.tsx +2 -1
- package/src/native/converse/ConverseScreen.tsx +3 -5
- package/src/native/home/HomeScreen.tsx +1 -1
- package/src/native/home/tab.tsx +1 -2
- package/src/native/plan/PlanTab.tsx +1 -2
- package/src/native/plan/__tests__/plan-tab.test.tsx +5 -5
- package/src/native/talk/TalkTab.tsx +1 -1
- package/src/native/talk/__tests__/talk-tab.test.tsx +1 -1
- package/src/__tests__/home-needs-your-call.test.tsx +0 -65
- package/src/components/pages/tracker/TrackerBoard.tsx +0 -45
- package/src/components/pages/tracker/TrackerToolbar.tsx +0 -44
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* THE
|
|
3
|
-
*
|
|
2
|
+
* THE TALK SCREEN: Roci, one thread (Quinn, design A). Everything is in time order in ONE thread: Roci's words as
|
|
3
|
+
* structured Markdown, what you said, and the things that need you as typed cards, answered inline.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* ONE mic, and it IS hands-free mode: Talk -> Mute while listening -> Interrupt while Roci thinks or speaks. The mic's colour
|
|
6
|
+
* is the state (no banner, no status text). Speed, replay and save live in ONE
|
|
7
|
+
* settings menu. No Voice/Text switch, no Drive button, no subtitle, no wake word (nothing listens for the name).
|
|
8
|
+
* The loop is `createMeetingController`, shared with the native app.
|
|
9
9
|
*/
|
|
10
10
|
import * as React from 'react';
|
|
11
11
|
|
|
@@ -15,50 +15,44 @@ import type { MeetingConfig } from '../../corpus/converse/meeting-config';
|
|
|
15
15
|
import { resolveMeetingConfig } from '../../corpus/converse/meeting-config';
|
|
16
16
|
import type { ConverseEndResult } from '../../corpus/converse/types';
|
|
17
17
|
import { createBrowserMeetingIO, type BrowserMeetingIO } from './converse/browserIO';
|
|
18
|
-
import { DEFAULT_SPEED,
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
muted: 'text-sm opacity-70', error: 'rounded-md border p-3 text-sm', input: 'rounded-md border px-3 py-2 text-base',
|
|
27
|
-
chip: 'rounded-full border px-2 py-0.5 text-xs opacity-80', replay: 'inline-flex rounded border p-1 opacity-70',
|
|
28
|
-
mic: 'inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full border', micOn: 'inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full border bg-red-600 text-white',
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const EMPTY: MeetingState = { phase: 'idle', retryable: false, lines: [], error: null, noAudio: null, conversationId: null, saved: null, relayNotice: null, micOn: false };
|
|
18
|
+
import { DEFAULT_SPEED, loadSpeed, saveSpeed } from './converse/speed';
|
|
19
|
+
import { ASSISTANT_NAME, normalizeAssistantName } from '../../corpus/converse/roci';
|
|
20
|
+
import { MIC_COLORS, converseView } from '../../corpus/converse/view';
|
|
21
|
+
import type { ThreadCard } from '../../corpus/converse/cards';
|
|
22
|
+
import type { NotifyClient } from '../../corpus/notify/client';
|
|
23
|
+
import { SettingsMenu } from './converse/SettingsMenu';
|
|
24
|
+
import { Thread, type ThreadItem } from './converse/Thread';
|
|
25
|
+
import { useNeedsYou } from './converse/useNeedsYou';
|
|
32
26
|
|
|
33
27
|
export interface ConversePageProps {
|
|
34
28
|
client: ConverseClient;
|
|
35
|
-
classNames?: ConverseClassNames;
|
|
36
29
|
/** Meeting settings; every one has a default. */
|
|
37
30
|
meeting?: Partial<MeetingConfig>;
|
|
38
31
|
/** Injectable for tests; defaults to the browser's microphone and audio element. */
|
|
39
32
|
createIO?: () => BrowserMeetingIO;
|
|
40
|
-
/** Where the saved conversation can be read; given the
|
|
33
|
+
/** Where the saved conversation can be read; given the saved result. */
|
|
41
34
|
savedLink?: (saved: ConverseEndResult) => React.ReactNode;
|
|
35
|
+
/** The needs-you queue (pending decisions): shown as question cards in the thread and answered there. */
|
|
36
|
+
notify?: NotifyClient;
|
|
37
|
+
/** Real cards the host has (the brief); their `read` action asks Roci to read it. */
|
|
38
|
+
cards?: ThreadCard[];
|
|
39
|
+
/** What the assistant is called. Typed "Rossi" and friends become this. */
|
|
40
|
+
assistantName?: string;
|
|
42
41
|
}
|
|
43
42
|
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
listening: 'Listening… tap the mic again to send.',
|
|
47
|
-
thinking: 'Thinking…',
|
|
48
|
-
speaking: 'Speaking…',
|
|
49
|
-
ending: 'Saving…',
|
|
50
|
-
ended: '',
|
|
51
|
-
stopped: 'The conversation stopped.',
|
|
52
|
-
};
|
|
43
|
+
const MIC_LABEL = { talk: 'Talk', mute: 'Mute', interrupt: 'Interrupt' } as const;
|
|
44
|
+
const SUGGESTIONS = ["What's on my plate", 'Read my brief', 'Anything for me to approve?'];
|
|
53
45
|
|
|
54
46
|
const MicIcon = () => (
|
|
55
47
|
<svg aria-hidden="true" viewBox="0 0 24 24" width="20" height="20" fill="currentColor"><path d="M12 14a3 3 0 0 0 3-3V5a3 3 0 0 0-6 0v6a3 3 0 0 0 3 3zm5-3a5 5 0 0 1-10 0H5a7 7 0 0 0 6 6.92V21h2v-3.08A7 7 0 0 0 19 11h-2z" /></svg>
|
|
56
48
|
);
|
|
49
|
+
const StopIcon = () => <span aria-hidden="true" className="inline-block h-3.5 w-3.5 rounded-sm bg-current" />;
|
|
50
|
+
|
|
51
|
+
const EMPTY: MeetingState = { phase: 'idle', retryable: false, lines: [], error: null, noAudio: null, conversationId: null, saved: null, relayNotice: null, micOn: false, micLive: false };
|
|
57
52
|
|
|
58
|
-
export function ConversePage({ client,
|
|
59
|
-
const cx = (slot: ConverseSlot) => classNames?.[slot] ?? FALLBACK[slot];
|
|
53
|
+
export function ConversePage({ client, meeting, createIO, savedLink, notify, cards: hostCards, assistantName = ASSISTANT_NAME }: ConversePageProps) {
|
|
60
54
|
const [state, setState] = React.useState<MeetingState>(EMPTY);
|
|
61
|
-
/** Lines of conversations already saved
|
|
55
|
+
/** Lines of conversations already saved: the thread keeps them, the next message starts a new conversation. */
|
|
62
56
|
const [history, setHistory] = React.useState<MeetingLine[]>([]);
|
|
63
57
|
const [error, setError] = React.useState<string | null>(null);
|
|
64
58
|
const [draft, setDraft] = React.useState('');
|
|
@@ -66,21 +60,24 @@ export function ConversePage({ client, classNames, meeting, createIO, savedLink
|
|
|
66
60
|
const io = React.useRef<BrowserMeetingIO | null>(null);
|
|
67
61
|
const micReady = React.useRef(false);
|
|
68
62
|
const endRef = React.useRef<HTMLDivElement | null>(null);
|
|
69
|
-
/** Reply text -> its audio url, so
|
|
63
|
+
/** Reply text -> its audio url, so the last reply can be played again from the settings menu. */
|
|
70
64
|
const audioOf = React.useRef(new Map<string, string>());
|
|
71
65
|
const replayAbort = React.useRef<AbortController | null>(null);
|
|
72
66
|
const [speed, setSpeedState] = React.useState<number>(DEFAULT_SPEED);
|
|
73
67
|
const speedRef = React.useRef(speed);
|
|
74
68
|
React.useEffect(() => { const v = loadSpeed(); speedRef.current = v; setSpeedState(v); }, []);
|
|
75
|
-
function onSpeed(v: number) {
|
|
76
|
-
speedRef.current = v; setSpeedState(v); saveSpeed(v); io.current?.setSpeed?.(v);
|
|
77
|
-
}
|
|
69
|
+
function onSpeed(v: number) { speedRef.current = v; setSpeedState(v); saveSpeed(v); io.current?.setSpeed?.(v); }
|
|
78
70
|
|
|
71
|
+
const needs = useNeedsYou(notify);
|
|
79
72
|
const lines = React.useMemo(() => [...history, ...state.lines], [history, state.lines]);
|
|
73
|
+
/** ONE list in time order: cards arrived before this session's conversation, so they lead; lines follow as said. */
|
|
74
|
+
const items = React.useMemo<ThreadItem[]>(() => {
|
|
75
|
+
const cards = [...(hostCards ?? []), ...needs.cards].sort((a, b) => a.at.localeCompare(b.at));
|
|
76
|
+
return [...cards.map((card) => ({ kind: 'card' as const, card })), ...lines.map((line) => ({ kind: 'line' as const, line }))];
|
|
77
|
+
}, [hostCards, needs.cards, lines]);
|
|
80
78
|
React.useEffect(() => { endRef.current?.scrollIntoView?.({ block: 'end' }); }, [lines, state.phase]);
|
|
81
79
|
React.useEffect(() => () => { void ctl.current?.end(); io.current?.close(); }, []);
|
|
82
80
|
|
|
83
|
-
/** The same client, remembering which audio belongs to which reply (for the per-line speaker). */
|
|
84
81
|
const trackedClient = React.useMemo<ConverseClient>(() => ({
|
|
85
82
|
...client,
|
|
86
83
|
turn: async (input) => {
|
|
@@ -105,9 +102,10 @@ export function ConversePage({ client, classNames, meeting, createIO, savedLink
|
|
|
105
102
|
return ctl.current;
|
|
106
103
|
}
|
|
107
104
|
|
|
108
|
-
|
|
105
|
+
/** Talk: opens the microphone inside the tap, then listens. */
|
|
106
|
+
async function startListening() {
|
|
109
107
|
setError(null);
|
|
110
|
-
if (state.micOn)
|
|
108
|
+
if (state.micOn) return;
|
|
111
109
|
const browserIO = ensureIO();
|
|
112
110
|
if (!micReady.current) {
|
|
113
111
|
try {
|
|
@@ -121,94 +119,105 @@ export function ConversePage({ client, classNames, meeting, createIO, savedLink
|
|
|
121
119
|
ensureCtl().mic(true);
|
|
122
120
|
}
|
|
123
121
|
|
|
122
|
+
/** The ONE mic control: Talk, Mute (stop listening and send what was said), Interrupt (cut the reply off). */
|
|
123
|
+
function onMic() {
|
|
124
|
+
if (view.micAction === 'interrupt') { ctl.current?.stop(); return; }
|
|
125
|
+
if (view.micAction === 'mute') { setError(null); ctl.current?.mic(false); return; }
|
|
126
|
+
void startListening();
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
async function send(text: string) {
|
|
130
|
+
const clean = normalizeAssistantName(text.trim(), assistantName);
|
|
131
|
+
if (!clean) return;
|
|
132
|
+
setError(null);
|
|
133
|
+
ensureIO().unlockPlayback?.(); // inside the tap, so the spoken reply is allowed to play; does not touch the microphone
|
|
134
|
+
await ensureCtl().sendText(clean);
|
|
135
|
+
}
|
|
124
136
|
async function onSend(event: React.FormEvent) {
|
|
125
137
|
event.preventDefault();
|
|
126
|
-
const text = draft
|
|
127
|
-
if (!text) return;
|
|
138
|
+
const text = draft;
|
|
128
139
|
setDraft('');
|
|
129
|
-
|
|
130
|
-
ensureIO().unlockPlayback?.(); // inside the tap, so the spoken reply is allowed to play; does not touch the microphone
|
|
131
|
-
await ensureCtl().sendText(text);
|
|
140
|
+
await send(text);
|
|
132
141
|
}
|
|
133
142
|
|
|
134
|
-
async function
|
|
143
|
+
async function onSave() {
|
|
135
144
|
const c = ctl.current;
|
|
136
145
|
if (!c) return;
|
|
137
|
-
const
|
|
146
|
+
const saving = c.getState().lines;
|
|
138
147
|
await c.end();
|
|
139
148
|
const saved = c.getState().saved;
|
|
140
149
|
micReady.current = false;
|
|
141
150
|
io.current?.close();
|
|
142
151
|
// Keep what was said on screen; the controller is replaced on the next message.
|
|
143
|
-
setHistory((h) => [...h, ...
|
|
152
|
+
setHistory((h) => [...h, ...saving]);
|
|
144
153
|
setState({ ...EMPTY, saved, error: c.getState().error });
|
|
145
154
|
ctl.current = null;
|
|
146
155
|
}
|
|
147
156
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
157
|
+
const lastReply = [...lines].reverse().find((l) => l.role === 'assistant' && audioOf.current.has(l.text));
|
|
158
|
+
async function onReplay() {
|
|
159
|
+
const url = lastReply ? audioOf.current.get(lastReply.text) : undefined;
|
|
160
|
+
if (!lastReply || !url) return;
|
|
151
161
|
replayAbort.current?.abort();
|
|
152
162
|
const abort = new AbortController();
|
|
153
163
|
replayAbort.current = abort;
|
|
154
|
-
const cfg = resolveMeetingConfig(meeting);
|
|
155
164
|
ensureIO().unlockPlayback?.();
|
|
156
|
-
await ensureIO().speak({ conversationId: state.conversationId ?? '', turn: 0, replyText:
|
|
165
|
+
await ensureIO().speak({ conversationId: state.conversationId ?? '', turn: 0, replyText: lastReply.text, audioUrl: url }, abort.signal, resolveMeetingConfig(meeting));
|
|
157
166
|
}
|
|
158
167
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
168
|
+
function onCardAction(card: ThreadCard, actionId: string) {
|
|
169
|
+
if (card.type === 'brief' && actionId === 'read') { void send('Read my brief'); return; }
|
|
170
|
+
const label = needs.optionLabel(card, actionId);
|
|
171
|
+
if (card.type === 'question' && label) void needs.answer(card, label);
|
|
172
|
+
}
|
|
163
173
|
|
|
174
|
+
const view = converseView(state);
|
|
175
|
+
const noAudio = state.noAudio && state.lines.length && state.phase !== 'thinking' ? `No spoken reply: ${state.noAudio}. The text is above.` : null;
|
|
164
176
|
return (
|
|
165
|
-
<div className=
|
|
166
|
-
<
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
<
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
{SPEEDS.map((v) => <option key={v} value={v}>{v}x</option>)}
|
|
209
|
-
</select>
|
|
177
|
+
<div className="flex min-h-[calc(100dvh-4rem)] flex-col gap-4">
|
|
178
|
+
<header className="flex justify-end" data-testid="converse-header">
|
|
179
|
+
<SettingsMenu speed={speed} onSpeed={onSpeed} canReplay={!!lastReply} onReplay={() => void onReplay()} canSave={!!ctl.current && !view.busy} onSave={() => void onSave()} />
|
|
180
|
+
</header>
|
|
181
|
+
<div className="flex-1 space-y-3">
|
|
182
|
+
{items.length ? (
|
|
183
|
+
<Thread items={items} assistantName={assistantName} cardProps={{ onAction: onCardAction, onReply: (c, t) => void needs.answer(c, t), busyId: needs.busyId, errors: needs.errors }} />
|
|
184
|
+
) : null}
|
|
185
|
+
{state.saved ? (
|
|
186
|
+
<p className="text-center text-xs text-gray-500" role="status" data-testid="converse-saved">
|
|
187
|
+
Saved {state.saved.turns} turn{state.saved.turns === 1 ? '' : 's'}. {savedLink?.(state.saved)}
|
|
188
|
+
</p>
|
|
189
|
+
) : null}
|
|
190
|
+
{noAudio ? <p className="text-center text-xs text-gray-500" role="status" data-testid="converse-no-audio">{noAudio}</p> : null}
|
|
191
|
+
{error || state.error ? <div className="rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700" role="alert">{error ?? state.error}</div> : null}
|
|
192
|
+
{state.relayNotice ? (
|
|
193
|
+
<div className="rounded-md border border-gray-200 bg-white p-3 text-sm text-gray-600" role="status" data-testid="converse-relay-notice">
|
|
194
|
+
Relay: {state.relayNotice}{' '}
|
|
195
|
+
<button type="button" className="font-semibold underline" onClick={() => ctl.current?.dismissNotice()}>Dismiss</button>
|
|
196
|
+
</div>
|
|
197
|
+
) : null}
|
|
198
|
+
<div ref={endRef} />
|
|
199
|
+
</div>
|
|
200
|
+
<div className="sticky bottom-0 space-y-2 bg-gray-50 pb-2 pt-2">
|
|
201
|
+
{lines.length === 0 ? (
|
|
202
|
+
<div className="flex flex-wrap items-center gap-2 text-sm" data-testid="converse-suggestions">
|
|
203
|
+
{SUGGESTIONS.map((s) => (
|
|
204
|
+
<button key={s} type="button" className="rounded-full border border-gray-300 bg-white px-3 py-1 text-gray-700 hover:border-gray-400" onClick={() => void send(s)}>{s}</button>
|
|
205
|
+
))}
|
|
206
|
+
</div>
|
|
207
|
+
) : null}
|
|
208
|
+
<form onSubmit={onSend} className="flex items-center gap-2">
|
|
209
|
+
<input
|
|
210
|
+
className="min-w-0 flex-1 rounded-full border border-gray-300 bg-white px-4 py-2.5 text-base" value={draft} onChange={(e) => setDraft(e.target.value)}
|
|
211
|
+
placeholder={`Ask ${assistantName} anything…`} aria-label="Type a message" enterKeyHint="send"
|
|
212
|
+
/>
|
|
213
|
+
<button
|
|
214
|
+
type="button" onClick={onMic} data-testid="converse-mic" data-action={view.micAction}
|
|
215
|
+
data-tone={view.micTone} style={{ backgroundColor: MIC_COLORS[view.micTone] }}
|
|
216
|
+
aria-pressed={view.micAction !== 'talk'} aria-label={MIC_LABEL[view.micAction]} title={`${MIC_LABEL[view.micAction]} (${view.micTone === 'idle' ? 'ready' : view.micTone})`}
|
|
217
|
+
disabled={view.busy} className="inline-flex h-11 shrink-0 items-center gap-2 rounded-full px-5 text-sm font-semibold text-white disabled:opacity-50"
|
|
218
|
+
>{view.micAction === 'interrupt' ? <StopIcon /> : <MicIcon />}{MIC_LABEL[view.micAction]}</button>
|
|
219
|
+
</form>
|
|
210
220
|
</div>
|
|
211
|
-
<div ref={endRef} />
|
|
212
221
|
</div>
|
|
213
222
|
);
|
|
214
|
-
}
|
|
223
|
+
}
|
|
@@ -182,6 +182,19 @@ export function LibraryPage({
|
|
|
182
182
|
const [count, setCount] = React.useState(0);
|
|
183
183
|
const [applied, setApplied] = React.useState<string[] | undefined>(undefined);
|
|
184
184
|
const [sources, setSources] = React.useState<SourceFreshness[]>([]);
|
|
185
|
+
/** Per-source totals, held apart from the cards so a late count patches a card, never replaces it. */
|
|
186
|
+
const [sourceCounts, setSourceCounts] = React.useState<Map<string, number | null>>(new Map());
|
|
187
|
+
/** True once the first list read has settled; the reads that are not the rows wait for it. */
|
|
188
|
+
const [firstPaint, setFirstPaint] = React.useState(false);
|
|
189
|
+
const defer = typeof api.participantsFor === 'function';
|
|
190
|
+
const shownSources = React.useMemo(
|
|
191
|
+
() => (sourceCounts.size === 0
|
|
192
|
+
? sources
|
|
193
|
+
: sources.map((source) => (sourceCounts.has(source.source)
|
|
194
|
+
? { ...source, documentCount: sourceCounts.get(source.source) ?? null }
|
|
195
|
+
: source))),
|
|
196
|
+
[sources, sourceCounts],
|
|
197
|
+
);
|
|
185
198
|
const [parties, setParties] = React.useState<Party[]>([]);
|
|
186
199
|
const [selectedId, setSelectedId] = React.useState<string | null>(initialDocumentId ?? null);
|
|
187
200
|
const [selected, setSelected] = React.useState<SourceDocument | null>(null);
|
|
@@ -202,25 +215,6 @@ export function LibraryPage({
|
|
|
202
215
|
*/
|
|
203
216
|
const [droppedOutOfScope, setDroppedOutOfScope] = React.useState(0);
|
|
204
217
|
|
|
205
|
-
// The reference-only surfaces (which sources exist, which parties exist) load
|
|
206
|
-
// once. They are what makes the filter controls DATA rather than a hardcoded
|
|
207
|
-
// vendor list — add a connector and its option appears with no code change.
|
|
208
|
-
React.useEffect(() => {
|
|
209
|
-
let live = true;
|
|
210
|
-
void (async () => {
|
|
211
|
-
const [freshness, partyPage] = await Promise.all([
|
|
212
|
-
api.listSources().catch(() => [] as SourceFreshness[]),
|
|
213
|
-
api.listParties({ page: 1, pageSize: 100 }).catch(() => ({
|
|
214
|
-
count: 0, next: null, previous: null, results: [] as Party[],
|
|
215
|
-
})),
|
|
216
|
-
]);
|
|
217
|
-
if (!live) return;
|
|
218
|
-
setSources(freshness);
|
|
219
|
-
setParties(partyPage.results ?? []);
|
|
220
|
-
})();
|
|
221
|
-
return () => { live = false; };
|
|
222
|
-
}, [api]);
|
|
223
|
-
|
|
224
218
|
/**
|
|
225
219
|
* The list query: the filter bar PLUS the open folder, bounded the way the
|
|
226
220
|
* reader asked for it — see `includeSubfolders` for why the default is the
|
|
@@ -239,7 +233,11 @@ export function LibraryPage({
|
|
|
239
233
|
setLoading(true);
|
|
240
234
|
void (async () => {
|
|
241
235
|
try {
|
|
242
|
-
|
|
236
|
+
// ROWS FIRST. With an adapter that can fetch participants separately the
|
|
237
|
+
// list waits for ONE read — the documents page — and the people on each
|
|
238
|
+
// row are patched in below. Behind a slow or single-file backend the
|
|
239
|
+
// edge read and the six-page roster walk were the page (2026-11-20).
|
|
240
|
+
const page = await api.listDocuments(query, defer ? { participants: false } : undefined);
|
|
243
241
|
if (!live) return;
|
|
244
242
|
// THE GUARD RUNS ON THE LIST, not only on the detail panel. A row from
|
|
245
243
|
// another workspace is a leak the moment it is drawn — its title and its
|
|
@@ -252,15 +250,55 @@ export function LibraryPage({
|
|
|
252
250
|
setCount(Math.max(0, (page.count ?? 0) - dropped.length));
|
|
253
251
|
setApplied(page.appliedFilters);
|
|
254
252
|
setLoadError('');
|
|
253
|
+
if (defer && api.participantsFor && kept.length) {
|
|
254
|
+
void api.participantsFor(kept.map((document) => document.id)).then((people) => {
|
|
255
|
+
if (!live) return;
|
|
256
|
+
setDocuments((current) => current.map((document) => {
|
|
257
|
+
const found = people.get(String(document.id));
|
|
258
|
+
return found ? { ...document, participants: found } : document;
|
|
259
|
+
}));
|
|
260
|
+
}).catch(() => { /* the rows stand without their people, as before */ });
|
|
261
|
+
}
|
|
255
262
|
} catch (err) {
|
|
256
263
|
if (live) setLoadError(readFailureMessage(err));
|
|
257
264
|
} finally {
|
|
258
|
-
if (live) setLoading(false);
|
|
265
|
+
if (live) { setLoading(false); setFirstPaint(true); }
|
|
259
266
|
}
|
|
260
267
|
})();
|
|
261
268
|
return () => { live = false; };
|
|
262
269
|
}, [api, query, scope, attempt]);
|
|
263
270
|
|
|
271
|
+
// The reference-only surfaces (which sources exist, which parties exist) load
|
|
272
|
+
// once. They are what makes the filter controls DATA rather than a hardcoded
|
|
273
|
+
// vendor list — add a connector and its option appears with no code change.
|
|
274
|
+
//
|
|
275
|
+
// IN QUEUE ORDER, because the queue is the bottleneck: the documents effect
|
|
276
|
+
// above asked first, the source CARDS ask next (they are above the fold), and
|
|
277
|
+
// everything that is not on the first screen — the per-source counts, the
|
|
278
|
+
// party filter, the people on each row — waits its turn behind the rows.
|
|
279
|
+
React.useEffect(() => {
|
|
280
|
+
let live = true;
|
|
281
|
+
void (async () => {
|
|
282
|
+
const freshness = await api
|
|
283
|
+
.listSources({ onCounts: (counts) => { if (live) setSourceCounts(counts); } })
|
|
284
|
+
.catch(() => [] as SourceFreshness[]);
|
|
285
|
+
if (live) setSources(freshness);
|
|
286
|
+
})();
|
|
287
|
+
return () => { live = false; };
|
|
288
|
+
}, [api]);
|
|
289
|
+
|
|
290
|
+
React.useEffect(() => {
|
|
291
|
+
if (!firstPaint) return undefined;
|
|
292
|
+
let live = true;
|
|
293
|
+
void (async () => {
|
|
294
|
+
const partyPage = await api.listParties({ page: 1, pageSize: 100 }).catch(() => ({
|
|
295
|
+
count: 0, next: null, previous: null, results: [] as Party[],
|
|
296
|
+
}));
|
|
297
|
+
if (live) setParties(partyPage.results ?? []);
|
|
298
|
+
})();
|
|
299
|
+
return () => { live = false; };
|
|
300
|
+
}, [api, firstPaint]);
|
|
301
|
+
|
|
264
302
|
React.useEffect(() => {
|
|
265
303
|
if (!selectedId) { setSelected(null); setSelectError(''); return; }
|
|
266
304
|
let live = true;
|
|
@@ -353,7 +391,7 @@ export function LibraryPage({
|
|
|
353
391
|
|
|
354
392
|
return (
|
|
355
393
|
<div className={cn.root}>
|
|
356
|
-
<FreshnessStrip sources={
|
|
394
|
+
<FreshnessStrip sources={shownSources} classNames={cn} now={now} />
|
|
357
395
|
|
|
358
396
|
<section className={cn.section}>
|
|
359
397
|
<form
|
|
@@ -386,7 +424,7 @@ export function LibraryPage({
|
|
|
386
424
|
>
|
|
387
425
|
<option value="">All sources</option>
|
|
388
426
|
{/* Options are DATA. A fourth connector appears here by existing. */}
|
|
389
|
-
{
|
|
427
|
+
{shownSources.map((source) => (
|
|
390
428
|
<option key={source.source} value={source.source}>{source.label}</option>
|
|
391
429
|
))}
|
|
392
430
|
</select>
|
|
@@ -487,6 +525,7 @@ export function LibraryPage({
|
|
|
487
525
|
onSelect={openFolder}
|
|
488
526
|
classNames={folderClassNames}
|
|
489
527
|
onUnavailable={() => setNoTree(true)}
|
|
528
|
+
hold={!firstPaint}
|
|
490
529
|
/>
|
|
491
530
|
</aside>
|
|
492
531
|
)}
|
|
@@ -575,7 +614,7 @@ export function LibraryPage({
|
|
|
575
614
|
filters.search || filters.source || filters.partyId
|
|
576
615
|
|| filters.occurredAfter || filters.occurredBefore || folder,
|
|
577
616
|
)}
|
|
578
|
-
sources={
|
|
617
|
+
sources={shownSources}
|
|
579
618
|
classNames={cn}
|
|
580
619
|
/>
|
|
581
620
|
)
|