@lincyaw/workbench 0.2.0-rc.11 → 0.2.0-rc.111
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 +5 -4
- package/src/AgentActivityBar.tsx +25 -0
- package/src/MediaClipEditor.tsx +4 -3
- package/src/StepProductionEditor.tsx +13 -4
- package/src/agent-activity-messages.ts +14 -0
- package/src/agent-activity.ts +38 -0
- package/src/approvals.tsx +6 -1
- package/src/audio-recording-messages.ts +5 -5
- package/src/audio-recording.ts +27 -5
- package/src/authoring-client.ts +10 -10
- package/src/authoring-draft-fragment.ts +3 -1
- package/src/authoring-window.ts +100 -0
- package/src/base-controls.tsx +2 -2
- package/src/body-draft-actions.ts +60 -0
- package/src/caption-timing-drafts.ts +18 -1
- package/src/caption-timing-messages.ts +2 -2
- package/src/component-property-drafts.ts +5 -5
- package/src/components.tsx +34 -36
- package/src/container-layout.ts +21 -0
- package/src/context.tsx +5 -3
- package/src/diagnostics.ts +1 -1
- package/src/document-draft-store.ts +45 -18
- package/src/document-drafts.ts +28 -19
- package/src/document-editing.ts +484 -0
- package/src/document-editor/BlockNoteSurface.tsx +39 -13
- package/src/document-editor/CommentComposer.tsx +24 -0
- package/src/document-editor/ComponentMaterials.tsx +3 -9
- package/src/document-editor/ComponentPropertiesDialog.tsx +4 -4
- package/src/document-editor/DocumentBlockPreview.tsx +11 -4
- package/src/document-editor/DocumentComments.tsx +85 -14
- package/src/document-editor/DocumentEditor.tsx +56 -7
- package/src/document-editor/DocumentStepNarration.tsx +37 -26
- package/src/document-editor/NarrationEditor.tsx +54 -20
- package/src/document-editor/NewCommentDrafts.tsx +120 -37
- package/src/document-editor/PlaceComment.tsx +252 -0
- package/src/document-editor/agent-targets.ts +34 -0
- package/src/document-editor/blocknote-messages.ts +2 -0
- package/src/document-editor/comment-draft-actions.ts +40 -20
- package/src/document-editor/comment-draft-inspection.ts +2 -2
- package/src/document-editor/comment-drafts.ts +73 -25
- package/src/document-editor/comments.ts +30 -10
- package/src/document-editor/component-label.ts +11 -0
- package/src/document-editor/file-input.ts +2 -2
- package/src/document-editor/focus.ts +0 -2
- package/src/document-editor/insertion-place.ts +60 -0
- package/src/document-editor/messages.ts +3 -3
- package/src/document-editor/narration-schema.tsx +12 -6
- package/src/document-editor/narration.ts +19 -3
- package/src/document-editor/page-body.ts +60 -0
- package/src/document-editor/popover.tsx +4 -2
- package/src/document-editor/projection.ts +2 -2
- package/src/document-editor/rich-text.ts +3 -2
- package/src/document-editor/selection.ts +13 -0
- package/src/document-editor/style.css +7 -1
- package/src/document-editor/table-identities.ts +2 -1
- package/src/document-production.ts +491 -0
- package/src/document-session.ts +202 -56
- package/src/document-timing-drafts.ts +22 -2
- package/src/history.ts +5 -5
- package/src/index.ts +11 -5
- package/src/jobs.ts +1 -1
- package/src/mcp-settings-messages.ts +39 -0
- package/src/media-drafts.ts +43 -1
- package/src/messages.ts +33 -16
- package/src/panels/DocumentNarrationPanel.tsx +2 -2
- package/src/panels/DocumentView.tsx +97 -65
- package/src/panels/DocumentVoiceDialog.tsx +25 -9
- package/src/panels/DocumentVoiceField.tsx +1 -1
- package/src/panels/ExportPanel.tsx +2 -10
- package/src/panels/HistoryPanel.tsx +34 -7
- package/src/panels/HomePanel.tsx +3 -1
- package/src/panels/McpSettingsPanel.tsx +86 -0
- package/src/panels/PageDeleteDialog.tsx +4 -4
- package/src/panels/PageRenameDialog.tsx +1 -1
- package/src/panels/PreviewPanel.tsx +1 -4
- package/src/panels/ProductionCaptionSize.tsx +20 -0
- package/src/panels/ProductionCaptionTiming.tsx +12 -9
- package/src/panels/ProductionMediaClips.tsx +23 -7
- package/src/panels/ProductionPanel.tsx +16 -13
- package/src/panels/ProductionRecording.tsx +86 -9
- package/src/panels/ProductionRecordingRange.tsx +21 -19
- package/src/panels/ProductionTimeline.tsx +6 -1
- package/src/panels/ProductionTranscription.tsx +5 -4
- package/src/panels/SourceDocumentPanel.tsx +18 -36
- package/src/panels/SpeechSettingsPanel.tsx +1 -1
- package/src/panels/TranscriptionAdoption.tsx +40 -34
- package/src/panels/VoiceCloneDialog.tsx +2 -1
- package/src/panels/VoiceoverDialog.tsx +1 -1
- package/src/places.ts +1 -36
- package/src/preview-playback.ts +1 -1
- package/src/production-draft-actions.ts +37 -0
- package/src/production-messages.ts +6 -0
- package/src/production-playback.ts +1 -1
- package/src/production-voice-playback.ts +3 -2
- package/src/sha256.ts +9 -0
- package/src/speech-settings-messages.ts +5 -5
- package/src/styles.css +43 -79
- package/src/transcription-drafts.ts +124 -0
- package/src/use-recording-adoption.ts +2 -2
- package/src/voice-drafts.ts +32 -8
- package/src/voice-messages.ts +9 -9
- package/src/voiceover-jobs.ts +1 -1
- package/src/workbench-state.ts +159 -0
- package/src/workbench.ts +303 -952
- package/src/workspace-client.ts +30 -11
- package/src/assistant-mascot.ts +0 -62
- package/src/mascot-preference.ts +0 -37
- package/src/panels/ChangeTrail.tsx +0 -79
package/src/panels/HomePanel.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useEffect, useRef, useState } from 'react'
|
|
2
|
+
import type { ReactNode } from 'react'
|
|
2
3
|
import { errorMessage } from '@lincyaw/kernel'
|
|
3
4
|
import type { DocumentSummary, ProjectPlan } from '@lincyaw/kernel'
|
|
4
5
|
import { PmButton, PmDialog, PmEmpty, PmInput, PmSelect, PmIcon, PmMenu, PmNotice } from '../components.tsx'
|
|
@@ -10,7 +11,7 @@ type Editing =
|
|
|
10
11
|
| { op: 'rename' | 'delete', doc: DocumentSummary }
|
|
11
12
|
|
|
12
13
|
/** The documents of the workspace: open one, make a new one, rename, copy or delete one. */
|
|
13
|
-
export function HomePanel() {
|
|
14
|
+
export function HomePanel({ actions }: { actions?: ReactNode } = {}) {
|
|
14
15
|
const t = useMessages()
|
|
15
16
|
const workbench = useWorkbench()
|
|
16
17
|
const answer = useWorkbenchState(state => state.documents)
|
|
@@ -46,6 +47,7 @@ export function HomePanel() {
|
|
|
46
47
|
<section className="pmw-home" aria-labelledby="pmw-home-title">
|
|
47
48
|
<header className="pmw-home__bar">
|
|
48
49
|
<h1 id="pmw-home-title" className="pmw-home__title">{answer?.title ?? t.documents}</h1>
|
|
50
|
+
{actions}
|
|
49
51
|
{operable && <PmButton variant="primary" icon="plus" disabled={working} onClick={() => { handingOff.current = false; setError(undefined); setEditing({ op: 'create' }) }}>{t.newDocument}</PmButton>}
|
|
50
52
|
</header>
|
|
51
53
|
{failure && <PmNotice tone="danger">{bundleDisabled ? t.bundleDisabled : failure}</PmNotice>}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react'
|
|
2
|
+
import type { McpConnectionSettings } from '@lincyaw/kernel'
|
|
3
|
+
import { PmButton, PmCard, PmInput, PmNotice, PmPanelHeader, PmSelect, PmTextarea } from '../components.tsx'
|
|
4
|
+
import { useWorkbench, useWorkbenchState } from '../context.tsx'
|
|
5
|
+
import { MCP_SETTINGS_MESSAGES } from '../mcp-settings-messages.ts'
|
|
6
|
+
import { WorkspaceServerError } from '../workspace-client.ts'
|
|
7
|
+
|
|
8
|
+
export function McpSettingsPanel() {
|
|
9
|
+
const workbench = useWorkbench(), locale = useWorkbenchState(state => state.locale), t = MCP_SETTINGS_MESSAGES[locale]
|
|
10
|
+
const [settings, setSettings] = useState<McpConnectionSettings>(), [transport, setTransport] = useState<'stdio' | 'http'>('stdio'), [port, setPort] = useState('0')
|
|
11
|
+
const [busy, setBusy] = useState(false), [failure, setFailure] = useState<string>(), [status, setStatus] = useState<string>(), [output, setOutput] = useState('')
|
|
12
|
+
const owner = useRef(true), request = useRef<AbortController>()
|
|
13
|
+
const accept = (value: McpConnectionSettings) => { setSettings(value); setTransport(value.transport); setPort(String(value.port)); setOutput('') }
|
|
14
|
+
const load = async () => {
|
|
15
|
+
request.current?.abort(); const controller = new AbortController(); request.current = controller
|
|
16
|
+
setBusy(true); setFailure(undefined); setStatus(undefined)
|
|
17
|
+
try {
|
|
18
|
+
if (!workbench.client.readMcpSettings) throw new Error('unsupported')
|
|
19
|
+
const value = await workbench.client.readMcpSettings(controller.signal)
|
|
20
|
+
if (owner.current && !controller.signal.aborted) accept(value)
|
|
21
|
+
} catch (error) {
|
|
22
|
+
if (owner.current && !controller.signal.aborted) setFailure(error instanceof WorkspaceServerError && error.status === 404 ? t.outdatedService : t.unavailable)
|
|
23
|
+
}
|
|
24
|
+
finally { if (owner.current && !controller.signal.aborted) setBusy(false) }
|
|
25
|
+
}
|
|
26
|
+
useEffect(() => { owner.current = true; void load(); return () => { owner.current = false; request.current?.abort() } }, [workbench])
|
|
27
|
+
const dirty = settings && (transport !== settings.transport || Number(port) !== settings.port)
|
|
28
|
+
const valid = /^\d+$/.test(port) && Number(port) <= 65535
|
|
29
|
+
const save = async () => {
|
|
30
|
+
if (!settings || !valid || !workbench.client.changeMcpSettings) return
|
|
31
|
+
request.current?.abort(); const controller = new AbortController(); request.current = controller
|
|
32
|
+
setBusy(true); setFailure(undefined); setStatus(undefined); setOutput('')
|
|
33
|
+
try {
|
|
34
|
+
const value = await workbench.client.changeMcpSettings({ revision: settings.revision, transport, port: Number(port) }, controller.signal)
|
|
35
|
+
if (owner.current && !controller.signal.aborted) { accept(value); setStatus(t.saved) }
|
|
36
|
+
} catch (error) {
|
|
37
|
+
if (owner.current && !controller.signal.aborted) {
|
|
38
|
+
const code = error instanceof WorkspaceServerError ? error.answer.error : undefined
|
|
39
|
+
setFailure(code === 'mcp-port-unavailable' ? t.portBusy : code === 'mcp-settings-conflict' ? t.conflict : t.failed)
|
|
40
|
+
}
|
|
41
|
+
} finally { if (owner.current && !controller.signal.aborted) setBusy(false) }
|
|
42
|
+
}
|
|
43
|
+
const copy = async (prompt: boolean) => {
|
|
44
|
+
if (!settings || dirty || !workbench.client.exportMcpSettings || !workbench.client.readMcpSettings) return
|
|
45
|
+
setBusy(true); setFailure(undefined); setStatus(undefined)
|
|
46
|
+
request.current?.abort(); const controller = new AbortController(); request.current = controller
|
|
47
|
+
try {
|
|
48
|
+
const fresh = await workbench.client.readMcpSettings(controller.signal)
|
|
49
|
+
if (!owner.current || controller.signal.aborted) return
|
|
50
|
+
accept(fresh)
|
|
51
|
+
const content = prompt ? t.prompt.replace('{root}', fresh.root) + '\n\n' + (fresh.transport === 'stdio'
|
|
52
|
+
? JSON.stringify({ mcpServers: { presmium: fresh.stdio } }, null, 2)
|
|
53
|
+
: t.httpPrompt.replace('{url}', fresh.url ?? '').replace('{stateFile}', fresh.stateFile))
|
|
54
|
+
: JSON.stringify(await workbench.client.exportMcpSettings(fresh.revision, controller.signal), null, 2)
|
|
55
|
+
if (!owner.current || controller.signal.aborted) return
|
|
56
|
+
setOutput(content)
|
|
57
|
+
try { await navigator.clipboard.writeText(content); if (owner.current) setStatus(t.copied) }
|
|
58
|
+
catch { if (owner.current) setStatus(t.manualCopy) }
|
|
59
|
+
} catch (error) { if (owner.current && !controller.signal.aborted) setFailure(error instanceof WorkspaceServerError && error.answer.error === 'mcp-settings-conflict' ? t.conflict : t.failed) }
|
|
60
|
+
finally { if (owner.current && !controller.signal.aborted) setBusy(false) }
|
|
61
|
+
}
|
|
62
|
+
const ready = settings && !dirty && (settings.transport === 'stdio' ? settings.stdio : settings.url)
|
|
63
|
+
return <section className="pmw-speech-settings pm-ui" aria-label={t.title}>
|
|
64
|
+
<PmPanelHeader title={t.title} />
|
|
65
|
+
<div className="pmw-speech-settings__content">
|
|
66
|
+
<p>{t.description}</p>
|
|
67
|
+
{!settings && busy && <PmNotice>{t.loading}</PmNotice>}
|
|
68
|
+
{failure && <PmNotice tone="danger">{failure} <PmButton small disabled={busy} onClick={() => void load()}>{t.retry}</PmButton></PmNotice>}
|
|
69
|
+
{status && <PmNotice tone="accent">{status}</PmNotice>}
|
|
70
|
+
{settings && <PmCard><div className="pmw-speech-settings__fields">
|
|
71
|
+
<PmSelect label={t.transport} hint={transport === 'stdio' ? t.stdioHint : t.httpHint} value={transport} disabled={busy} onChange={event => { setTransport(event.target.value as 'stdio' | 'http'); setStatus(undefined); setOutput('') }}>
|
|
72
|
+
<option value="stdio" disabled={!settings.stdio}>{t.stdio}</option><option value="http">{t.http}</option>
|
|
73
|
+
</PmSelect>
|
|
74
|
+
{!settings.stdio && <PmNotice>{t.noCommand}</PmNotice>}
|
|
75
|
+
{transport === 'http' && <PmInput label={t.port} hint={t.portHint} error={valid ? undefined : t.invalid} inputMode="numeric" value={port} disabled={busy} onChange={event => { setPort(event.target.value); setStatus(undefined); setOutput('') }} />}
|
|
76
|
+
{settings.url && <PmInput label={t.address} value={settings.url} readOnly />}
|
|
77
|
+
{settings.issue && <PmNotice tone="danger">{t.portBusy}</PmNotice>}
|
|
78
|
+
<div className="pmw-speech-settings__actions"><PmButton small variant="accent" disabled={busy || !valid || !dirty && !settings.issue} onClick={() => void save()}>{t.save}</PmButton></div>
|
|
79
|
+
</div></PmCard>}
|
|
80
|
+
<p>{t.local}</p>
|
|
81
|
+
{dirty && <PmNotice>{t.applyFirst}</PmNotice>}
|
|
82
|
+
<div className="pmw-speech-settings__actions"><PmButton small variant="ghost" icon="copy" disabled={busy || !ready} onClick={() => void copy(false)}>{t.copyConfig}</PmButton><PmButton small variant="ghost" icon="sparkle" disabled={busy || !ready} onClick={() => void copy(true)}>{t.copyPrompt}</PmButton></div>
|
|
83
|
+
{output && <PmTextarea label={t.output} readOnly rows={10} value={output} onFocus={event => event.target.select()} />}
|
|
84
|
+
</div>
|
|
85
|
+
</section>
|
|
86
|
+
}
|
|
@@ -12,7 +12,7 @@ export function PageDeleteDialog({ section, title, trigger, onClose }: { section
|
|
|
12
12
|
useEffect(() => {
|
|
13
13
|
let current = true
|
|
14
14
|
setLoading(true); setError(undefined)
|
|
15
|
-
void workbench.preparePageDeletion(section).then(answer => { if (current) setPlan(answer) }, () => { if (current) setError(t.pageEditRequestFailed) }).finally(() => { if (current) setLoading(false) })
|
|
15
|
+
void workbench.editing.preparePageDeletion(section).then(answer => { if (current) setPlan(answer) }, () => { if (current) setError(t.pageEditRequestFailed) }).finally(() => { if (current) setLoading(false) })
|
|
16
16
|
return () => { current = false }
|
|
17
17
|
}, [workbench, section, attempt])
|
|
18
18
|
return <PmDialog open label={t.pageDeleteTitle(title)} description={plan ? t.pageDeleteHint(plan.counts.steps, plan.counts.narration) : t.pageDeleteLoading} busy={busy} closeLabel={t.close} onClose={onClose} onCloseAutoFocus={event => {
|
|
@@ -21,12 +21,12 @@ export function PageDeleteDialog({ section, title, trigger, onClose }: { section
|
|
|
21
21
|
}}>
|
|
22
22
|
<div className="pmw-operation">
|
|
23
23
|
{plan?.last && <PmNotice>{t.pageDeleteLast}</PmNotice>}
|
|
24
|
-
{plan && !plan.allowed && <PmNotice tone="warn">{workbench.
|
|
24
|
+
{plan && !plan.allowed && <PmNotice tone="warn">{workbench.editing.deletionMessage(plan.reason ?? 'page-boundary')}</PmNotice>}
|
|
25
25
|
{(error || failure) && <PmNotice tone="danger">{error || failure}</PmNotice>}
|
|
26
26
|
<div className="pmw-operation__actions">
|
|
27
27
|
<PmButton disabled={busy} onClick={onClose}>{t.cancel}</PmButton>
|
|
28
|
-
{error || failure ? <PmButton disabled={busy} onClick={() => { workbench.
|
|
29
|
-
: <PmButton variant="danger" loading={loading || busy} disabled={!plan?.allowed || loading} onClick={() => { if (plan) void workbench.deletePage(plan).then(saved => { if (saved) onClose() }) }}>{t.pageDelete}</PmButton>}
|
|
28
|
+
{error || failure ? <PmButton disabled={busy} onClick={() => { workbench.editing.clearFailure(); setAttempt(value => value + 1) }}>{t.retry}</PmButton>
|
|
29
|
+
: <PmButton variant="danger" loading={loading || busy} disabled={!plan?.allowed || loading} onClick={() => { if (plan) void workbench.editing.deletePage(plan).then(saved => { if (saved) onClose() }) }}>{t.pageDelete}</PmButton>}
|
|
30
30
|
</div>
|
|
31
31
|
</div>
|
|
32
32
|
</PmDialog>
|
|
@@ -15,7 +15,7 @@ export function PageRenameDialog({ section, title: original, trigger, onClose }:
|
|
|
15
15
|
}} onSubmit={event => {
|
|
16
16
|
event.preventDefault()
|
|
17
17
|
if (busy || !title.trim()) return
|
|
18
|
-
void workbench.renamePage(section, title.trim()).then(saved => { if (saved) onClose() })
|
|
18
|
+
void workbench.editing.renamePage(section, title.trim()).then(saved => { if (saved) onClose() })
|
|
19
19
|
}}>
|
|
20
20
|
<PmInput label={t.pageTitle} density="regular" value={title} error={failure} required autoFocus readOnly={busy} onChange={event => setTitle(event.target.value)} />
|
|
21
21
|
<div className="pmw-operation__actions">
|
|
@@ -6,7 +6,6 @@ import { PmButton, PmNotice } from '../components.tsx'
|
|
|
6
6
|
import { useMessages, useWorkbench, useWorkbenchState } from '../context.tsx'
|
|
7
7
|
import { slideAspect } from '../workbench.ts'
|
|
8
8
|
import { failureReason } from '../messages.ts'
|
|
9
|
-
import { PreviewChangeTrail } from './ChangeTrail.tsx'
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* The open document as its readers see it (the web form or the slides), with the tools for what the author points at.
|
|
@@ -29,7 +28,6 @@ export function PreviewPanel({ active = true, onPresentationAction, presentation
|
|
|
29
28
|
const reload = useWorkbenchState(state => state.previewReload)
|
|
30
29
|
const aspect = useWorkbenchState(state => (state.previewRenderer === 'slides' ? slideAspect(state.ir) : undefined))
|
|
31
30
|
const container = useRef<HTMLDivElement>(null)
|
|
32
|
-
const stage = useRef<HTMLDivElement>(null)
|
|
33
31
|
const pool = useRef<ReturnType<typeof createPreviewPool>>()
|
|
34
32
|
const [loads, setLoads] = useState(0)
|
|
35
33
|
const [{ ready, mismatch, identityFailure, handshakeFailure, canvasGate }, setStatus] = useState<PreviewFrameStatus>({ ready: false })
|
|
@@ -70,9 +68,8 @@ export function PreviewPanel({ active = true, onPresentationAction, presentation
|
|
|
70
68
|
{failure && <PmNotice tone="danger"><span>{t.previewFailed(failureReason(t, failure))}</span><PmButton small onClick={() => workbench.retryPreview()}>{t.retry}</PmButton></PmNotice>}
|
|
71
69
|
{(!ready || !snapshotMatches) && !failure && !handshakeFailure && !(renderer === 'slides' && preview && !preview.slides) && <p className="pmw-muted pmw-preview__loading">{presentation && ready && !snapshotMatches && !preparing ? t.presentationOutdated : address ? t.previewLoading : t.previewPreparing}</p>}
|
|
72
70
|
{renderer === 'slides' && preview && !preview.slides && <p className="pmw-muted pmw-preview__loading">{t.noSlides}</p>}
|
|
73
|
-
<div
|
|
71
|
+
<div className="pmw-preview__stage">
|
|
74
72
|
<div ref={container} className="pmw-preview__frames" data-renderer={renderer} data-pending-snapshot={!snapshotMatches || undefined} data-presentation-gated={presentation && canvasGate || undefined} style={aspect === undefined ? undefined : { '--pmw-slide-aspect': aspect } as CSSProperties} />
|
|
75
|
-
{!presentation && <PreviewChangeTrail stage={stage} frames={container} />}
|
|
76
73
|
</div>
|
|
77
74
|
</section>
|
|
78
75
|
)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { captionScale, CAPTION_SCALE_MAX, CAPTION_SCALE_MIN } from '@lincyaw/kernel'
|
|
3
|
+
import type { TeachingDocument } from '@lincyaw/kernel'
|
|
4
|
+
import { PmField, PmRange } from '../components.tsx'
|
|
5
|
+
import { useWorkbench, useWorkbenchState } from '../context.tsx'
|
|
6
|
+
import { PRODUCTION_MESSAGES } from '../production-messages.ts'
|
|
7
|
+
|
|
8
|
+
/** The document's caption size in percent steps of ten; a released drag or a key records it once. */
|
|
9
|
+
export function ProductionCaptionSize({ identity, document, disabled, onChanged }: { identity: string, document: TeachingDocument, disabled: boolean, onChanged(): void }) {
|
|
10
|
+
const workbench = useWorkbench(), locale = useWorkbenchState(state => state.locale), p = PRODUCTION_MESSAGES[locale]
|
|
11
|
+
const [preview, setPreview] = useState<number>()
|
|
12
|
+
const percent = Math.round(captionScale(document.production) * 100)
|
|
13
|
+
return <PmField label={p.captionSize} group hint={p.captionSizeHint}>
|
|
14
|
+
<div className="pm-ui-range-row">
|
|
15
|
+
<PmRange label={p.captionSize} value={percent} min={Math.round(CAPTION_SCALE_MIN * 100)} max={Math.round(CAPTION_SCALE_MAX * 100)} step={10} disabled={disabled} valueText={value => `${Math.round(value)}%`}
|
|
16
|
+
onPreviewChange={setPreview} onValueCommit={value => { workbench.production.setCaptionScale(value / 100, identity); onChanged() }} />
|
|
17
|
+
<output>{Math.round(preview ?? percent)}%</output>
|
|
18
|
+
</div>
|
|
19
|
+
</PmField>
|
|
20
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect, useRef, useState } from 'react'
|
|
2
|
-
import { CAPTION_TIMING_MAX_SEGMENTS, captionSourceFingerprint, captionTimingProblem, stepCaptionText } from '@lincyaw/kernel'
|
|
2
|
+
import { CAPTION_TIMING_MAX_SEGMENTS, captionSourceFingerprint, captionTimingProblem, randomUUID, stepCaptionText } from '@lincyaw/kernel'
|
|
3
3
|
import type { CaptionTiming, CaptionTimingSource, DocumentCaptionTimingAction, ProductionPlan } from '@lincyaw/kernel'
|
|
4
4
|
import { PmButton, PmCard, PmDialog, PmInput, PmNotice } from '../components.tsx'
|
|
5
5
|
import { useWorkbench, useWorkbenchState } from '../context.tsx'
|
|
@@ -23,7 +23,7 @@ function lineRows(text: string): Row[] {
|
|
|
23
23
|
else if (ranges.length && !text.slice(ranges.at(-1)!.from, ranges.at(-1)!.to).trim()) ranges[ranges.length - 1]!.to = to
|
|
24
24
|
else ranges.push({ from, to })
|
|
25
25
|
}
|
|
26
|
-
return ranges.map(range => ({ ...range, id:
|
|
26
|
+
return ranges.map(range => ({ ...range, id: randomUUID(), start: '', end: '' }))
|
|
27
27
|
}
|
|
28
28
|
function valueOf(draft: Draft): CaptionTiming | undefined {
|
|
29
29
|
if (!draft.basis.available || !draft.basis.playbackFingerprint || draft.basis.durationMs === undefined) return
|
|
@@ -43,14 +43,17 @@ export function ProductionCaptionTiming({ identity, stepId, plan, current, loadi
|
|
|
43
43
|
const pendingSteps = useWorkbenchState(state => state.captionTimingDraftSteps), storageFailure = useWorkbenchState(state => state.captionTimingDraftStorageFailure)
|
|
44
44
|
const [open, setOpen] = useState(false), [busy, setBusy] = useState(false), [failure, setFailure] = useState<string>(), [saved, setSaved] = useState(false), [, render] = useState(0)
|
|
45
45
|
const drafts = useRef(new Map<string, Draft>()), alive = useRef(true), request = useRef<AbortController>(), needsRefresh = useRef(false), openRef = useRef(false), composing = useRef(false)
|
|
46
|
+
useEffect(() => workbench.production.registerDraftView({ identity, kind: 'caption-timing', has: target => drafts.current.has(target),
|
|
47
|
+
blocked: () => composing.current || Boolean(request.current), clear: target => { drafts.current.delete(target); setSaved(false); setFailure(undefined); render(n => n + 1) } }), [workbench, identity])
|
|
48
|
+
useEffect(() => workbench.refreshAuthoringClientControls(), [workbench, open, busy, stepId, disabled])
|
|
46
49
|
const latest = useRef({ stepId, onChanged }); latest.current = { stepId, onChanged }
|
|
47
|
-
if (!drafts.current.has(stepId)) { const savedDraft = workbench.captionTimingDraft(stepId, identity); if (savedDraft) drafts.current.set(stepId, savedDraft) }
|
|
50
|
+
if (!drafts.current.has(stepId)) { const savedDraft = workbench.production.captionTimingDraft(stepId, identity); if (savedDraft) drafts.current.set(stepId, savedDraft) }
|
|
48
51
|
const draft = drafts.current.get(stepId), value = draft && valueOf(draft), canonical = document?.production.captionTimings?.[stepId], hasDraft = Boolean(pendingSteps?.includes(stepId))
|
|
49
52
|
const changed = draft && source?.version !== draft.version || draft && basis && (!same(draft.basis, basis) || draft.text !== (document && stepCaptionText(document, stepId)))
|
|
50
53
|
const writable = Boolean(source?.version && source.fingerprint && !source.loading && !source.dirty && !source.saving && !source.composing && !source.restored && !source.recovering && !source.error && !disabled)
|
|
51
54
|
useEffect(() => { alive.current = true; return () => { alive.current = false; request.current?.abort() } }, [])
|
|
52
55
|
useEffect(() => { request.current?.abort(); openRef.current = false; setOpen(false); setBusy(false); setFailure(undefined); setSaved(false) }, [stepId])
|
|
53
|
-
const pending = (next: Draft, changedByAuthor = true) => { drafts.current.set(stepId, next); if (changedByAuthor) workbench.setCaptionTimingDraft(stepId, next, identity); setSaved(false); setFailure(undefined); render(n => n + 1) }
|
|
56
|
+
const pending = (next: Draft, changedByAuthor = true) => { drafts.current.set(stepId, next); if (changedByAuthor) workbench.production.setCaptionTimingDraft(stepId, next, identity); setSaved(false); setFailure(undefined); render(n => n + 1) }
|
|
54
57
|
const initialize = () => {
|
|
55
58
|
if (!document || !source?.version || !basis) return
|
|
56
59
|
const text = stepCaptionText(document, stepId), existing = document.production.captionTimings?.[stepId]
|
|
@@ -61,7 +64,7 @@ export function ProductionCaptionTiming({ identity, stepId, plan, current, loadi
|
|
|
61
64
|
// A plan may arrive after opening. Step/close effects fence the original opening;
|
|
62
65
|
// an existing target draft always wins over this passive initialization.
|
|
63
66
|
if (open && openRef.current && !saved && current && basis && source?.identity === identity && !drafts.current.has(stepId)) initialize()
|
|
64
|
-
}, [open, saved, current, basis, source?.identity, source?.version, identity, stepId])
|
|
67
|
+
}, [open, saved, current, basis, source?.identity, source?.version, identity, stepId, hasDraft])
|
|
65
68
|
const close = () => {
|
|
66
69
|
request.current?.abort(); setBusy(false); openRef.current = false; setOpen(false)
|
|
67
70
|
if (needsRefresh.current) { needsRefresh.current = false; latest.current.onChanged() }
|
|
@@ -72,12 +75,12 @@ export function ProductionCaptionTiming({ identity, stepId, plan, current, loadi
|
|
|
72
75
|
const action: DocumentCaptionTimingAction = automatic ? { type: 'caption.timing.reset', stepId } : { type: 'caption.timing.set', stepId, value: value! }
|
|
73
76
|
request.current = controller; setBusy(true); setFailure(undefined)
|
|
74
77
|
try {
|
|
75
|
-
const answer = await workbench.
|
|
78
|
+
const answer = await workbench.production.applyCaptionTiming(action, randomUUID(), expected, controller.signal)
|
|
76
79
|
needsRefresh.current = true
|
|
77
80
|
if (!alive.current || workbench.getState().authoring?.identity !== identity) return
|
|
78
81
|
const ownsInput = drafts.current.get(target) === sent
|
|
79
82
|
if (ownsInput) {
|
|
80
|
-
workbench.setCaptionTimingDraft(target, undefined, identity)
|
|
83
|
+
workbench.production.setCaptionTimingDraft(target, undefined, identity)
|
|
81
84
|
if (automatic) drafts.current.delete(target)
|
|
82
85
|
else if (sent) drafts.current.set(target, { ...sent, version: answer.version })
|
|
83
86
|
}
|
|
@@ -94,7 +97,7 @@ export function ProductionCaptionTiming({ identity, stepId, plan, current, loadi
|
|
|
94
97
|
<PmButton small onClick={close}>{saved ? t.done : t.cancel}</PmButton>
|
|
95
98
|
<PmButton small variant="primary" loading={busy} disabled={!writable || !current || !value || Boolean(changed) || same(value, canonical)} onClick={() => void apply()}>{t.apply}</PmButton>
|
|
96
99
|
</>}>
|
|
97
|
-
<div className="pmw-caption-times" onCompositionStart={() => { composing.current = true }} onCompositionEnd={() => { composing.current = false }}>
|
|
100
|
+
<div className="pmw-caption-times" onCompositionStart={() => { composing.current = true; workbench.refreshAuthoringClientControls() }} onCompositionEnd={() => { composing.current = false; workbench.refreshAuthoringClientControls() }}>
|
|
98
101
|
<span>{t.step}</span>
|
|
99
102
|
{!saved && basis?.available === false && <PmNotice tone="warn">{t.unavailable}</PmNotice>}
|
|
100
103
|
{!saved && !basis && <PmNotice>{loading ? t.loading : t.prepare}</PmNotice>}
|
|
@@ -111,7 +114,7 @@ export function ProductionCaptionTiming({ identity, stepId, plan, current, loadi
|
|
|
111
114
|
<div className="pmw-caption-times__actions">
|
|
112
115
|
<PmButton small disabled={!basis?.available || busy || !writable} onClick={() => { if (document && basis && source?.version) pending({ version: source.version, text: stepCaptionText(document, stepId), basis: structuredClone(basis), rows: lineRows(stepCaptionText(document, stepId)) }) }}>{t.split}</PmButton>
|
|
113
116
|
<PmButton small disabled={!canonical || busy || !writable} onClick={() => void apply(true)}>{t.automatic}</PmButton>
|
|
114
|
-
{hasDraft && <PmButton small disabled={busy} onClick={() => { workbench.
|
|
117
|
+
{hasDraft && <PmButton small disabled={busy} onClick={() => { if (workbench.production.discardCaptionTimingDraft(stepId, identity)) { drafts.current.delete(stepId); initialize() } }}>{t.discard}</PmButton>}
|
|
115
118
|
</div>
|
|
116
119
|
{storageFailure && <PmNotice tone="warn">{t.storageFailed}</PmNotice>}
|
|
117
120
|
{saved && <PmNotice tone="ok">{t.saved}</PmNotice>}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { useEffect, useRef, useState } from 'react'
|
|
2
2
|
import type { DocumentChangeAnswer, MediaClip, ProductionAssetInspection, ProductionBinding, TeachingDocument } from '@lincyaw/kernel'
|
|
3
|
+
import { randomUUID } from '@lincyaw/kernel'
|
|
3
4
|
import { MediaClipEditor } from '../MediaClipEditor.tsx'
|
|
4
5
|
import type { MediaClipDraft } from '../MediaClipEditor.tsx'
|
|
5
6
|
import { useWorkbench, useWorkbenchState } from '../context.tsx'
|
|
6
|
-
import {
|
|
7
|
+
import { mediaDraftStorageFailed, readMediaDrafts } from '../media-drafts.ts'
|
|
7
8
|
import type { MediaDrafts } from '../media-drafts.ts'
|
|
8
9
|
import { MEDIA_MESSAGES, mediaFailure } from '../media-messages.ts'
|
|
9
10
|
|
|
@@ -18,7 +19,7 @@ interface Props {
|
|
|
18
19
|
disabled: boolean
|
|
19
20
|
onChanged(): void
|
|
20
21
|
}
|
|
21
|
-
const newDraft = (version: string, stepId: string): MediaClipDraft => ({ version, clip: { id: `clip_${
|
|
22
|
+
const newDraft = (version: string, stepId: string): MediaClipDraft => ({ version, clip: { id: `clip_${randomUUID().replaceAll('-', '')}`, assetId: '', sourceRange: { startMs: 0, endMs: 0 }, attachment: { stepId, offsetMs: 0 }, volume: 1, muted: false } })
|
|
22
23
|
const fromClip = (version: string, clip: MediaClip): MediaClipDraft => ({ version, clip: structuredClone(clip), baseClip: structuredClone(clip) })
|
|
23
24
|
const same = (a: unknown, b: unknown) => JSON.stringify(a) === JSON.stringify(b)
|
|
24
25
|
const draftKey = (clipId?: string) => clipId === undefined ? 'new' : `clip:${clipId}`
|
|
@@ -41,9 +42,23 @@ export function ProductionMediaClips({ identity, version, document, sectionId, s
|
|
|
41
42
|
snapshot.current = draft; selected.current = key; latest.current = session
|
|
42
43
|
const assets = Object.values(document.assets).filter(asset => asset.kind === 'audio').map(asset => ({ id: asset.id, label: asset.title || asset.location.split('/').at(-1) || asset.id }))
|
|
43
44
|
const active = () => owner.current.active && workbench.getState().authoring?.identity === identity
|
|
45
|
+
const interacting = useRef(false), unavailable = useRef(false)
|
|
46
|
+
unavailable.current = disabled || Boolean(busy)
|
|
47
|
+
useEffect(() => workbench.production.registerDraftView({ identity, kind: 'media-clip', has: target => {
|
|
48
|
+
const [ownerStep, name] = JSON.parse(target) as [string, string]
|
|
49
|
+
return active() && ownerStep === stepId && Object.hasOwn(latest.current.entries, name)
|
|
50
|
+
}, blocked: () => interacting.current || Boolean(request.current) || unavailable.current,
|
|
51
|
+
clear: () => {
|
|
52
|
+
owner.current.revision++
|
|
53
|
+
const value = readMediaDrafts(workbench.client, identity, stepId)
|
|
54
|
+
latest.current = value; setSession(value); setStorageFailed(false); setFailure(undefined); setStatus(undefined)
|
|
55
|
+
blank.current = newDraft(workbench.getState().authoring?.version ?? version, stepId)
|
|
56
|
+
} }), [workbench, identity, stepId])
|
|
57
|
+
useEffect(() => workbench.registerNavigationGuard(() => active() && (interacting.current || Boolean(request.current))), [workbench, identity])
|
|
58
|
+
useEffect(() => { workbench.refreshAuthoringClientControls() }, [workbench, disabled, busy])
|
|
44
59
|
const remember = (value: MediaDrafts) => {
|
|
45
60
|
latest.current = value; setSession(value)
|
|
46
|
-
setStorageFailed(!keepMediaDrafts(
|
|
61
|
+
setStorageFailed(!workbench.production.keepMediaDrafts(identity, stepId, value))
|
|
47
62
|
}
|
|
48
63
|
const edit = (value: MediaClipDraft) => {
|
|
49
64
|
owner.current.revision++; setFailure(undefined); setStatus(undefined)
|
|
@@ -55,7 +70,7 @@ export function ProductionMediaClips({ identity, version, document, sectionId, s
|
|
|
55
70
|
const assetId = draft.clip.assetId, controller = new AbortController(), requestKey = key
|
|
56
71
|
if (!assetId || disabled || !version || inspection?.version === version && inspection.value.assetId === assetId) { setLoading(false); return }
|
|
57
72
|
setLoading(true)
|
|
58
|
-
void workbench.
|
|
73
|
+
void workbench.production.inspectAudio(assetId, { identity, version }, controller.signal).then(answer => {
|
|
59
74
|
if (controller.signal.aborted || !active()) return
|
|
60
75
|
setInspection({ version: answer.version, value: answer.inspection })
|
|
61
76
|
const current = ownDraft(latest.current.entries, requestKey)
|
|
@@ -84,7 +99,7 @@ export function ProductionMediaClips({ identity, version, document, sectionId, s
|
|
|
84
99
|
if (!sent) return
|
|
85
100
|
file.current = value; setRetryImport(false)
|
|
86
101
|
try {
|
|
87
|
-
const answer = await workbench.
|
|
102
|
+
const answer = await workbench.production.ensureAudio(value, sent.expected, sent.controller.signal)
|
|
88
103
|
if (!active() || sent.controller.signal.aborted) return
|
|
89
104
|
const next = acknowledge(answer, sent.expected.version)
|
|
90
105
|
if (owner.current.revision === sent.revision && selected.current === sent.key) {
|
|
@@ -102,7 +117,7 @@ export function ProductionMediaClips({ identity, version, document, sectionId, s
|
|
|
102
117
|
const sent = start('apply')
|
|
103
118
|
if (!sent) return
|
|
104
119
|
try {
|
|
105
|
-
const answer = await workbench.
|
|
120
|
+
const answer = await workbench.production.applyMediaClip(clip, { ...sent.expected, binding }, sent.controller.signal)
|
|
106
121
|
if (!active() || sent.controller.signal.aborted) return
|
|
107
122
|
const next = acknowledge(answer, sent.expected.version), current = ownDraft(latest.current.entries, sent.key)
|
|
108
123
|
if (sent.key === 'new') blank.current = newDraft(answer.version, stepId)
|
|
@@ -122,7 +137,7 @@ export function ProductionMediaClips({ identity, version, document, sectionId, s
|
|
|
122
137
|
const sent = start('remove')
|
|
123
138
|
if (!sent) return
|
|
124
139
|
try {
|
|
125
|
-
const answer = await workbench.
|
|
140
|
+
const answer = await workbench.production.removeMediaClip(canonical.id, sent.expected, sent.controller.signal)
|
|
126
141
|
if (!active() || sent.controller.signal.aborted) return
|
|
127
142
|
const next = acknowledge(answer, sent.expected.version), current = ownDraft(latest.current.entries, sent.key)
|
|
128
143
|
if (!current || same(current, sent.draft)) {
|
|
@@ -137,6 +152,7 @@ export function ProductionMediaClips({ identity, version, document, sectionId, s
|
|
|
137
152
|
return <MediaClipEditor locale={locale} assets={assets} clips={clips} selectedClipId={selectedClipId} draft={draft} inspection={inspectCurrent} stepDurationMs={stepDurationMs}
|
|
138
153
|
disabled={disabled} canApply={Boolean(binding && stepDurationMs !== undefined)} loading={loading} busy={busy} pending={Boolean(ownDraft(session.entries, key))} review={Boolean(ownDraft(session.entries, key) && draft.version !== version)}
|
|
139
154
|
failure={failure} storageFailed={storageFailed} status={status} retryImport={retryImport}
|
|
155
|
+
onInteraction={value => { if (value === interacting.current) return; interacting.current = value; workbench.refreshAuthoringClientControls() }}
|
|
140
156
|
onEditStart={pause} onChange={edit} onImport={value => void importAudio(value)} onRetryImport={() => { if (file.current) void importAudio(file.current) }}
|
|
141
157
|
onRead={() => { setFailure(undefined); setInspection(undefined); setReload(value => value + 1) }}
|
|
142
158
|
onReview={() => { if (inspectCurrent && (!draft.baseClip || canonical)) edit({ ...draft, version, ...canonical ? { baseClip: structuredClone(canonical) } : {} }) }}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { useEffect, useRef, useState } from 'react'
|
|
2
|
+
import type { ReactNode } from 'react'
|
|
3
|
+
import { useContainerLayout } from '../container-layout.ts'
|
|
2
4
|
import { keyBelongsToTarget, PRODUCTION_PLAYBACK_RATES, sameProductionBinding, watchFocusSource } from '@lincyaw/kernel'
|
|
3
5
|
import type { ProductionPlaybackCommand } from '@lincyaw/kernel'
|
|
4
6
|
import { PmBadge, PmButton, PmCard, PmDialog, PmEmpty, PmIconButton, PmNotice, PmPanelHeader, PmPopover, PmSearchList, PmSelect, PmSegmented, PmSplitGroup, PmSplitHandle, PmSplitPanel, PmTabs, PmTabPanel, PmToolbar, PmToolbarButton } from '../components.tsx'
|
|
@@ -6,12 +8,13 @@ import { useMessages, useWorkbench, useWorkbenchState } from '../context.tsx'
|
|
|
6
8
|
import { DocumentStepNarration } from '../document-editor/DocumentStepNarration.tsx'
|
|
7
9
|
import { PRODUCTION_MESSAGES, productionFailure } from '../production-messages.ts'
|
|
8
10
|
import { SHORTCUTS } from '../shortcuts.ts'
|
|
9
|
-
import { isAgentChanging } from '../workbench.ts'
|
|
10
|
-
import type { PlaybackKey } from '../workbench.ts'
|
|
11
|
+
import { isAgentChanging } from '../workbench-state.ts'
|
|
12
|
+
import type { PlaybackKey } from '../workbench-state.ts'
|
|
11
13
|
import { DocumentVoiceField } from './DocumentVoiceField.tsx'
|
|
12
14
|
import { ExportPanel } from './ExportPanel.tsx'
|
|
13
15
|
import { PreviewPanel } from './PreviewPanel.tsx'
|
|
14
16
|
import { VoiceoverDialog } from './VoiceoverDialog.tsx'
|
|
17
|
+
import { ProductionCaptionSize } from './ProductionCaptionSize.tsx'
|
|
15
18
|
import { ProductionCaptionTiming } from './ProductionCaptionTiming.tsx'
|
|
16
19
|
import { ProductionTimeline } from './ProductionTimeline.tsx'
|
|
17
20
|
import { ProductionMediaClips } from './ProductionMediaClips.tsx'
|
|
@@ -32,7 +35,7 @@ const PLAYBACK_KEYS: Record<string, PlaybackKey> = { ' ': 'play-pause', ArrowLef
|
|
|
32
35
|
* While it is `active`, Space plays or pauses and the left and right arrows select the previous or next step, from the
|
|
33
36
|
* workbench and from its preview alike; text entry, menus, dialogs and controls the keyboard moved to keep their keys.
|
|
34
37
|
*/
|
|
35
|
-
export function ProductionPanel({ onClose, closing, active = true }: { onClose(): void, closing: boolean, active?: boolean }) {
|
|
38
|
+
export function ProductionPanel({ onClose, closing, active = true, actions }: { onClose(): void, closing: boolean, active?: boolean, actions?: ReactNode }) {
|
|
36
39
|
const workbench = useWorkbench(), t = useMessages(), locale = useWorkbenchState(state => state.locale), p = PRODUCTION_MESSAGES[locale]
|
|
37
40
|
const voicePlayback = useProductionVoicePlayback()
|
|
38
41
|
const serviceVersion = useWorkbenchState(state => state.voiceServiceVersion)
|
|
@@ -45,7 +48,8 @@ export function ProductionPanel({ onClose, closing, active = true }: { onClose()
|
|
|
45
48
|
const captionDraftSteps = useWorkbenchState(state => state.captionTimingDraftSteps), captionStorageFailure = useWorkbenchState(state => state.captionTimingDraftStorageFailure)
|
|
46
49
|
const frameCurrent = useWorkbenchState(state => Boolean(state.presentationSnapshot && state.previewIrRevision === state.presentationSnapshot.revision))
|
|
47
50
|
const blocked = useWorkbenchState(state => Boolean(state.authoring?.loading || state.authoring?.composing) || isAgentChanging(state))
|
|
48
|
-
const
|
|
51
|
+
const container = useContainerLayout(), wide = container.productionWide
|
|
52
|
+
const [tab, setTab] = useState('preview')
|
|
49
53
|
const [libraryTab, setLibraryTab] = useState('pages'), [inspectorTab, setInspectorTab] = useState('script'), [outputsOpen, setOutputsOpen] = useState(false)
|
|
50
54
|
const [generateStep, setGenerateStep] = useState<string>(), [failure, setFailure] = useState<string>()
|
|
51
55
|
const [planBusy, setPlanBusy] = useState(false), [planFailure, setPlanFailure] = useState<string>(), [planReload, setPlanReload] = useState(0)
|
|
@@ -68,11 +72,6 @@ export function ProductionPanel({ onClose, closing, active = true }: { onClose()
|
|
|
68
72
|
const canPlay = Boolean(playbackConnected && plan?.canPreview && live?.status === 'ready' && !timingDraft)
|
|
69
73
|
const backgroundBody = !wide && tab === 'timeline', backgroundVisuals = !wide && tab !== 'preview'
|
|
70
74
|
useEffect(() => workbench.observeVoiceoverJobs(), [workbench, source?.identity])
|
|
71
|
-
useEffect(() => {
|
|
72
|
-
const media = matchMedia('(min-width: 1100px)'), update = () => setWide(media.matches)
|
|
73
|
-
media.addEventListener('change', update)
|
|
74
|
-
return () => media.removeEventListener('change', update)
|
|
75
|
-
}, [])
|
|
76
75
|
useEffect(() => () => { owner.current.active = false; owner.current.generation++; controlRequest.current?.abort(); workbench.closeProduction(); workbench.cancelPreviewPreparation() }, [workbench])
|
|
77
76
|
useEffect(() => {
|
|
78
77
|
const controller = new AbortController()
|
|
@@ -177,10 +176,11 @@ export function ProductionPanel({ onClose, closing, active = true }: { onClose()
|
|
|
177
176
|
const mediaEditor = <ProductionMediaClips key={`${source.identity}:${stepId}`} identity={source.identity} version={source.version ?? ''} document={document} sectionId={sectionId} stepId={stepId}
|
|
178
177
|
binding={planCurrent ? plan?.binding : undefined} stepDurationMs={(() => { const step = planCurrent ? plan?.pages.find(page => page.sectionId === sectionId)?.steps.find(step => step.stepId === stepId) : undefined; return step?.timing === 'confirmed' && step.startMs !== undefined && step.endMs !== undefined ? step.endMs - step.startMs : undefined })()}
|
|
179
178
|
disabled={blocked || closing || !declared || !source.version || Boolean(source.dirty || source.saving || source.restored || source.error)} onChanged={() => setMediaRefresh(true)} />
|
|
180
|
-
return <section className="pmw-production" aria-label={p.title}>
|
|
181
|
-
<PmPanelHeader title={p.title} meta={wide ? document.metadata.title : undefined}
|
|
179
|
+
return <section ref={container.ref} className="pmw-production" aria-label={p.title}>
|
|
180
|
+
<PmPanelHeader variant="workspace" title={p.title} meta={wide ? document.metadata.title : undefined}
|
|
182
181
|
leading={<PmIconButton small icon="arrow-left" label={p.back} loading={closing} onClick={onClose} />}
|
|
183
182
|
actions={<>
|
|
183
|
+
{actions}
|
|
184
184
|
<PmBadge tone={sourceCurrent && frameCurrent ? 'ok' : preparing || sourceCurrent ? 'accent' : 'warn'}>{sourceCurrent && frameCurrent ? p.current : preparing || sourceCurrent ? p.preparing : p.outdated}</PmBadge>
|
|
185
185
|
{issueCount > 0 && <PmPopover open={issuesOpen} onOpenChange={setIssuesOpen} label={p.issues(issueCount)} trigger={wide ? <PmButton small icon="warning" title={summary} aria-label={p.issues(issueCount)}>{p.issueCount(issueCount)}</PmButton> : <PmIconButton small icon="warning" label={p.issues(issueCount)} hint={summary} />}>
|
|
186
186
|
<div className="pmw-production__feedback">
|
|
@@ -243,7 +243,7 @@ export function ProductionPanel({ onClose, closing, active = true }: { onClose()
|
|
|
243
243
|
</div></PmTabPanel>
|
|
244
244
|
<PmTabPanel value="voice" keepMounted><div className="pmw-production__fields">
|
|
245
245
|
<DocumentVoiceField key={`${source.identity}:${stepId}`} stepId={stepId} disabled={blocked || closing} onGenerate={() => { voicePlayback.stop(); workbench.stopAuditions(); setGenerateStep(stepId) }} />
|
|
246
|
-
<ProductionRecording key={source.identity} identity={source.identity} sectionId={sectionId} stepId={stepId} active={!outputsOpen && (wide || tab === 'properties') && inspectorTab === 'voice'} disabled={blocked || closing}
|
|
246
|
+
<ProductionRecording key={source.identity} identity={source.identity} sectionId={sectionId} stepId={stepId} active={!outputsOpen && (wide || tab === 'properties') && inspectorTab === 'voice'} available={active && !outputsOpen} onReveal={() => { setInspectorTab('voice'); setTab('properties') }} disabled={blocked || closing}
|
|
247
247
|
onImportStarted={() => transcriptionSelection.current}
|
|
248
248
|
onImported={(assetId, selection) => {
|
|
249
249
|
setMediaRefresh(true)
|
|
@@ -254,7 +254,10 @@ export function ProductionPanel({ onClose, closing, active = true }: { onClose()
|
|
|
254
254
|
selectedAsset={transcriptionAsset?.identity === source.identity ? transcriptionAsset : undefined}
|
|
255
255
|
onSelectAsset={() => { transcriptionSelection.current++; setTranscriptionAsset(undefined) }} />
|
|
256
256
|
</div></PmTabPanel>
|
|
257
|
-
<PmTabPanel value="captions" keepMounted><
|
|
257
|
+
<PmTabPanel value="captions" keepMounted><div className="pmw-production__fields">
|
|
258
|
+
<ProductionCaptionSize identity={source.identity} document={document} disabled={blocked || closing} onChanged={() => setMediaRefresh(true)} />
|
|
259
|
+
<ProductionCaptionTiming key={source.identity} identity={source.identity} stepId={stepId} plan={plan} current={planCurrent} loading={preparing || planBusy} disabled={blocked || closing} onChanged={() => setMediaRefresh(true)} />
|
|
260
|
+
</div></PmTabPanel>
|
|
258
261
|
</PmTabs>
|
|
259
262
|
</PmSplitPanel>
|
|
260
263
|
</PmSplitGroup>
|