Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
Edit shot button in the music video preview player
Claude7e3b70ff0fe6
diff --git a/client/src/components/musicVideo/CompositionPreviewPlayer.jsx b/client/src/components/musicVideo/CompositionPreviewPlayer.jsxindex 4a5dff3009..b5d7771bce 100644--- a/client/src/components/musicVideo/CompositionPreviewPlayer.jsx+++ b/client/src/components/musicVideo/CompositionPreviewPlayer.jsx@@ -36,9 +36,10 @@ const startsDeferred = (collapsed) => collapsed && window.matchMedia?.(DESKTOP_Q* the picture below `lg` until the dock is expanded or the viewport is desktop.* `lyrics` previews timed lyrics instead of the document. `draft` previews the* candidate document. `shotNav` adds Back and Next shot buttons (and the arrow- * keys) and frame-by-frame stepping for the docked player.+ * keys) and frame-by-frame stepping for the docked player; `onEditShot(sceneId)`+ * there adds Edit shot, which pauses first.*/-export default function CompositionPreviewPlayer({ project, audioUrl, seekRequest = null, collapsed = false, draft = false, lyrics = false, shotNav = false, scrubId: givenScrubId = null }) {+export default function CompositionPreviewPlayer({ project, audioUrl, seekRequest = null, collapsed = false, draft = false, lyrics = false, shotNav = false, onEditShot = null, scrubId: givenScrubId = null }) {const doc = lyrics ? { playthrough: true } : (draft ? project.composition?.documentDraft : project.composition?.document) || null;const scrubId = givenScrubId || (lyrics ? 'mv-lyrics-scrub' : draft ? 'mv-doc-draft-scrub' : 'mv-doc-scrub');const [wanted, setWanted] = useState(() => !startsDeferred(collapsed));@@ -145,7 +146,7 @@ export default function CompositionPreviewPlayer({ project, audioUrl, seekRequesclassName="min-w-0 flex-1" /><span className="text-xs text-port-text-muted tabular-nums">{timeLabel}</span></div>- {shotNav && <ShotStepper scenes={project.scenes} time={t} onSeek={seek} disabled={!preview.ready || failed} keys />}+ {shotNav && <ShotStepper scenes={project.scenes} time={t} onSeek={seek} onEditShot={onEditShot ? (sceneId) => { audioRef.current?.pause?.(); setPlaying(false); onEditShot(sceneId); } : null} disabled={!preview.ready || failed} keys />}{shotNav && (<FrameSteppertime={t}diff --git a/client/src/components/musicVideo/PreviewDock.jsx b/client/src/components/musicVideo/PreviewDock.jsxindex 1a042d4ed5..ebd77a7a43 100644--- a/client/src/components/musicVideo/PreviewDock.jsx+++ b/client/src/components/musicVideo/PreviewDock.jsx@@ -9,7 +9,7 @@ import FrameStepper, { captureMediaFrame } from './FrameStepper.jsx';// A rendered file (the final render or a draft excerpt). Its clock starts at// the clip's own start, so a seek to song time `t` lands at `t - startSec` and// is ignored outside it. Back and Next step through the shots inside it.-function VideoPreview({ source, scenes, projectName, seekRequest, collapsed }) {+function VideoPreview({ source, scenes, projectName, seekRequest, collapsed, onEditShot = null }) {const videoRef = useRef(null);const [time, setTime] = useState(0);const [duration, setDuration] = useState(null);@@ -56,6 +56,7 @@ function VideoPreview({ source, scenes, projectName, seekRequest, collapsed }) {scenes={scenes}time={songTime}onSeek={(t) => { seekTo(t - startSec); setTime(t - startSec); }}+ onEditShot={onEditShot ? (sceneId) => { videoRef.current?.pause?.(); onEditShot(sceneId); } : null}range={range}keys/>@@ -80,7 +81,7 @@ function VideoPreview({ source, scenes, projectName, seekRequest, collapsed }) {* nothing to play yet it says what makes something playable. `seekRequest`* (`{ t, n }`) is the scene-card seek.*/-export default function PreviewDock({ project, sources, audioUrl, seekRequest, collapsed, onToggleCollapsed, expanded = false, onToggleExpanded }) {+export default function PreviewDock({ project, sources, audioUrl, seekRequest, collapsed, onToggleCollapsed, expanded = false, onToggleExpanded, onEditShot = null }) {const [searchParams, setSearchParams] = useSearchParams();const requested = searchParams.get('play');const source = sources.find((entry) => entry.id === requested) || sources[0] || null;@@ -146,10 +147,10 @@ export default function PreviewDock({ project, sources, audioUrl, seekRequest, c</p>)}{/* Folded below xl, the dock is one row: the player and its controls wait for the expand. */}- {source?.kind === 'document' && <div className={collapsed ? 'max-xl:hidden' : ''}><CompositionPreviewPlayer project={project} audioUrl={audioUrl} seekRequest={seekRequest} collapsed={collapsed} shotNav /></div>}- {source?.kind === 'lyrics' && <div className={collapsed ? 'max-xl:hidden' : ''}><CompositionPreviewPlayer project={project} audioUrl={audioUrl} seekRequest={seekRequest} collapsed={collapsed} lyrics shotNav /></div>}- {source?.kind === 'animatic' && <StoryboardAnimatic project={project} audioUrl={audioUrl} seekRequest={seekRequest} collapsed={collapsed} />}- {source?.kind === 'video' && <VideoPreview key={source.id} source={source} scenes={project.scenes} projectName={project.name} seekRequest={seekRequest} collapsed={collapsed} />}+ {source?.kind === 'document' && <div className={collapsed ? 'max-xl:hidden' : ''}><CompositionPreviewPlayer project={project} audioUrl={audioUrl} seekRequest={seekRequest} collapsed={collapsed} shotNav onEditShot={onEditShot} /></div>}+ {source?.kind === 'lyrics' && <div className={collapsed ? 'max-xl:hidden' : ''}><CompositionPreviewPlayer project={project} audioUrl={audioUrl} seekRequest={seekRequest} collapsed={collapsed} lyrics shotNav onEditShot={onEditShot} /></div>}+ {source?.kind === 'animatic' && <StoryboardAnimatic project={project} audioUrl={audioUrl} seekRequest={seekRequest} collapsed={collapsed} onEditShot={onEditShot} />}+ {source?.kind === 'video' && <VideoPreview key={source.id} source={source} scenes={project.scenes} projectName={project.name} seekRequest={seekRequest} collapsed={collapsed} onEditShot={onEditShot} />}</aside>);}diff --git a/client/src/components/musicVideo/PreviewDock.test.jsx b/client/src/components/musicVideo/PreviewDock.test.jsxindex 8f2a2e4600..7757b41779 100644--- a/client/src/components/musicVideo/PreviewDock.test.jsx+++ b/client/src/components/musicVideo/PreviewDock.test.jsx@@ -32,4 +32,16 @@ describe('PreviewDock video shot steps', () => {expect(video.currentTime).toBeCloseTo(1.5 / 24);expect(screen.getByLabelText('Frame').value).toBe('481');});++ it('pauses the video and opens the shot on screen from Edit shot', () => {+ const project = { id: 'p', scenes: [{ sceneId: 'a', startSec: 18 }, { sceneId: 'b', startSec: 22 }] };+ const sources = [{ id: 'draft-1', kind: 'video', label: 'Draft', src: '/data/videos/draft.mp4', startSec: 20, endSec: 30 }];+ const onEditShot = vi.fn();+ render(<MemoryRouter><PreviewDock project={project} sources={sources} audioUrl="/song.mp3" onEditShot={onEditShot} /></MemoryRouter>);+ const video = screen.getByLabelText('Draft excerpt preview');+ video.pause = vi.fn();+ fireEvent.click(screen.getByRole('button', { name: 'Edit shot' }));+ expect(video.pause).toHaveBeenCalled();+ expect(onEditShot).toHaveBeenCalledWith('a');+ });});diff --git a/client/src/components/musicVideo/ShotStepper.jsx b/client/src/components/musicVideo/ShotStepper.jsxindex fe1130c899..a1424c6b0b 100644--- a/client/src/components/musicVideo/ShotStepper.jsx+++ b/client/src/components/musicVideo/ShotStepper.jsx@@ -1,5 +1,5 @@import { useEffect, useRef } from 'react';-import { SkipBack, SkipForward } from 'lucide-react';+import { Pencil, SkipBack, SkipForward } from 'lucide-react';import { shouldIgnoreGlobalKey } from '../../lib/a11yKeyboard.js';import { ShotLockButton } from './ShotLock.jsx';@@ -55,8 +55,9 @@ const buttonCls = 'flex min-h-[44px] min-w-[44px] shrink-0 items-center justify-* Back and Next buttons that jump the player to a shot's start, with the shot* number between them. `onSeek(songSec)` moves the player and leaves it playing* or paused as it was. `keys` also binds the left and right arrows on the page.+ * With `onEditShot(sceneId)`, an Edit shot button opens the shot on screen.*/-export default function ShotStepper({ scenes, time, onSeek, range = null, disabled = false, keys = false, className = '' }) {+export default function ShotStepper({ scenes, time, onSeek, onEditShot = null, range = null, disabled = false, keys = false, className = '' }) {const { back, next, index, count } = shotSteps(scenes, time, range);const onScreen = shotOnScreen(scenes, time);const latest = useRef({ back, next, onSeek, disabled });@@ -86,6 +87,11 @@ export default function ShotStepper({ scenes, time, onSeek, range = null, disabl<button type="button" onClick={() => onSeek(next)} disabled={disabled || next == null} aria-label="Next shot" title="Next shot" className={buttonCls}><SkipForward size={14} aria-hidden="true" /></button>+ {onScreen && onEditShot && (+ <button type="button" onClick={() => onEditShot(onScreen.sceneId)} title="Pause and open this shot's card" className={`${buttonCls} gap-1 px-2`}>+ <Pencil size={14} aria-hidden="true" /> Edit shot+ </button>+ )}{onScreen && <ShotLockButton scene={onScreen} />}</div>);diff --git a/client/src/components/musicVideo/StoryboardAnimatic.jsx b/client/src/components/musicVideo/StoryboardAnimatic.jsxindex 459a4374d9..9cc958a6e5 100644--- a/client/src/components/musicVideo/StoryboardAnimatic.jsx+++ b/client/src/components/musicVideo/StoryboardAnimatic.jsx@@ -294,7 +294,7 @@ function useStatsOutro({ project, audioRef }) {* it once the words are timed (a toggle hides them). `seekRequest`* (`{ t, n }`) is the scene-card seek the other preview sources honour too.*/-export default function StoryboardAnimatic({ project, audioUrl, seekRequest, collapsed }) {+export default function StoryboardAnimatic({ project, audioUrl, seekRequest, collapsed, onEditShot = null }) {const audioRef = useRef(null);const figureRef = useRef(null);const applied = useRef(null);@@ -330,6 +330,8 @@ export default function StoryboardAnimatic({ project, audioUrl, seekRequest, colaudioRef.current?.pause?.();seekTo(t);}, [seekTo]);+ // Edit shot pauses the song so the shot stays on screen while its card opens.+ const editShot = onEditShot ? (sceneId) => { audioRef.current?.pause?.(); onEditShot(sceneId); } : null;// Save frame keeps the shot's picture: its clip's frame once that shows, else its still.const captureFrame = () => {const figure = figureRef.current;@@ -387,7 +389,7 @@ export default function StoryboardAnimatic({ project, audioUrl, seekRequest, col<div className="min-w-0 basis-full text-[11px] text-port-text-muted @min-[32rem]/mv-preview:flex-1 @min-[32rem]/mv-preview:basis-auto">{shot && (<div className="flex flex-wrap items-center gap-x-2 gap-y-1">- <ShotStepper scenes={timed} time={time} onSeek={seekTo} keys />+ <ShotStepper scenes={timed} time={time} onSeek={seekTo} onEditShot={editShot} keys /><span className="tabular-nums">{formatDurationSec(shot.startSec)}</span></div>)}diff --git a/client/src/components/musicVideo/StoryboardAnimatic.test.jsx b/client/src/components/musicVideo/StoryboardAnimatic.test.jsxindex 97444e9269..411c881c97 100644--- a/client/src/components/musicVideo/StoryboardAnimatic.test.jsx+++ b/client/src/components/musicVideo/StoryboardAnimatic.test.jsx@@ -156,6 +156,18 @@ describe('StoryboardAnimatic clips', () => {expect(audio.currentTime).toBe(0);});+ it('pauses the song and opens the shot playing from Edit shot', () => {+ const stills = clipScenes.map(({ videoHistoryId, ...scene }) => scene);+ const onEditShot = vi.fn();+ render(<StoryboardAnimatic project={{ id: 'p', scenes: stills }} audioUrl="/song.mp3" onEditShot={onEditShot} />);+ const audio = screen.getByLabelText('Song for the storyboard animatic');+ audio.pause = vi.fn();+ fireEvent.click(screen.getByRole('button', { name: 'Next shot' }));+ fireEvent.click(screen.getByRole('button', { name: 'Edit shot' }));+ expect(audio.pause).toHaveBeenCalled();+ expect(onEditShot).toHaveBeenCalledWith(stills[1].sceneId);+ });+it('saves the shot\'s still, then its clip once that shows', async () => {render(<StoryboardAnimatic project={{ id: 'p', name: 'Example Song', scenes: clipScenes }} audioUrl="/song.mp3" />);const clip = await screen.findByLabelText('Clip for Opening');diff --git a/client/src/pages/MusicVideo.jsx b/client/src/pages/MusicVideo.jsxindex 0271d0b834..40419ca8d0 100644--- a/client/src/pages/MusicVideo.jsx+++ b/client/src/pages/MusicVideo.jsx@@ -1067,6 +1067,22 @@ export default function MusicVideo() {if (unfoldToAnchor(el)) requestAnimationFrame(land);else land();}, [activeStage, location.key, selectedId, !!selected]);+ // Edit shot (from the preview player) opens that shot's card on Shots and+ // scrolls it into view, also when the card was already open.+ const [editShotRequest, setEditShotRequest] = useState(null);+ const editShot = (sceneId) => {+ if (!selected) return;+ const search = searchParams.toString();+ navigate(`/music-video/${encodeURIComponent(selected.id)}/produce/scene/${encodeURIComponent(sceneId)}${search ? `?${search}` : ''}`, { replace: activeStage === 'produce' });+ setEditShotRequest({ sceneId });+ };+ // The card mounts once the navigation lands, so this waits for it.+ useEffect(() => {+ const card = editShotRequest && document.getElementById(`scene-${editShotRequest.sceneId}`);+ if (!card) return;+ card.scrollIntoView?.({ behavior: 'smooth', block: 'center' });+ setEditShotRequest(null);+ }, [editShotRequest, location.key]);const goToStage = (stage, anchor = null, params = null) => {// Preserve search params (e.g. ?play=, ?new=, ?sheet=) across tabs; `params` sets more (e.g. ?scenes=missing).const next = new URLSearchParams(searchParams);@@ -1628,6 +1644,7 @@ export default function MusicVideo() {onToggleCollapsed={() => setDockCollapsed(!(dockCollapsed ?? !playerFirst))}expanded={dockExpanded}onToggleExpanded={!playerFirst ? () => setDockExpanded((expanded) => !expanded) : undefined}+ onEditShot={editShot}/>,)}>diff --git a/client/src/pages/MusicVideo.test.jsx b/client/src/pages/MusicVideo.test.jsxindex 6a1802a2ee..ffc4e17b8b 100644--- a/client/src/pages/MusicVideo.test.jsx+++ b/client/src/pages/MusicVideo.test.jsx@@ -2752,6 +2752,25 @@ describe('MusicVideo stage tabs (#9243)', () => {await waitFor(() => expect(document.getElementById('mv-auto-edit')).toHaveFocus());});+ // Uniquely catches Edit shot losing its route (Shots, the shot's card) or its scroll to the card.+ it('opens the shot playing in the preview on Shots and scrolls to its card', async () => {+ listMusicVideoProjects.mockResolvedValue([{ ...PROJECT_WITH_CLIP, scenes: [{ ...PROJECT_WITH_CLIP.scenes[0], startSec: 0 }] }]);+ const scrolled = [];+ const scroll = vi.spyOn(Element.prototype, 'scrollIntoView').mockImplementation(function record() { scrolled.push(this.id); });+ renderAt('/music-video/mv-1/board');+ await screen.findByRole('heading', { level: 2, name: PROJECT_WITH_CLIP.name });+ const dock = screen.getByRole('complementary', { name: 'Preview' });+ fireEvent.click(within(dock).getByRole('button', { name: 'Edit shot' }));+ await waitFor(() => expect(screen.getByTestId('loc')).toHaveTextContent('/music-video/mv-1/produce/scene/s1'));+ expect(selectedTab()).toHaveAccessibleName(STAGE_TABS.produce);+ await waitFor(() => expect(scrolled).toContain('scene-s1'));+ // Already open, the card still comes back into view.+ scrolled.length = 0;+ fireEvent.click(within(dock).getByRole('button', { name: 'Edit shot' }));+ await waitFor(() => expect(scrolled).toContain('scene-s1'));+ scroll.mockRestore();+ });+// Uniquely catches the opening title card form leaving the Look step or reappearing on Plan/Shots.it('edits the opening title card on the Look step only, right under the preview', async () => {listMusicVideoProjects.mockResolvedValue([PROJECT_WITH_CLIP]);