@marver-design/marver 0.27.2 → 0.28.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 +101 -0
- package/README.md +4 -2
- package/dist/{anchor-check-gkxkPAIv.mjs → anchor-check-PHUOFj1N.mjs} +1 -1
- package/dist/{audio-Dw1lfMdb.mjs → audio-DX4POHAj.mjs} +39 -4
- package/dist/{boards-BqUqKNW8.mjs → boards-BeWtjGUM.mjs} +49 -4
- package/dist/boards-EH2onUXM.mjs +995 -0
- package/dist/{build-VgNg4rr8.mjs → build-BsAyLMT1.mjs} +7 -5
- package/dist/{capture-vadKjuCo.mjs → capture-DdZ6xgoz.mjs} +92 -30
- package/dist/cli.mjs +37 -16
- package/dist/{comments-YEU1Zhv9.mjs → comments-CrBHPEQl.mjs} +2 -2
- package/dist/config-BezZTiov.mjs +182 -0
- package/dist/conn-BMiHS42T.mjs +222 -0
- package/dist/connectors-MR9d-EBP.mjs +290 -0
- package/dist/{context-Ccjrhr1J.mjs → context-BUnFiyA3.mjs} +2 -2
- package/dist/{daemon-Dc9AH0M3.mjs → daemon-C5dg2R-V.mjs} +2187 -182
- package/dist/{dev-ri6nAlRp.mjs → dev-D7YS7iT2.mjs} +22 -11
- package/dist/{init-W0nxR1OY.mjs → init-WE5lQkQL.mjs} +7 -2
- package/dist/jam-Cj5gBvwD.mjs +373 -0
- package/dist/{link-CdTgn94Y.mjs → link-BFFRgrMt.mjs} +3 -3
- package/dist/listener-DdLEM79A.mjs +80 -0
- package/dist/{manifest-aFyDmL8C.mjs → manifest-DPZ3WNg_.mjs} +1 -1
- package/dist/{marks-BF9pNEgH.mjs → marks-Dyn6tmjp.mjs} +3 -3
- package/dist/{marks-CnCCfAbD.mjs → marks-Kmdab_5w.mjs} +2 -2
- package/dist/{perf-DkAUFT6W.mjs → perf-Cn5LiRaY.mjs} +3 -3
- package/dist/{perf-jam-BaH3Lg0m.mjs → perf-jam-QxD_UnzN.mjs} +1 -1
- package/dist/permit-DDa6wqOs.mjs +187 -0
- package/dist/{plugin-B8UghYuF.mjs → plugin-C_0yb-Fq.mjs} +365 -518
- package/dist/{poster-BNgafWMK.mjs → poster-DHi6I1fO.mjs} +1 -1
- package/dist/{publish-bakes-38Nja78p.mjs → publish-bakes-r4PEZuPl.mjs} +2 -2
- package/dist/{queue-CAM_vNmX.mjs → queue-c-6aTHEz.mjs} +164 -25
- package/dist/{recover-B8AiI29B.mjs → recover-nrLEVLyJ.mjs} +1 -1
- package/dist/{session-BAaJsK5c.mjs → session-DyVE7cCk.mjs} +1 -1
- package/dist/{shot-Ch24tiMO.mjs → shot-BrRtqaiS.mjs} +7 -6
- package/dist/{shot-CMQgMVZm.mjs → shot-DBWN8hPP.mjs} +1 -1
- package/dist/sizes-wjXDev3b.mjs +139 -0
- package/dist/speech-worker.mjs +23 -3
- package/dist/transport-C5FnY9ni.mjs +203 -0
- package/dist/{work-Bxz-ObF3.mjs → work-BYWD_1Zf.mjs} +3 -3
- package/dist/{work-CNhFF9pU.mjs → work-DJxH7cCX.mjs} +1 -1
- package/docs/jam-session.md +39 -14
- package/docs/live-jam.md +92 -10
- package/package.json +1 -1
- package/src/client/shell/JamSurface.tsx +56 -21
- package/src/client/shell/icons.tsx +1 -0
- package/src/client/shell/jam-capture.ts +97 -22
- package/src/client/shell/jam-keys.ts +32 -6
- package/src/client/shell/jam-lane.tsx +14 -5
- package/src/client/shell/jam-lines.ts +66 -9
- package/src/client/shell/jam-panel.tsx +55 -3
- package/src/client/shell/jam-queue.ts +50 -8
- package/src/client/shell/jam-session.tsx +53 -4
- package/src/client/shell/jam-surface-parts.tsx +6 -3
- package/src/client/shell/jam-ui.tsx +6 -1
- package/src/client/shell/jam-voice-wait.ts +21 -0
- package/src/client/shell/jam-voice.ts +14 -5
- package/src/client/shell/styles.css +27 -11
- package/src/client/shell/tidy.ts +3 -2
- package/src/shared/approval.ts +20 -0
- package/src/shared/events.ts +1 -1
- package/templates/AGENTS-embedded.md +28 -1
- package/templates/AGENTS-studio.md +28 -1
- package/templates/instructions/boards.md +7 -1
- package/templates/instructions/jam.md +90 -0
- package/dist/boards-BHKP5yhI.mjs +0 -342
|
@@ -7,18 +7,18 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { useEffect, useMemo, useRef, useState, type ReactNode } from 'react'
|
|
9
9
|
import { ROUTE } from '../const.ts'
|
|
10
|
-
import { captureCounts, useJamCapture } from './jam-capture.ts'
|
|
10
|
+
import { captureCounts, endedToReview, useJamCapture } from './jam-capture.ts'
|
|
11
11
|
import { useJamVoice, voiceSession, voiceSessionEnd, voiceSessionId, type Heard } from './jam-voice.ts'
|
|
12
12
|
import { holdsSessionMic, PlayCounter, RecordDetail, StartSheet, WrapSheet } from './jam-session.tsx'
|
|
13
13
|
import { FocusPanel, VoiceAsk } from './jam-panel.tsx'
|
|
14
14
|
import { addNote, decideDraft, laneCards, openThread, openTile, pendingEdit, resumeDraft, reveal, saveEdit, shownLane, startCapture } from './jam-keys.ts'
|
|
15
15
|
import { ContextMenu, useContextMenu, type MenuItem } from './ContextMenu.tsx'
|
|
16
16
|
import { ArrowBendUpLeftIcon, ArrowLineUpIcon, ArrowUpIcon, CheckSquareOffsetIcon, CommentIcon, EyeIcon, NotebookIcon, PencilSimpleIcon, PlayIcon, ReloadIcon, XIcon } from './icons.tsx'
|
|
17
|
-
import { laneLine, timelineLines } from './jam-lines.ts'
|
|
17
|
+
import { laneLine, laneTip, timelineLines } from './jam-lines.ts'
|
|
18
18
|
import { changedShots, useJamQueue, type JamCard } from './jam-queue.ts'
|
|
19
19
|
import { DONE_GROUP, doneFold, letGoOfTile, useJamUi } from './jam-state.ts'
|
|
20
20
|
import { CaptureLaneRow, FocusPanelView } from './jam-surface-parts.tsx'
|
|
21
|
-
import { clearMoreDraft, EdgeRing } from './jam-panel.tsx'
|
|
21
|
+
import { clearMoreDraft, EdgeRing, preloadShots } from './jam-panel.tsx'
|
|
22
22
|
import { useComments } from './comments-store.ts'
|
|
23
23
|
import { HARNESS } from './Comments.tsx'
|
|
24
24
|
import { PUBLISHED, useStore } from './store.ts'
|
|
@@ -68,22 +68,38 @@ export function JamSurface({ sidebarRight }: { sidebarRight: number }) {
|
|
|
68
68
|
useEffect(() => { const t = setInterval(() => setTick((n) => n + 1), 1000); return () => clearInterval(t) }, [])
|
|
69
69
|
// a new capture or a new draft brings the lane back to its right end
|
|
70
70
|
useEffect(() => { ui.follow() }, [cap.current, cards?.filter((c) => c.kind === 'capture').length])
|
|
71
|
-
|
|
72
|
-
//
|
|
73
|
-
//
|
|
74
|
-
//
|
|
71
|
+
const made = (id: string) => Number(/^cap-(\d+)-/.exec(id)?.[1] ?? 0)
|
|
72
|
+
// the read-back of the capture stopped TO REVIEW last (⇧E, or J's wrap-up) opens when capturing stops - over a
|
|
73
|
+
// review too (a capture made during a review is confirmed in its read-back; the review it follows stays bound in
|
|
74
|
+
// its record). It waits for that capture's own card: a resumed one replaces its draft, which must not open instead.
|
|
75
|
+
// The one ENDED last among them, not the one that sealed last (pictures can keep an earlier one sealing longer) -
|
|
76
|
+
// one capture records at a time, so that is the one started last. A capture stopped with E after it, before it
|
|
77
|
+
// had finished, never takes its place; and one stopped with E never opens, selects or moves anything - not even
|
|
78
|
+
// when the queue left it a draft (Nic, 27 Oct: "only when the user says Stop and Review should we have the To
|
|
79
|
+
// confirm state and open the capture card")
|
|
75
80
|
const [shownFor, setShownFor] = useState<string | null>(null)
|
|
76
81
|
useEffect(() => {
|
|
77
|
-
if (cap.current
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
if (cap.current) return
|
|
83
|
+
const toReview = cap.sealed.filter((x) => x.review).reduce<(typeof cap.sealed)[number] | undefined>((a, x) => (!a || made(x.id) > made(a.id) ? x : a), undefined)
|
|
84
|
+
// one stopped to review after it that is still finishing is the one to open: wait for it, never open the older
|
|
85
|
+
if (Object.values(cap.caps).some((c) => c.review && c.id !== toReview?.id && made(c.id) > (toReview ? made(toReview.id) : 0))) return
|
|
86
|
+
if (!toReview?.card || toReview.id === shownFor) return
|
|
87
|
+
const draft = cards?.find((c) => c.id === toReview.card!.id && c.state === 'draft')
|
|
81
88
|
if (!draft) return
|
|
82
|
-
setShownFor(
|
|
89
|
+
setShownFor(toReview.id)
|
|
83
90
|
if (ui.panel?.kind === 'capture' && ui.panel.id === draft.id) return
|
|
84
91
|
ui.open({ kind: 'capture', id: draft.id })
|
|
85
92
|
reveal(draft)
|
|
86
|
-
}, [cap.current, cap.sealed,
|
|
93
|
+
}, [cap.current, cap.sealed, cards])
|
|
94
|
+
|
|
95
|
+
// a review whose card left review under it - a capture made over it and stopped with E took it as More work, or
|
|
96
|
+
// another tab decided it: its panel closes (its verdicts would only fail now); nothing else opens or moves
|
|
97
|
+
const reviewing = ui.panel?.kind === 'review' ? cards?.find((c) => c.id === ui.panel!.id)?.state : undefined
|
|
98
|
+
const wasReviewing = useRef(reviewing)
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
if (wasReviewing.current === 'review' && reviewing && reviewing !== 'review' && useJamUi.getState().panel?.kind === 'review') ui.close()
|
|
101
|
+
wasReviewing.current = reviewing
|
|
102
|
+
}, [reviewing, ui.panel?.id])
|
|
87
103
|
|
|
88
104
|
// the session as the server holds it: a page opened (or reloaded) during one hears its talk again; one
|
|
89
105
|
// ended elsewhere (another tab) stops the talk here
|
|
@@ -119,13 +135,15 @@ export function JamSurface({ sidebarRight }: { sidebarRight: number }) {
|
|
|
119
135
|
const sel = useJamQueue.getState().cards?.find((c) => c.id === st.selected)
|
|
120
136
|
if (sel?.thread === s.active) { if (st.panel) st.close() } else letGoOfTile()
|
|
121
137
|
}), [])
|
|
122
|
-
const
|
|
123
|
-
const withMade = list.map((c) => ({ made: c.made, tile: { id: c.id, state: c.state, title: c.title ?? 'Capture', line: laneLine(c), ...(c.exclusive ? { exclusive: true } : {}), ...(c.state === 'done' && c.shots?.some((x) => !x.same) ? { frames: c.shots.filter((x) => !x.same).map((x) => x.frame) } : {}), ...(c.kind === 'wrapup' ? { record: true } : {}) } as { id: string; state: JamCard['state']; title: string; line: string; exclusive?: boolean; frames?: string[]; record?: boolean } })
|
|
138
|
+
const tool = (a: string): string | undefined => HARNESS[a]
|
|
139
|
+
const withMade = list.map((c) => { const tip = laneTip(c, tool); return { made: c.made, tile: { id: c.id, state: c.state, title: c.title ?? 'Capture', line: laneLine(c, Date.now(), tool), ...(tip ? { tip } : {}), ...(c.exclusive ? { exclusive: true } : {}), ...(c.state === 'done' && c.shots?.some((x) => !x.same) ? { frames: c.shots.filter((x) => !x.same).map((x) => x.frame) } : {}), ...(c.kind === 'wrapup' ? { record: true } : {}) } as { id: string; state: JamCard['state']; title: string; line: string; tip?: string; exclusive?: boolean; frames?: string[]; record?: boolean } } })
|
|
124
140
|
// captures the server does not hold yet: sealing (pictures and flushes still out) or waiting to send -
|
|
125
|
-
// each in its place by when it started, so one sealing late never swaps with a newer one
|
|
141
|
+
// each in its place by when it started, so one sealing late never swaps with a newer one. Stopped with E it is
|
|
142
|
+
// being sent to the queue ("Sending", the spinning glyph of work under way - never To confirm); stopped to review
|
|
143
|
+
// (⇧E) it is finishing for its read-back
|
|
126
144
|
const known = new Set(list.map((c) => c.id))
|
|
127
|
-
for (const c of Object.values(cap.caps)) if (c.state === 'draining' && !known.has(c.id)) withMade.push({ made: made(c.id), tile: { id: c.id, state: 'confirming', title: 'Capture', line: 'Finishing' } })
|
|
128
|
-
for (const id of cap.unsent) if (!known.has(id) && !cap.caps[id]) withMade.push({ made: made(id), tile: { id, state: 'confirming', title: 'Capture', line: 'Waiting to send' } })
|
|
145
|
+
for (const c of Object.values(cap.caps)) if (c.state === 'draining' && !known.has(c.id)) withMade.push({ made: made(c.id), tile: { id: c.id, state: 'confirming', title: 'Capture', line: c.review ? 'Finishing' : 'Sending' } })
|
|
146
|
+
for (const id of cap.unsent) if (!known.has(id) && !cap.caps[id]) withMade.push({ made: made(id), tile: { id, state: 'confirming', title: 'Capture', line: cap.away ? 'Waiting to send' : endedToReview(id) ? 'Finishing' : 'Sending' } })
|
|
129
147
|
const tiles = withMade.sort((a, b) => a.made - b.made).map((x) => x.tile)
|
|
130
148
|
// a selected tile that became done while the Done group is folded: the group holds the selection now
|
|
131
149
|
const doneNow = doneFold(tiles, ui.doneOpen)
|
|
@@ -137,7 +155,7 @@ export function JamSurface({ sidebarRight }: { sidebarRight: number }) {
|
|
|
137
155
|
const counts = captureCounts(c)
|
|
138
156
|
const steps = (c?.steps ?? []).filter((x) => ['select', 'device', 'theme', 'copied', 'interact'].includes(x.event)).length
|
|
139
157
|
return { time: counts.time, points: c?.points.length ?? 0, pictures: c?.pictures.length ?? 0, picturesMax: (c?.pictures.length ?? 0) >= 12, steps,
|
|
140
|
-
notes: counts.notes, noteOn: cap.noteOpen, onNote: () => cap.setNoteOpen(!cap.noteOpen), onStop: () => cap.end(),
|
|
158
|
+
notes: counts.notes, noteOn: cap.noteOpen, onNote: () => cap.setNoteOpen(!cap.noteOpen), onStop: () => cap.end(), onStopReview: () => cap.end(true),
|
|
141
159
|
// the microphone: on while it hears this capture; off once you were asked (a click asks again)
|
|
142
160
|
...(voice.hearing === cap.current ? { mic: 'on' as const } : voice.choice !== null || voice.denied ? { mic: 'off' as const, onMic: () => useJamVoice.setState({ asking: true, choice: null }) } : {}) }
|
|
143
161
|
})() : undefined
|
|
@@ -149,10 +167,14 @@ export function JamSurface({ sidebarRight }: { sidebarRight: number }) {
|
|
|
149
167
|
} : undefined
|
|
150
168
|
|
|
151
169
|
const panelCard = ui.panel ? cards?.find((c) => c.id === ui.panel!.id) : undefined
|
|
170
|
+
// a card ready to review, and the one whose review is open: its pictures load now, every frame's - its review opens
|
|
171
|
+
// at their size and moves between frames without waiting (each URL once; never a card that is not in review)
|
|
172
|
+
useEffect(() => {
|
|
173
|
+
for (const c of cards ?? []) if (c.state === 'review' || (ui.panel?.kind === 'review' && c.id === ui.panel.id)) preloadShots(changedShots(c.shots).flatMap((x) => [picture(x.before), picture(x.after)]))
|
|
174
|
+
}, [cards, ui.panel])
|
|
152
175
|
const rec = useRecord(ui.panel?.kind === 'capture' || ui.panel?.kind === 'review' ? ui.panel.id : undefined)
|
|
153
176
|
const agentName = agent ? HARNESS[agent] ?? agent : 'your agent'
|
|
154
177
|
const act = (c: JamCard | undefined, action: Parameters<ReturnType<typeof useJamQueue.getState>['act']>[1], body?: string) => (c ? useJamQueue.getState().act(c, action, body) : Promise.resolve(false))
|
|
155
|
-
const openThread = (c?: JamCard) => { if (c?.thread) useComments.getState().setActive(c.thread) }
|
|
156
178
|
/** The panel's arrows: the previous or next card of the same kind on the lane (reviews among reviews). */
|
|
157
179
|
const step = (d: number) => {
|
|
158
180
|
if (!ui.panel || !panelCard) return undefined
|
|
@@ -238,6 +260,12 @@ export function JamSurface({ sidebarRight }: { sidebarRight: number }) {
|
|
|
238
260
|
})()}
|
|
239
261
|
onLater={() => { void act(panelCard, 'later'); ui.close() }}
|
|
240
262
|
onOpenThread={() => openThread(panelCard)}
|
|
263
|
+
asks={panelCard.thread ? { question: replyText(panelCard), onAnswer: async (text) => {
|
|
264
|
+
const ok = await useComments.getState().replyOk(panelCard.thread!, /@marver\b/i.test(text) ? text : `@marver ${text}`)
|
|
265
|
+
if (!ok) useStore.getState().toast('your answer was not sent - try again')
|
|
266
|
+
else ui.close()
|
|
267
|
+
return ok
|
|
268
|
+
} } : undefined}
|
|
241
269
|
onPrev={step(-1)} onNext={step(1)} pending={pendingEdit(panelCard.id)} locked={cap.settling === panelCard.id}
|
|
242
270
|
onRetry={() => void (async () => { if (await act(useJamQueue.getState().cards?.find((x) => x.id === panelCard.id), 'retry')) ui.close(); else useStore.getState().toast('the capture could not be retried - look again') })()}
|
|
243
271
|
/>
|
|
@@ -283,7 +311,8 @@ function replyIn(c: JamCard) {
|
|
|
283
311
|
// once the thread's card has drawn (on another board, once that board has loaded)
|
|
284
312
|
const until = performance.now() + 3_000
|
|
285
313
|
const focus = () => {
|
|
286
|
-
const el = useComments.getState().active === c.thread ? document.querySelector<HTMLTextAreaElement>('.cm-card textarea')
|
|
314
|
+
const el = useComments.getState().active === c.thread ? document.querySelector<HTMLTextAreaElement>('.cm-card textarea')
|
|
315
|
+
: useJamUi.getState().panel?.id === c.id ? document.querySelector<HTMLTextAreaElement>('.jm-asks textarea') : null
|
|
287
316
|
if (el) { el.focus(); el.setSelectionRange(el.value.length, el.value.length) } else if (performance.now() < until) requestAnimationFrame(focus)
|
|
288
317
|
}
|
|
289
318
|
requestAnimationFrame(focus)
|
|
@@ -310,6 +339,12 @@ function tileMenu(c: JamCard): MenuItem[] {
|
|
|
310
339
|
case 'review': return [open, ...reply, ...thread, rename]
|
|
311
340
|
case 'asks': return [...reply, open, rename]
|
|
312
341
|
case 'failed': return [item('Retry', <ReloadIcon size={14} />, () => act('retry')), open, ...thread, item('Drop', <XIcon size={14} />, () => act('drop'))]
|
|
342
|
+
case 'working': {
|
|
343
|
+
// a run your session went quiet on (spec 29b): give it back, run it in the background, or drop it
|
|
344
|
+
if (c.runner?.kind !== 'session' || c.runner.state !== 'stalled') return [open, ...reply, ...thread, rename]
|
|
345
|
+
const run = (a: 'again' | 'background' | 'drop') => () => { const fresh = useJamQueue.getState().cards?.find((x) => x.id === c.id); if (fresh) void useJamQueue.getState().runAct(fresh, a) }
|
|
346
|
+
return [item('Give it back to your session', <ReloadIcon size={14} />, run('again')), item('Run it in the background', <ArrowUpIcon size={14} />, run('background')), open, ...thread, item('Drop it', <XIcon size={14} />, run('drop'))]
|
|
347
|
+
}
|
|
313
348
|
default: return [open, ...reply, ...thread, rename]
|
|
314
349
|
}
|
|
315
350
|
}
|
|
@@ -53,6 +53,7 @@ export const PanelFilledIcon = icon(<><rect x="32" y="48" width="192" height="16
|
|
|
53
53
|
export const FrameRectIcon = icon(<rect x="40" y="52" width="176" height="152" rx="20" fill="none" stroke="currentColor" strokeWidth="16" />)
|
|
54
54
|
export const UserIcon = icon(<path d="M230.92,212c-15.23-26.33-38.7-45.21-66.09-54.16a72,72,0,1,0-73.66,0C63.78,166.78,40.31,185.66,25.08,212a8,8,0,1,0,13.85,8c18.84-32.56,52.14-52,89.07-52s70.23,19.44,89.07,52a8,8,0,1,0,13.85-8ZM72,96a56,56,0,1,1,56,56A56.06,56.06,0,0,1,72,96Z" />)
|
|
55
55
|
export const PencilSimpleIcon = icon(<path d="M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z" />)
|
|
56
|
+
export const PauseIcon = icon(<><rect x="64" y="40" width="40" height="176" rx="10" /><rect x="152" y="40" width="40" height="176" rx="10" /></>)
|
|
56
57
|
export const LinkIcon = icon(<path d="M137.54,186.36a8,8,0,0,1,0,11.31l-9.94,10A56,56,0,0,1,48.38,128.4L72.5,104.28A56,56,0,0,1,149.31,102a8,8,0,1,1-10.64,12,40,40,0,0,0-54.85,1.63L59.7,139.72a40,40,0,0,0,56.58,56.58l9.94-9.94A8,8,0,0,1,137.54,186.36Zm70.08-138a56.08,56.08,0,0,0-79.22,0l-9.94,9.95a8,8,0,0,0,11.32,11.31l9.94-9.94a40,40,0,0,1,56.58,56.58L172.18,140.4a40,40,0,0,1-54.85,1.6,8,8,0,1,0-10.64,12,56,56,0,0,0,76.81-2.26l24.12-24.12A56.08,56.08,0,0,0,207.62,48.38Z" />)
|
|
57
58
|
export const LaserIcon = icon(<><circle cx="128" cy="128" r="56" fill="none" stroke="currentColor" strokeWidth="16" /><path d="M128 24 V56 M128 200 V232 M24 128 H56 M200 128 H232" fill="none" stroke="currentColor" strokeWidth="16" strokeLinecap="round" /><circle cx="128" cy="128" r="12" /></>)
|
|
58
59
|
|
|
@@ -97,6 +97,7 @@ interface Cap {
|
|
|
97
97
|
/** its timing (spec 27a Part D): when E was pressed, the wait for its last words, each picture's time, the missing ones */
|
|
98
98
|
timing?: { endAt?: number; wordsMs?: number; pics: number[]; late: number; failed: number }
|
|
99
99
|
shotFrames: string[] // frames pictured (or being pictured) in it: an automatic picture is taken once per frame
|
|
100
|
+
review?: boolean // ended with ⇧E: it waits for its read-back (E: queued once sealed)
|
|
100
101
|
endShot?: boolean // its end pictures were asked for (once its steps were all in)
|
|
101
102
|
inherited?: string[] // Resume: the frames the capture it continues was about (its card's)
|
|
102
103
|
endSizes?: Record<string, { w: number; h: number; play?: true }> // the sizes as they were at E (what it was about, then)
|
|
@@ -125,16 +126,20 @@ interface CaptureState {
|
|
|
125
126
|
/** Start one - never while one records (it says so instead) */
|
|
126
127
|
/** `session`: the session it belongs to, when the caller knows it before the queue shows it (Start) */
|
|
127
128
|
start(reviewing?: Cap['reviewing'], session?: string): void
|
|
128
|
-
|
|
129
|
+
/** E: it goes straight to the queue once it seals; ⇧E (`review`): its read-back opens to check and add to first */
|
|
130
|
+
end(review?: boolean): void
|
|
129
131
|
drop(): void
|
|
130
132
|
note(text: string): void
|
|
131
133
|
setNoteOpen(open: boolean): void
|
|
132
134
|
setNoteDraft(text: string): void
|
|
133
135
|
picture(frame?: string): void
|
|
134
|
-
/** the
|
|
135
|
-
|
|
136
|
+
/** the captures sealed, in order, and the card the server made of each - the read-back of one stopped to review
|
|
137
|
+
* (`review`: ⇧E, or J's wrap-up) opens when capturing stops; one stopped with E never opens anything */
|
|
138
|
+
sealed: { id: string; card?: { id: string; rev: number }; review?: true }[]
|
|
136
139
|
/** sealed captures the server does not hold yet (kept, sent again until it takes them) */
|
|
137
140
|
unsent: string[]
|
|
141
|
+
/** the server did not answer the last send: what is unsent waits for it (sent again every 5 s) */
|
|
142
|
+
away: boolean
|
|
138
143
|
/** Continue a draft that ended too soon: its record is loaded and recording goes on from where it
|
|
139
144
|
* stopped, under a new id that takes the draft's place when it seals. Dropping it leaves the draft. */
|
|
140
145
|
resume(draft: string, ready?: () => Promise<boolean>): Promise<boolean>
|
|
@@ -144,7 +149,8 @@ interface CaptureState {
|
|
|
144
149
|
* locked meanwhile, so nothing typed can race the start - set by the caller (resumeDraft) before its
|
|
145
150
|
* first wait, cleared when the Resume is over */
|
|
146
151
|
settling: string | null
|
|
147
|
-
/** the capture ended last (E): its read-back is the one that opens, whatever
|
|
152
|
+
/** the capture ended last (E or ⇧E): if it was stopped to review, its read-back is the one that opens, whatever
|
|
153
|
+
* seals first */
|
|
148
154
|
lastEnded: string | null
|
|
149
155
|
}
|
|
150
156
|
|
|
@@ -688,7 +694,8 @@ function drain(id: string) {
|
|
|
688
694
|
const st = useStore.getState()
|
|
689
695
|
if (st.play) { mutate((s) => { const x = s.caps[id]; if (x) x.endShot = true }); shoot(id, st.play.at, 'end') }
|
|
690
696
|
broadcast({ type: 'sh:capture', id, on: false })
|
|
691
|
-
// the audio is cut at the key press, then its last words are awaited (
|
|
697
|
+
// the audio is cut at the key press, then its last words are awaited (15 s at most - E queues it only once they
|
|
698
|
+
// are in its record, as ⇧E's read-back shows them)
|
|
692
699
|
mutate((st) => { const x = st.caps[id]; if (x) x.hearing = true })
|
|
693
700
|
const tWords = performance.now()
|
|
694
701
|
void voiceEnd(id).then((complete) => {
|
|
@@ -782,7 +789,7 @@ function buildRecord(c: Cap, steps: Cap['steps'], interrupted = false): CaptureR
|
|
|
782
789
|
const timeline = [...steps].sort((a, b) => a.at - b.at || (a.seq ?? 0) - (b.seq ?? 0)).map(({ seq: _s, src: _k, ...step }) => step as Step)
|
|
783
790
|
return {
|
|
784
791
|
format: 'marver.jam.capture', v: 1, id: c.id,
|
|
785
|
-
context: { canvas: location.host, board: c.board, ...(c.session ? { session: c.session } : {}), ...(c.reviewing ? { reviewing: c.reviewing } : {}), ...(c.resumes ? { resumes: c.resumes } : {}), ...(interrupted ? { interrupted: true as const } : {}) },
|
|
792
|
+
context: { canvas: location.host, board: c.board, ...(c.session ? { session: c.session } : {}), ...(c.reviewing ? { reviewing: c.reviewing } : {}), ...(c.resumes ? { resumes: c.resumes } : {}), ...(interrupted ? { interrupted: true as const } : {}), ...(c.review ? { review: true as const } : {}) },
|
|
786
793
|
view: (timeline.find((x) => x.event === 'view') as Extract<Step, { event: 'view' }> | undefined)?.view ?? {},
|
|
787
794
|
timeline, pictures: c.pictures, ...(() => { const sizes = sealedSizes(c); return Object.keys(sizes).length ? { sizes } : {} })(),
|
|
788
795
|
}
|
|
@@ -799,7 +806,7 @@ function trySeal(id: string) {
|
|
|
799
806
|
const record = buildRecord(c2, c2.steps)
|
|
800
807
|
timeCapture(c2, false)
|
|
801
808
|
// sealed: drop everything for this id that arrives later
|
|
802
|
-
useJamCapture.setState((st) => { const caps = { ...st.caps }; delete caps[id]; return { caps, tick: st.tick + 1, sealed: [...st.sealed, { id }] } })
|
|
809
|
+
useJamCapture.setState((st) => { const caps = { ...st.caps }; delete caps[id]; return { caps, tick: st.tick + 1, sealed: [...st.sealed, { id, ...(c2.review ? { review: true as const } : {}) }] } })
|
|
803
810
|
forgetHeard(id)
|
|
804
811
|
keepSealed(record)
|
|
805
812
|
void upload(record)
|
|
@@ -815,13 +822,19 @@ const syncUnsent = () => useJamCapture.setState({ unsent: [...pendingUploads.key
|
|
|
815
822
|
* the pagehide listeners run in. */
|
|
816
823
|
export const capturesPending = (): boolean => { const s = useJamCapture.getState(); return s.unsent.length > 0 || Object.keys(s.caps).length > 0 }
|
|
817
824
|
const keepSealed = (r: CaptureRecord) => { try { const all = JSON.parse(localStorage.getItem(KEPT) ?? '{}'); all[r.id] = r; localStorage.setItem(KEPT, JSON.stringify(all)) } catch { /* memory only */ } pendingUploads.set(r.id, r); syncUnsent() }
|
|
818
|
-
const
|
|
825
|
+
const forgetKept = (id: string) => { try { const all = JSON.parse(localStorage.getItem(KEPT) ?? '{}'); delete all[id]; localStorage.setItem(KEPT, JSON.stringify(all)) } catch { /* memory only */ } }
|
|
819
826
|
const pendingUploads = new Map<string, CaptureRecord>()
|
|
827
|
+
/** taken by the server, waiting only for its card on the page's queue: never posted again (a retry for another capture,
|
|
828
|
+
* a page shown again) - its one wait goes on, and its Sending tile with it */
|
|
829
|
+
const acked = new Set<string>()
|
|
830
|
+
/** posted, its answer not back yet: a retry round meanwhile leaves it alone (its answer starts the one wait) */
|
|
831
|
+
const inflight = new Set<string>()
|
|
820
832
|
let retryTimer: ReturnType<typeof setTimeout> | null = null
|
|
821
833
|
/** Post a sealed record - the same id, idempotent on the server - until it takes. A refusal about the
|
|
822
834
|
* record itself (not the network) is final and said once; a dev server that is away is waited for. */
|
|
823
835
|
async function upload(record: CaptureRecord, leaving = false): Promise<void> {
|
|
824
|
-
|
|
836
|
+
if (acked.has(record.id) || inflight.has(record.id)) return
|
|
837
|
+
type Verdict = { ok?: boolean; card?: { id: string; rev: number }; error?: string; outside?: boolean; held?: string }
|
|
825
838
|
let r: Verdict | null = null
|
|
826
839
|
try {
|
|
827
840
|
// the workspace it was made in travels with it: another project served on this port refuses it
|
|
@@ -830,8 +843,12 @@ async function upload(record: CaptureRecord, leaving = false): Promise<void> {
|
|
|
830
843
|
const payload = JSON.stringify({ record, workspace: CONFIG.workspace })
|
|
831
844
|
// a page that is going sends with keepalive (64 kB at most, counted in UTF-8 bytes as the body carries it - not
|
|
832
845
|
// `.length`: notes in another script are wider) so the request outlives it; a bigger one, the next page
|
|
833
|
-
|
|
834
|
-
|
|
846
|
+
inflight.add(record.id)
|
|
847
|
+
let res: Response, body: Verdict | null
|
|
848
|
+
try {
|
|
849
|
+
res = await api('jam/capture', { method: 'POST', headers: { 'content-type': 'application/json', 'x-mv-c': csrf() }, body: payload, ...(leaving && bytesOf(payload) < 60_000 ? { keepalive: true } : {}) })
|
|
850
|
+
body = (await res.json().catch(() => null)) as Verdict | null
|
|
851
|
+
} finally { inflight.delete(record.id) }
|
|
835
852
|
// only an explicit verdict on THIS record is final: taken (200, naming its card) or refused as a
|
|
836
853
|
// record (400, saying why). Anything else - jam not running yet, another workspace, an unreadable
|
|
837
854
|
// answer, a gate, a server error - is the server being away: keep it and try again
|
|
@@ -842,26 +859,77 @@ async function upload(record: CaptureRecord, leaving = false): Promise<void> {
|
|
|
842
859
|
if (!r) {
|
|
843
860
|
if (!retryTimer) useStore.getState().toast('the capture is kept here and will be sent when marver dev answers')
|
|
844
861
|
retryTimer ??= setTimeout(() => { retryTimer = null; for (const x of pendingUploads.values()) void upload(x) }, 5_000)
|
|
862
|
+
if (!useJamCapture.getState().away) useJamCapture.setState({ away: true })
|
|
845
863
|
return
|
|
846
864
|
}
|
|
847
|
-
|
|
865
|
+
if (useJamCapture.getState().away) useJamCapture.setState({ away: false })
|
|
866
|
+
forgetKept(record.id)
|
|
848
867
|
releaseOpen(record.id, !r.ok) // it landed (the server knows); refused, it is no longer open either
|
|
849
|
-
|
|
868
|
+
useJamCapture.setState((st) => ({ sealed: st.sealed.map((x) => (x.id === record.id ? { ...x, ...(r!.card ? { card: r!.card } : {}) } : x)) }))
|
|
869
|
+
// what stands for it here - its Sending tile, a resumed draft kept off the lane - stays until the queue holds its
|
|
870
|
+
// card: the answer comes before the push that carries it, and in between the lane showed the old draft's To confirm
|
|
871
|
+
// in its place, or (nothing else on it) folded away and came back. A refresh that fails is not the end of the wait
|
|
872
|
+
if (r.ok) {
|
|
873
|
+
if (acked.has(record.id)) return // another answer for it already started its wait
|
|
874
|
+
acked.add(record.id); try { await untilQueued(record.id) } finally { acked.delete(record.id) }
|
|
875
|
+
}
|
|
876
|
+
pendingUploads.delete(record.id); syncUnsent()
|
|
877
|
+
// the resumed draft it replaced was dropped on the server - it leaves the lane for good; refused, it shows again
|
|
850
878
|
const was = record.context.resumes?.id
|
|
851
|
-
useJamCapture.setState((st) => ({
|
|
852
|
-
void import('./jam-queue.ts').then(({ useJamQueue }) => useJamQueue.getState().load())
|
|
879
|
+
if (was) useJamCapture.setState((st) => ({ resuming: st.resuming.filter((x) => x !== was) }))
|
|
853
880
|
if (!r.ok) useStore.getState().toast(`the capture could not be kept: ${r.error ?? 'unknown error'}`)
|
|
854
|
-
|
|
855
|
-
|
|
881
|
+
else {
|
|
882
|
+
// stopped with E and the queue would not take it: it waits on the lane as a draft - said once, nothing opens
|
|
883
|
+
if (r.held) useStore.getState().toast(`the capture was not queued - it waits on the lane as a draft: ${r.held}`)
|
|
884
|
+
// it reached the server after its session ended (another tab wrote the record): on its own
|
|
885
|
+
if (r.outside) leftOutOfSession(record.id)
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
/** Until the page's queue holds this card: loaded now (a load that hangs is given 10 s), then again after 2, 4, 8 s and every 10 s on, unless a push
|
|
890
|
+
* brings it first - never given up on, so what stands for it never leaves the lane before its card is there. Any
|
|
891
|
+
* answer to a load ends it too: built after the canvas took the card, a view shows it (every card waiting or under way
|
|
892
|
+
* is shown, any other for a minute after it last changed) - unless it was finished elsewhere and has left the lane
|
|
893
|
+
* (another tab reviewed it while this page's refreshes failed), and then there is nothing left to wait for. */
|
|
894
|
+
async function untilQueued(id: string): Promise<void> {
|
|
895
|
+
const q = (await import('./jam-queue.ts')).useJamQueue
|
|
896
|
+
const held = () => !!q.getState().cards?.some((c) => c.id === id)
|
|
897
|
+
if (held()) return
|
|
898
|
+
// a push that brings the card ends the wait at any moment - a load that hangs never holds it up
|
|
899
|
+
let pushed = (): void => {}
|
|
900
|
+
const push = new Promise<true>((res) => { pushed = () => res(true) })
|
|
901
|
+
const un = q.subscribe(() => { if (held()) pushed() })
|
|
902
|
+
try {
|
|
903
|
+
const after = <T,>(ms: number, v: T) => new Promise<T>((res) => setTimeout(() => res(v), ms))
|
|
904
|
+
for (let wait = 2_000; !held(); wait = Math.min(wait * 2, 10_000)) {
|
|
905
|
+
// a refresh that hangs is given 10 s, then cancelled and the next one asked - it never stops the retries, and
|
|
906
|
+
// abandoned requests never pile up on the browser's connections. Only a refresh still unanswered at its 10 s is
|
|
907
|
+
// cancelled: one that answered, or that a push overtook, is left alone (it answers in a moment, and its view is
|
|
908
|
+
// applied only if newer than the push's). Cancelling those too (as each wait ended) reached whatever else on the
|
|
909
|
+
// page watches its requests - a browser extension's fetch hook - as a rejection it never handles, printed by Vite
|
|
910
|
+
// in the marver dev terminal on every E (29 Oct)
|
|
911
|
+
const ac = new AbortController()
|
|
912
|
+
const hang = setTimeout(() => ac.abort(), 10_000)
|
|
913
|
+
const answered = await Promise.race([q.getState().load({ signal: ac.signal }).finally(() => clearTimeout(hang)), push, after(10_000, false)])
|
|
914
|
+
if (answered) return
|
|
915
|
+
await Promise.race([push, after(wait, undefined)])
|
|
916
|
+
}
|
|
917
|
+
} finally { un() }
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
/** Was this capture (recording, sealing or not sent yet) stopped to review (⇧E, J)? E's never was. */
|
|
921
|
+
export function endedToReview(id: string): boolean {
|
|
922
|
+
const s = useJamCapture.getState()
|
|
923
|
+
return !!(s.caps[id]?.review ?? s.sealed.find((x) => x.id === id)?.review ?? pendingUploads.get(id)?.context.review)
|
|
856
924
|
}
|
|
857
925
|
|
|
858
926
|
/** A capture still recording, or finishing (its pictures and last words coming in), lives only in this page until it
|
|
859
927
|
* seals; a sealed one is kept in localStorage until it lands. Leaving the page asks first - unsaved.ts's one
|
|
860
928
|
* `beforeunload`, which hears this module's two reasons below - and if you leave anyway (`pagehide`: a close, a
|
|
861
929
|
* reload, a navigation, the back-forward cache alike), every capture not sealed yet is sealed at once, as it stood,
|
|
862
|
-
* for good: a missing step says so, the server keeps it as a draft
|
|
863
|
-
* yet - from the next page, or this one if it comes back. Carrying on
|
|
864
|
-
* or a killed process fires nothing. */
|
|
930
|
+
* for good: a missing step says so, the server keeps it as a draft (one already stopped with E is queued, as E does),
|
|
931
|
+
* and it goes out like any sealed record not sent yet - from the next page, or this one if it comes back. Carrying on
|
|
932
|
+
* is Resume, with a new id. Best effort: a crash or a killed process fires nothing. */
|
|
865
933
|
let guarded = false
|
|
866
934
|
function guardUnload() {
|
|
867
935
|
if (guarded || typeof window === 'undefined') return
|
|
@@ -884,7 +952,10 @@ export function sealOnLeave() {
|
|
|
884
952
|
// text written in the notes card and never added is the capture's last note, as at E
|
|
885
953
|
if (c.id === s.current && draft) steps.push({ at, event: 'note', text: draft })
|
|
886
954
|
steps.push({ at, event: 'missing', what: c.state === 'recording' ? 'the page closed while it recorded' : 'the page closed before it finished' })
|
|
887
|
-
|
|
955
|
+
// stopped with E and still finishing (its last words, its pictures): you sent it to work - it is queued as E does,
|
|
956
|
+
// the missing step saying what it lacks, never brought back as a draft to confirm. Recording, or stopped to
|
|
957
|
+
// review: a draft that waits for its read-back
|
|
958
|
+
records.push(buildRecord(c, steps, c.state === 'recording' || !!c.review))
|
|
888
959
|
timeCapture(c, true)
|
|
889
960
|
// its frames stop recording, its microphone is let go; a late picture or word finds nothing to change
|
|
890
961
|
broadcast({ type: 'sh:capture', id: c.id, on: false })
|
|
@@ -947,6 +1018,7 @@ export const useJamCapture = create<CaptureState>((set, get) => ({
|
|
|
947
1018
|
tick: 0,
|
|
948
1019
|
sealed: [],
|
|
949
1020
|
unsent: [],
|
|
1021
|
+
away: false,
|
|
950
1022
|
resuming: [],
|
|
951
1023
|
lastEnded: null,
|
|
952
1024
|
settling: null,
|
|
@@ -964,9 +1036,12 @@ export const useJamCapture = create<CaptureState>((set, get) => ({
|
|
|
964
1036
|
if (sessionEnding) { useStore.getState().toast('the session is being wrapped up - a moment'); return }
|
|
965
1037
|
begin(reviewing, undefined, session)
|
|
966
1038
|
},
|
|
967
|
-
end() {
|
|
1039
|
+
end(review = false) {
|
|
968
1040
|
const id = get().current
|
|
969
1041
|
if (!id) return
|
|
1042
|
+
// ⇧E: its record says so, and it waits for its read-back; E: the server makes its card queued - no read-back,
|
|
1043
|
+
// nothing opens or moves here
|
|
1044
|
+
if (review) mutate((st) => { const x = st.caps[id]; if (x) x.review = true })
|
|
970
1045
|
set({ current: null, lastEnded: id })
|
|
971
1046
|
cancelDwell()
|
|
972
1047
|
drain(id)
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* a read-back open ⏎ confirm · K keep · R resume (it ended too soon) · Esc drop
|
|
7
7
|
* the notes card open Esc closes the card · N puts the focus back in its field
|
|
8
|
-
* a capture open E end · S says to end it first · N notes card · I picture · Esc drop
|
|
8
|
+
* a capture open E end (queued at once) · ⇧E end to review · S says to end it first · N notes card · I picture · Esc drop
|
|
9
9
|
* a review open ⏎ looks good · ⇧⏎ more work · → later / next · ← back · B before/after ·
|
|
10
10
|
* ⌥← ⌥→ frame tabs · Esc leave
|
|
11
11
|
* the lane has the keys ← → move · ⏎ open · ⌘⏎ do next · K keep · ⌫ drop · Esc leave
|
|
@@ -179,12 +179,37 @@ export function openTile(id: string) {
|
|
|
179
179
|
reveal(c)
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
/** Open a card's thread - on another board, its link opens that board,
|
|
183
|
-
*
|
|
182
|
+
/** Open a card's thread where you can see it, as a notification does - on another board, its link opens that board,
|
|
183
|
+
* then the thread; on this one, its frame is brought into view (Comments.revealThread: since `E` moves nothing, the
|
|
184
|
+
* canvas is often far from it). The board's comments still loading: tried again for a few seconds. A thread this
|
|
185
|
+
* board cannot show (its frame is on no node here): the capture's own panel opens instead - for a card that asks,
|
|
186
|
+
* with its question and a field to answer it - so a click is never a no-op. */
|
|
184
187
|
export function openThread(c: JamCard) {
|
|
185
188
|
if (!c.thread) return
|
|
186
|
-
|
|
187
|
-
|
|
189
|
+
// on another board: its link opens that board (and the thread, when its frame is there) - then the same as here, so
|
|
190
|
+
// a thread that board cannot show still opens the capture's panel on the first click
|
|
191
|
+
const away = c.board !== useStore.getState().board
|
|
192
|
+
if (away) location.hash = `#/b/${encodeURIComponent(c.board)}?c=${encodeURIComponent(c.thread)}`
|
|
193
|
+
const thread = c.thread
|
|
194
|
+
void Promise.all([import('./Comments.tsx'), import('./comments-store.ts')]).then(async ([{ revealThread }, { useComments }]) => {
|
|
195
|
+
const until = performance.now() + (away ? 6_000 : 3_000)
|
|
196
|
+
for (;;) {
|
|
197
|
+
if (useStore.getState().board !== c.board) {
|
|
198
|
+
// still on its way there - or another board opened meanwhile: this one's thread is not there to open
|
|
199
|
+
if (!away || performance.now() > until) return
|
|
200
|
+
await new Promise((r) => setTimeout(r, 250))
|
|
201
|
+
continue
|
|
202
|
+
}
|
|
203
|
+
if (revealThread(thread)) return
|
|
204
|
+
// known, and still not shown: its frame is on no node of this board - no wait helps
|
|
205
|
+
if (useComments.getState().threads.some((t) => t.id === thread) || performance.now() > until) break
|
|
206
|
+
await new Promise((r) => setTimeout(r, 250))
|
|
207
|
+
}
|
|
208
|
+
if (useStore.getState().board !== c.board || c.kind !== 'capture') return
|
|
209
|
+
useJamUi.getState().select(c.id)
|
|
210
|
+
useJamUi.getState().open({ kind: 'capture', id: c.id })
|
|
211
|
+
reveal(c)
|
|
212
|
+
})
|
|
188
213
|
}
|
|
189
214
|
|
|
190
215
|
/** Bring a card's frames into view beside the panel - on its own board (a frame link lands there). */
|
|
@@ -273,7 +298,8 @@ const rows = (): Row[] => {
|
|
|
273
298
|
{ // a capture open
|
|
274
299
|
on: () => !!cap.current,
|
|
275
300
|
keys: {
|
|
276
|
-
e: () => cap.end(),
|
|
301
|
+
e: () => cap.end(), // straight to the queue
|
|
302
|
+
'Shift+e': () => cap.end(true), // stop to review: its read-back opens
|
|
277
303
|
s: () => cap.start(), // one at a time: it says to end this one first
|
|
278
304
|
// L: laser picks - a pick inside a capture is its pick (frames forward it while interacting)
|
|
279
305
|
// L: the pointer laser; ⌥L: inspect - a laser click inside a capture is its pick either way
|
|
@@ -13,7 +13,7 @@ import { useEffect, useLayoutEffect, useRef, useState } from 'react'
|
|
|
13
13
|
import { JamStateIcon, type JamGlyph } from './jam-ui.tsx'
|
|
14
14
|
import { Tip } from './Tip.tsx'
|
|
15
15
|
import { DONE_CLOSE, DONE_GROUP, doneFold, doneLine } from './jam-state.ts'
|
|
16
|
-
import { ArrowsInLineHorizontalIcon, CursorClickIcon, FileCodeIcon, ImagesSquareIcon, LaserIcon, MicrophoneIcon, MicrophoneSlashIcon, PencilSimpleIcon } from './icons.tsx'
|
|
16
|
+
import { ArrowsInLineHorizontalIcon, CursorClickIcon, FileCodeIcon, ImagesSquareIcon, LaserIcon, MicrophoneIcon, MicrophoneSlashIcon, PauseIcon, PencilSimpleIcon } from './icons.tsx'
|
|
17
17
|
|
|
18
18
|
/** The lane's height with its air: the 44 px tile + 12 px. While the lane shows, the sidebar stops
|
|
19
19
|
* above it and everything else on the bottom edge (the Update pill, toasts, notices) rises this much. */
|
|
@@ -26,6 +26,8 @@ export interface LaneTile {
|
|
|
26
26
|
title: string
|
|
27
27
|
/** the status line - jam-lines.ts `laneLine` */
|
|
28
28
|
line: string
|
|
29
|
+
/** a working tile's status line on hover: whose run it is (jam-lines.ts `laneTip`) */
|
|
30
|
+
tip?: string
|
|
29
31
|
/** an exclusive card wears a file glyph: it changes how the queue runs */
|
|
30
32
|
exclusive?: boolean
|
|
31
33
|
/** a done tile: the frames it changed (not the ones it left as they were) - the Done group counts each frame once */
|
|
@@ -56,6 +58,7 @@ export interface LaneRecording {
|
|
|
56
58
|
onMic?(): void
|
|
57
59
|
onNote(): void
|
|
58
60
|
onStop(): void
|
|
61
|
+
onStopReview(): void
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
/**
|
|
@@ -190,7 +193,7 @@ export function Lane({ tiles, recording, between, selected, keyboard, onOpen, on
|
|
|
190
193
|
<span className="tx">
|
|
191
194
|
{/* the whole title, in the shell's own tooltip - only when the tile cuts it short */}
|
|
192
195
|
<Tip label={<span className="jm-tip-title">{t.title}</span>} only={(el) => el.scrollWidth > el.clientWidth + 1}><span className="t">{t.title}</span></Tip>
|
|
193
|
-
<span className="m">{t.line}</span>
|
|
196
|
+
{t.tip ? <Tip label={<div className="sh-tip-lines">{t.tip}</div>}><span className="m">{t.line}</span></Tip> : <span className="m">{t.line}</span>}
|
|
194
197
|
</span>
|
|
195
198
|
{t.exclusive && <span className="x" aria-label="changes a shared file"><FileCodeIcon size={13} /></span>}
|
|
196
199
|
</button>
|
|
@@ -218,8 +221,9 @@ export function BetweenTile({ since, mic, onCapture }: LaneBetween) {
|
|
|
218
221
|
}
|
|
219
222
|
|
|
220
223
|
/** The capture recording now: a pulsing teal dot, "Capturing" and the timer over what it holds so far,
|
|
221
|
-
* then the Note button (N, with the count)
|
|
222
|
-
|
|
224
|
+
* then the Note button (N, with the count), Stop (E: queued at once) and Stop to review (⇧E, a pause icon: its read-back opens).
|
|
225
|
+
* After either it reads "Finishing". */
|
|
226
|
+
export function CaptureTile({ time, points, pictures = 0, picturesMax, steps, counts, notes, noteOn, finishing, mic, onMic, onNote, onStop, onStopReview }: LaneRecording) {
|
|
223
227
|
return (
|
|
224
228
|
<div className={`jm-chip${finishing ? ' finishing' : ''}`} data-tile="capturing">
|
|
225
229
|
{finishing ? <JamStateIcon state="confirming" /> : <i className="jm-live-dot" />}
|
|
@@ -243,7 +247,12 @@ export function CaptureTile({ time, points, pictures = 0, picturesMax, steps, co
|
|
|
243
247
|
<button className={`notebtn${noteOn ? ' on' : ''}`} onClick={onNote} disabled={finishing} aria-pressed={noteOn}>
|
|
244
248
|
<PencilSimpleIcon size={13} />Note{notes ? <b>{notes}</b> : null}<kbd>N</kbd>
|
|
245
249
|
</button>
|
|
246
|
-
<
|
|
250
|
+
<Tip label="Stop and queue it - the agent starts on it">
|
|
251
|
+
<button className="stop" onClick={onStop} disabled={finishing}>Stop<kbd>E</kbd></button>
|
|
252
|
+
</Tip>
|
|
253
|
+
<Tip label="Stop and look it over first - add notes, then queue it">
|
|
254
|
+
<button className="stop review" onClick={onStopReview} disabled={finishing}><PauseIcon size={12} />Stop to review<kbd>⇧E</kbd></button>
|
|
255
|
+
</Tip>
|
|
247
256
|
</div>
|
|
248
257
|
)
|
|
249
258
|
}
|