@marver-design/marver 0.25.1 → 0.26.1
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 +116 -0
- package/README.md +5 -3
- package/dist/{anchor-DVV732zR.mjs → anchor-5H1vnoLu.mjs} +6 -1
- package/dist/{anchor-check-DGZnYviN.mjs → anchor-check-l-ny3UzH.mjs} +1 -1
- package/dist/audio-Dw1lfMdb.mjs +443 -0
- package/dist/{auth-DdUKeVKt.mjs → auth-Dix8wrXV.mjs} +1 -1
- package/dist/{bake-BpxMZfij.mjs → bake-C-awKgLA.mjs} +1 -1
- package/dist/{boards-Csxj2WJn.mjs → boards-DYG22tOe.mjs} +2 -2
- package/dist/{build-DKaGhoVN.mjs → build-BDRiO_mP.mjs} +16 -9
- package/dist/capture-vadKjuCo.mjs +730 -0
- package/dist/cli.mjs +24 -18
- package/dist/{collab-gqNdScUE.mjs → collab-Dxg2trOK.mjs} +4 -3
- package/dist/{comments-Zoch254k.mjs → comments-0BSbb04K.mjs} +14 -3
- package/dist/{comments-pTLlhjh4.mjs → comments-BqXua-XL.mjs} +7 -7
- package/dist/{config-cKgZBRj0.mjs → config-Cf7EjAMf.mjs} +12 -1
- package/dist/{context-D2ugHqwO.mjs → context-HQ4Giw58.mjs} +1 -1
- package/dist/daemon-DL6Fwq6D.mjs +2569 -0
- package/dist/{dev-Diqx1Rt8.mjs → dev-Bw_qYWWq.mjs} +202 -18
- package/dist/dev-lock-DWSpa6nj.mjs +179 -0
- package/dist/{events-DnK_AnrW.mjs → events-CLH4ijKP.mjs} +14 -4
- package/dist/{init-DO4DhUt_.mjs → init-D8DtrK_F.mjs} +2 -2
- package/dist/{ledger-BNXW14Xw.mjs → ledger-D54iROST.mjs} +17 -1
- package/dist/{link-C-qUIuKU.mjs → link-BNzLvdhI.mjs} +2 -2
- package/dist/live-Cgzsicwi.mjs +4 -0
- package/dist/{manifest-DnAte_fB.mjs → manifest-Nl3KSVOk.mjs} +1 -1
- package/dist/{marks-koRsbHfe.mjs → marks-CKgzucHZ.mjs} +2 -2
- package/dist/{marks-DFuintmJ.mjs → marks-DyWMv_Z1.mjs} +23 -5
- package/dist/{marver-id-gate-DGANtVyC.mjs → marver-id-gate-BjF6v4bT.mjs} +4 -4
- package/dist/perf-C75MZ73h.mjs +167 -0
- package/dist/{perf-CCisg-ny.mjs → perf-DPbLGhhO.mjs} +1 -1
- package/dist/perf-jam-BU3TVrZu.mjs +239 -0
- package/dist/{plugin-dTF5reck.mjs → plugin-DkGmZs_r.mjs} +298 -38
- package/dist/{poster-D-zjYpgk.mjs → poster-BdtSKMDm.mjs} +2 -1
- package/dist/{profile-Do0nGkXO.mjs → profile-WU9qcbIo.mjs} +1 -1
- package/dist/{publish-bakes-C_9VZ-Mq.mjs → publish-bakes-9RzRToXV.mjs} +3 -3
- package/dist/queue-29ok5_eZ.mjs +1319 -0
- package/dist/reserve-BURNQ2Y3.mjs +53 -0
- package/dist/{rolldown-runtime-D7D4PA-g.mjs → rolldown-runtime-8H4AJuhK.mjs} +1 -0
- package/dist/{serve-wv2QWdxB.mjs → serve-C8rVheYk.mjs} +12 -12
- package/dist/session-BAaJsK5c.mjs +191 -0
- package/dist/{share-ScamJcks.mjs → share--oFJ1bCI.mjs} +2 -2
- package/dist/{shot-CUlmkqFX.mjs → shot-DQeR_Pfn.mjs} +339 -20
- package/dist/shot-XQV7HC9A.mjs +139 -0
- package/dist/speech-models-DomiLQcY.mjs +299 -0
- package/dist/speech-worker.mjs +354 -0
- package/dist/{summary-CrW88e3q.mjs → summary-Y8MY1Wuc.mjs} +2 -2
- package/dist/{sync-C3035OnJ.mjs → sync-DKk-yT1V.mjs} +9 -8
- package/dist/{work-GE88wb_3.mjs → work-F5u-twpJ.mjs} +28 -5
- package/dist/{work-CpJn1gwY.mjs → work-VvX_JIgl.mjs} +2 -2
- package/docs/jam-session.md +194 -0
- package/docs/live-jam.md +29 -3
- package/package.json +7 -1
- package/src/client/frame-host/bridge.js +20 -2
- package/src/client/frame-host/inspect.d.ts +4 -0
- package/src/client/frame-host/inspect.js +96 -6
- package/src/client/frame-host/keys.d.ts +6 -0
- package/src/client/frame-host/keys.js +59 -0
- package/src/client/frame-host/trail.d.ts +7 -0
- package/src/client/frame-host/trail.js +204 -0
- package/src/client/shell/App.tsx +52 -8
- package/src/client/shell/Comments.tsx +20 -6
- package/src/client/shell/JamSurface.tsx +346 -0
- package/src/client/shell/Play.tsx +32 -9
- package/src/client/shell/Tip.tsx +8 -3
- package/src/client/shell/Toolbar.tsx +5 -4
- package/src/client/shell/canvas/Canvas.tsx +12 -2
- package/src/client/shell/canvas/FrameNode.tsx +14 -4
- package/src/client/shell/comments-store.ts +23 -16
- package/src/client/shell/icons.tsx +17 -0
- package/src/client/shell/jam-capture.ts +1005 -0
- package/src/client/shell/jam-keys.ts +358 -0
- package/src/client/shell/jam-lane.tsx +249 -0
- package/src/client/shell/jam-lines.ts +115 -0
- package/src/client/shell/jam-panel.tsx +556 -0
- package/src/client/shell/jam-queue.ts +126 -0
- package/src/client/shell/jam-session.tsx +389 -0
- package/src/client/shell/jam-state.ts +103 -0
- package/src/client/shell/jam-surface-parts.tsx +106 -0
- package/src/client/shell/jam-ui.tsx +104 -0
- package/src/client/shell/jam-voice.ts +479 -0
- package/src/client/shell/sound.ts +22 -0
- package/src/client/shell/stage-size.ts +11 -0
- package/src/client/shell/store.ts +47 -17
- package/src/client/shell/styles.css +564 -2
- package/src/client/stage/main.tsx +18 -2
- package/src/shared/capture-frames.ts +41 -0
- package/src/shared/events.ts +19 -4
- package/src/shared/speech.ts +16 -0
- package/templates/AGENTS-embedded.md +10 -2
- package/templates/AGENTS-studio.md +10 -2
- package/templates/instructions/iterate.md +8 -6
- package/templates/instructions/jam.md +131 -59
- package/dist/daemon-Cl8KXGW4.mjs +0 -1523
- package/dist/perf-QJIWtTw1.mjs +0 -68
- package/dist/shot-jdO_B6Qw.mjs +0 -86
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The adapters between Jam's stores (JamSurface.tsx) and its presentational pieces (jam-lane.tsx,
|
|
3
|
+
* jam-panel.tsx): the lane row with the notes card floating over the capture tile, and the focus
|
|
4
|
+
* panel showing a capture's detail (a draft's read-back) or a review.
|
|
5
|
+
*/
|
|
6
|
+
import { useEffect, useState } from 'react'
|
|
7
|
+
import { Lane, type LaneBetween, type LaneRecording, type LaneTile } from './jam-lane.tsx'
|
|
8
|
+
import { Caption, FocusPanel, NotesCard, ReadBack, ReviewDetail, VoiceAsk } from './jam-panel.tsx'
|
|
9
|
+
import type { TimelineLine } from './jam-lines.ts'
|
|
10
|
+
import type { JamCard } from './jam-queue.ts'
|
|
11
|
+
|
|
12
|
+
export function CaptureLaneRow({ tiles, recording, between, selected, keyboard, followEnd, onOpen, onMenu, notes, ask, caption, doneOpen, onDoneOpen }: {
|
|
13
|
+
tiles: LaneTile[]; recording?: LaneRecording; between?: LaneBetween; selected?: string; keyboard?: boolean; followEnd?: number; onOpen(id: string): void
|
|
14
|
+
doneOpen?: boolean; onDoneOpen?(open: boolean, doneIds: string[]): void
|
|
15
|
+
onMenu?(e: React.MouseEvent, id: string): void
|
|
16
|
+
notes?: { notes: { t: string; text: string }[]; draft: string; onDraft(t: string): void; onAdd(): void; onClose(): void }
|
|
17
|
+
/** the microphone question (and the model's download), over the capture tile */
|
|
18
|
+
ask?: Parameters<typeof VoiceAsk>[0]
|
|
19
|
+
/** the words heard so far: the earlier ones and the newest phrase */
|
|
20
|
+
caption?: { old: string; live: string }
|
|
21
|
+
}) {
|
|
22
|
+
// the notes card floats one lane up over the capture tile, left edges aligned, clamped on screen
|
|
23
|
+
const [at, setAt] = useState<{ left: number } | null>(null)
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (!notes && !ask && !caption) return
|
|
26
|
+
const place = () => {
|
|
27
|
+
const tile = document.querySelector('.jm-lane .jm-chip, .jm-lane [data-jam-recording]') as HTMLElement | null
|
|
28
|
+
const r = tile?.getBoundingClientRect()
|
|
29
|
+
setAt(r ? { left: Math.max(10, Math.min(r.left, window.innerWidth - 340)) } : { left: 10 })
|
|
30
|
+
}
|
|
31
|
+
place()
|
|
32
|
+
window.addEventListener('resize', place)
|
|
33
|
+
return () => window.removeEventListener('resize', place)
|
|
34
|
+
}, [!!notes, !!ask, !!caption, tiles.length])
|
|
35
|
+
const words = !!caption && !!(caption.old || caption.live)
|
|
36
|
+
const roomLeft = (at?.left ?? 10) - 8 >= 300
|
|
37
|
+
return (
|
|
38
|
+
<>
|
|
39
|
+
<Lane tiles={tiles} recording={recording} between={between} selected={selected} keyboard={keyboard} followEnd={followEnd} onOpen={onOpen} onMenu={onMenu} doneOpen={doneOpen} onDoneOpen={onDoneOpen} />
|
|
40
|
+
{/* one lane up, over the capture tile: the question, then the notes card above it; the words just
|
|
41
|
+
left of the notes card (bottoms aligned), or over the tile when it is closed */}
|
|
42
|
+
{(notes || ask) && (
|
|
43
|
+
<div className="jm-over" style={{ position: 'absolute', left: at?.left ?? 10, bottom: 'calc(var(--edge) + 56px + 8px)', zIndex: 41, display: 'flex', flexDirection: 'column-reverse', gap: 8, alignItems: 'flex-start' }}>
|
|
44
|
+
{ask && <VoiceAsk {...ask} />}
|
|
45
|
+
{notes && <NotesCard {...notes} />}
|
|
46
|
+
{/* no room to its left (the tile near the window's left edge): the words go on top */}
|
|
47
|
+
{words && !roomLeft && <Caption old={caption!.old} live={caption!.live} />}
|
|
48
|
+
</div>
|
|
49
|
+
)}
|
|
50
|
+
{words && (!(notes || ask) || roomLeft) && (
|
|
51
|
+
<Caption old={caption!.old} live={caption!.live} style={notes || ask
|
|
52
|
+
? { position: 'absolute', right: `calc(100% - ${(at?.left ?? 10) - 8}px)`, bottom: 'calc(var(--edge) + 56px + 8px)', zIndex: 41 }
|
|
53
|
+
: { position: 'absolute', left: at?.left ?? 10, bottom: 'calc(var(--edge) + 56px + 8px)', zIndex: 41 }} />
|
|
54
|
+
)}
|
|
55
|
+
</>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function FocusPanelView(p: {
|
|
60
|
+
left: number; kind: 'capture' | 'review' | 'wrapup'; card: JamCard; of: [number, number] | undefined; agent: string; reviewedTitle?: string
|
|
61
|
+
lines: TimelineLine[]; pictures: { id: string; url: string; caption: string }[]
|
|
62
|
+
shots: { frame: string; before?: string; after?: string; new?: boolean }[]; reply: string
|
|
63
|
+
view: 'both' | 'before' | 'after'; tab: number; moreOpen: boolean
|
|
64
|
+
onTab(i: number): void; onFlip(view: 'both' | 'before' | 'after'): void; onMoreOpen(on: boolean): void; onClose(): void
|
|
65
|
+
onEdit(text: string): void; onConfirm(): void; onKeep(): void; onDrop(): void; onResume?: () => void
|
|
66
|
+
onGood(): void; onMore(text: string): void; onLater(): void; onOpenThread(): void
|
|
67
|
+
onPrev?: () => void; onNext?: () => void; pending?: string; onRetry?: () => void; locked?: boolean
|
|
68
|
+
/** a note added in the read-back (a draft) */
|
|
69
|
+
onAddNote?(text: string, id: string): Promise<boolean>
|
|
70
|
+
}) {
|
|
71
|
+
const c = p.card
|
|
72
|
+
const title = c.title ?? 'Capture'
|
|
73
|
+
// a capture under review: its review, or the capture itself as it was read back (its pictures, its timeline)
|
|
74
|
+
const [pane, setPane] = useState<'review' | 'capture'>('review')
|
|
75
|
+
useEffect(() => { setPane('review') }, [c.id])
|
|
76
|
+
// the review asks for the width its pictures need (both at once, as big as the panel's height allows)
|
|
77
|
+
const [fit, setFit] = useState<number | undefined>(undefined)
|
|
78
|
+
useEffect(() => { setFit(undefined) }, [c.id])
|
|
79
|
+
const head = p.kind === 'review' ? (
|
|
80
|
+
<div className="jm-ftabs jm-panes" role="tablist" data-jam-panes="">
|
|
81
|
+
{(['review', 'capture'] as const).map((v) => <button key={v} role="tab" aria-selected={v === pane} className={v === pane ? 'on' : undefined} onClick={() => setPane(v)}>{v === 'review' ? 'Review' : 'Capture'}</button>)}
|
|
82
|
+
</div>
|
|
83
|
+
) : undefined
|
|
84
|
+
// points are picks and clicks (a picture line carries its own number, not a point)
|
|
85
|
+
const points = p.lines.filter((l) => l.point != null && (l.kind === 'pick' || l.kind === 'click')).length
|
|
86
|
+
const notes = p.lines.filter((l) => l.kind === 'note').length
|
|
87
|
+
const meta = [p.lines.length ? p.lines[p.lines.length - 1].t : '0:00', `${c.frames.length} frame${c.frames.length === 1 ? '' : 's'}`,
|
|
88
|
+
points ? `${points} point${points === 1 ? '' : 's'}` : '', p.pictures.length ? `${p.pictures.length} picture${p.pictures.length === 1 ? '' : 's'}` : '',
|
|
89
|
+
notes ? `${notes} note${notes === 1 ? '' : 's'}` : ''].filter(Boolean)
|
|
90
|
+
return (
|
|
91
|
+
<FocusPanel left={p.left} onClose={p.onClose} width={p.kind === 'review' && pane === 'review' ? fit : undefined}>
|
|
92
|
+
{p.kind === 'review' && pane === 'review' ? (
|
|
93
|
+
<ReviewDetail key={c.id} title={title} head={head} of={p.of} onPrev={p.onPrev} onNext={p.onNext} frames={p.shots.map((s) => s.frame)} active={p.tab} onTab={p.onTab}
|
|
94
|
+
view={p.view} onFlip={(v) => p.onFlip(v)} onFit={setFit} reply={p.reply} shots={p.shots} agent={p.agent}
|
|
95
|
+
more={p.moreOpen} draftKey={c.id} onMore={p.onMore} onMoreOpen={p.onMoreOpen} onGood={p.onGood} onLater={p.onLater} onOpenThread={p.onOpenThread} />
|
|
96
|
+
) : (
|
|
97
|
+
<ReadBack key={c.id} title={title} head={head} of={p.of} onPrev={p.onPrev} onNext={p.onNext} meta={meta} lines={p.lines} pictures={p.pictures} edited={c.edited} pending={p.pending}
|
|
98
|
+
added={c.added} onAddNote={c.state === 'draft' ? p.onAddNote : undefined} autoNamed={!!c.name && !c.named && title === c.name}
|
|
99
|
+
readOnly={c.state !== 'draft'} locked={p.locked} agent={p.agent}
|
|
100
|
+
follows={c.reviewing ? p.reviewedTitle ?? 'the review on screen' : undefined}
|
|
101
|
+
onEdit={p.onEdit} onConfirm={p.onConfirm} onKeep={p.onKeep} onDrop={p.onDrop} onResume={c.state === 'draft' ? p.onResume : undefined} onOpenThread={c.thread ? p.onOpenThread : undefined}
|
|
102
|
+
onRetry={c.state === 'failed' ? p.onRetry : undefined} />
|
|
103
|
+
)}
|
|
104
|
+
</FocusPanel>
|
|
105
|
+
)
|
|
106
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Jam V2 in the shell (spec 27): the state glyphs and the status icon by a tag's time.
|
|
3
|
+
*
|
|
4
|
+
* A thread shows where work stands as one icon right of the message's time - on a tag (the last of
|
|
5
|
+
* joined tags) - only while there is something to wait for or act on: queued, working, asks or
|
|
6
|
+
* failed. Hovering it shows the detail in the inverse theme (the house Tip); clicking it keeps that
|
|
7
|
+
* open with the card's one move - Drop while queued, Retry when failed. Replied, answered, done or
|
|
8
|
+
* dropped: no icon - Marver's reply under it says it.
|
|
9
|
+
*/
|
|
10
|
+
import { useEffect, useId, useLayoutEffect, useRef, useState, type ReactNode } from 'react'
|
|
11
|
+
import { Tip } from './Tip.tsx'
|
|
12
|
+
import { cardForEvent, useJamQueue, type JamCardState } from './jam-queue.ts'
|
|
13
|
+
import { statusLines } from './jam-lines.ts'
|
|
14
|
+
|
|
15
|
+
const GRAY = 'var(--glass-ink-3)'
|
|
16
|
+
const RED = '#e5484d' // board-icons.tsx RED - errors and failures only
|
|
17
|
+
const TEAL = '#00c3d0' // recording: Apple system teal - red is for errors
|
|
18
|
+
const BLUE = 'var(--mv-blue, #0088ff)'
|
|
19
|
+
const ASK = 'var(--mk-ask)'
|
|
20
|
+
const NEW = 'var(--mk-new)'
|
|
21
|
+
const GREEN = 'var(--status-done, #34c759)'
|
|
22
|
+
|
|
23
|
+
export type JamGlyph = JamCardState | 'capturing'
|
|
24
|
+
|
|
25
|
+
/** One glyph per state, spec 25's icons: ◷ queued · ◐ working · ? asks · ◉ to review (a blue disc
|
|
26
|
+
* with an eye - a ring and dot read as a recorder) · ✓ done · – kept · ✕ failed. */
|
|
27
|
+
export function JamStateIcon({ state, size = 14 }: { state: JamGlyph; size?: number }) {
|
|
28
|
+
const ring = (c: string, dash?: string, op?: number) => <circle cx="7" cy="7" r="5.8" fill="none" stroke={c} strokeWidth="1.5" strokeDasharray={dash} opacity={op} />
|
|
29
|
+
const line = { fill: 'none', strokeWidth: 1.4, strokeLinecap: 'round', strokeLinejoin: 'round' } as const
|
|
30
|
+
const cut = `jm-st-${useId().replace(/[^\w-]/g, '')}`
|
|
31
|
+
/** a filled disc with `mark` cut out of it */
|
|
32
|
+
const disc = (c: string, mark: ReactNode) => (<>
|
|
33
|
+
<mask id={cut}><rect width="14" height="14" fill="#fff" /><g stroke="#000" fill="none" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round">{mark}</g></mask>
|
|
34
|
+
<circle cx="7" cy="7" r="6.5" fill={c} mask={`url(#${cut})`} />
|
|
35
|
+
</>)
|
|
36
|
+
return (
|
|
37
|
+
<svg width={size} height={size} viewBox="0 0 14 14" aria-hidden data-jam-state={state} className={`jm-st jm-st-${state}`}>
|
|
38
|
+
{state === 'capturing' && disc(TEAL, <path d="M4.7 6 V8 M7 4.4 V9.6 M9.3 6 V8" />)}
|
|
39
|
+
{state === 'draft' && (<>{ring(ASK)}<circle cx="7" cy="7" r="1.9" fill={ASK} /></>)}
|
|
40
|
+
{state === 'confirming' && (<>{ring(BLUE, undefined, .28)}<path d="M7 1.2 A5.8 5.8 0 0 1 12.8 7" stroke={BLUE} {...line} strokeWidth={1.5} className="jm-spin" /></>)}
|
|
41
|
+
{state === 'queued' && (<>{ring(GRAY)}<path d="M7 4.1 V7 L9 8.3" stroke={GRAY} {...line} strokeWidth={1.3} /></>)}
|
|
42
|
+
{state === 'working' && (<>{ring(BLUE, undefined, .28)}<path d="M7 1.2 A5.8 5.8 0 1 1 1.2 7" stroke={BLUE} {...line} strokeWidth={1.5} className="jm-spin" /></>)}
|
|
43
|
+
{state === 'asks' && disc(ASK, <><path d="M5.3 5.5 A1.75 1.75 0 1 1 7.6 7.1 C7.15 7.3 7 7.6 7 8.05" /><path d="M7 10.05 V10.1" strokeWidth="1.9" /></>)}
|
|
44
|
+
{state === 'review' && disc(NEW, <><path d="M3.4 7 C4.5 5.15 5.7 4.35 7 4.35 C8.3 4.35 9.5 5.15 10.6 7 C9.5 8.85 8.3 9.65 7 9.65 C5.7 9.65 4.5 8.85 3.4 7 Z" /><circle cx="7" cy="7" r="0.9" /></>)}
|
|
45
|
+
{state === 'done' && disc(GREEN, <path d="M4.3 7.2 L6.2 9.1 L9.8 5.2" />)}
|
|
46
|
+
{state === 'kept' && disc(GRAY, <path d="M4.6 7 H9.4" />)}
|
|
47
|
+
{state === 'failed' && disc(RED, <path d="M5 5 L9 9 M9 5 L5 9" />)}
|
|
48
|
+
{state === 'dropped' && (<>{ring(GRAY, '1.3 1.75')}<path d="M4.4 9.6 L9.6 4.4" stroke={GRAY} {...line} strokeWidth={1.3} /></>)}
|
|
49
|
+
</svg>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** The status icon right of a tag message's time. Nothing when the message carries no pending card
|
|
54
|
+
* (or this canvas has no queue - opened elsewhere, published). */
|
|
55
|
+
export function TagStatus({ board, eventId, harness }: { board?: string; eventId?: string; harness: Record<string, string> }) {
|
|
56
|
+
const card = useJamQueue((s) => cardForEvent(s.cards, board, eventId))
|
|
57
|
+
const agent = useJamQueue((s) => s.agent)
|
|
58
|
+
const [open, setOpen] = useState(false)
|
|
59
|
+
const [, tick] = useState(0)
|
|
60
|
+
const ref = useRef<HTMLSpanElement>(null)
|
|
61
|
+
// the working clock moves while it shows
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (card?.state !== 'working') return
|
|
64
|
+
const t = setInterval(() => tick((n) => n + 1), 1000)
|
|
65
|
+
return () => clearInterval(t)
|
|
66
|
+
}, [card?.state])
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
if (!open) return
|
|
69
|
+
const away = (e: PointerEvent) => { if (!ref.current?.contains(e.target as Node)) setOpen(false) }
|
|
70
|
+
window.addEventListener('pointerdown', away, true)
|
|
71
|
+
return () => window.removeEventListener('pointerdown', away, true)
|
|
72
|
+
}, [open])
|
|
73
|
+
useEffect(() => { if (!card) setOpen(false) }, [card])
|
|
74
|
+
// the open detail stays on screen: it sits under the icon and slides left at the viewport's edge
|
|
75
|
+
const popRef = useRef<HTMLSpanElement>(null)
|
|
76
|
+
useLayoutEffect(() => {
|
|
77
|
+
const el = popRef.current
|
|
78
|
+
if (!el) return
|
|
79
|
+
el.style.marginLeft = '0px'
|
|
80
|
+
const over = el.getBoundingClientRect().right - (window.innerWidth - 8)
|
|
81
|
+
if (over > 0) el.style.marginLeft = `${-over}px`
|
|
82
|
+
}, [open, card?.state, card?.note])
|
|
83
|
+
if (!card) return null
|
|
84
|
+
const { head, detail } = statusLines(card, agent, harness)
|
|
85
|
+
const move = card.state === 'queued' ? 'drop' : card.state === 'failed' ? 'retry' : null
|
|
86
|
+
const lines = <span className="sh-tip-lines"><b>{head}</b>{detail && <small>{detail}</small>}</span>
|
|
87
|
+
return (
|
|
88
|
+
<span className={`cm-tstat${open ? ' on' : ''}`} ref={ref} data-jam-card={card.id} data-jam-state={card.state}>
|
|
89
|
+
{open ? (
|
|
90
|
+
<button className="cm-tstat-btn" aria-expanded aria-label={head} onClick={() => setOpen(false)}><JamStateIcon state={card.state} size={13} /></button>
|
|
91
|
+
) : (
|
|
92
|
+
<Tip side="top" label={lines}>
|
|
93
|
+
<button className="cm-tstat-btn" aria-label={head} onClick={() => setOpen(true)}><JamStateIcon state={card.state} size={13} /></button>
|
|
94
|
+
</Tip>
|
|
95
|
+
)}
|
|
96
|
+
{open && (
|
|
97
|
+
<span className="cm-tstat-pop" role="dialog" aria-label={head} ref={popRef}>
|
|
98
|
+
{lines}
|
|
99
|
+
{move && <button className="cm-tstat-act" onClick={() => { void useJamQueue.getState().act(card, move); setOpen(false) }}>{move === 'drop' ? 'Drop' : 'Retry'}</button>}
|
|
100
|
+
</span>
|
|
101
|
+
)}
|
|
102
|
+
</span>
|
|
103
|
+
)
|
|
104
|
+
}
|