Skip to content

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

Add an Assets page to a music video's step list (#11551)

[._.]/de6c19ec3608
diff --git a/client/src/components/musicVideo/MusicVideoLayout.jsx b/client/src/components/musicVideo/MusicVideoLayout.jsx
index 7d9d9abdc9..8c2c9780f5 100644
--- a/client/src/components/musicVideo/MusicVideoLayout.jsx
+++ b/client/src/components/musicVideo/MusicVideoLayout.jsx
@@ -1,16 +1,17 @@
import { useEffect, useRef } from 'react';
import {
- ArrowRight, Bot, Check, Clapperboard, Film, History, LayoutGrid, Music, Pencil, Play, Send, Settings, Users,
+ ArrowRight, Bot, Check, Clapperboard, Film, History, Images, LayoutGrid, Music, Pencil, Play, Send, Settings, Users,
} from 'lucide-react';
import CancelRenderButton from './CancelRenderButton.jsx';
import TabPills from '../ui/TabPills.jsx';
import Pill from '../ui/Pill.jsx';
import { formatUsd } from '../../utils/formatters.js';
+import { MUSIC_VIDEO_PAGES } from '../../lib/musicVideoStages.js';
// One icon per step: the phone's bottom bar collapses to icons, and a repeated
// glyph would be a repeated destination.
const STAGE_ICONS = {
- setup: Music, 'cast-sets': Users, board: LayoutGrid, produce: Clapperboard, review: Film, publish: Send,
+ setup: Music, 'cast-sets': Users, board: LayoutGrid, produce: Clapperboard, review: Film, publish: Send, assets: Images,
};
// The page's scroll body (the route is full-width, so the page owns its
@@ -77,6 +78,28 @@ function StepRail({ stages, stage, onStageChange, needsYouStage, notes }) {
);
})}
</ol>
+ {/* Pages beside the steps (Assets): under a rule, with their icon in place of a number. */}
+ <ul className="mt-2 space-y-1 border-t border-port-border pt-2">
+ {MUSIC_VIDEO_PAGES.map((entry) => {
+ const Icon = STAGE_ICONS[entry.id];
+ const selected = entry.id === stage;
+ return (
+ <li key={entry.id}>
+ <button
+ type="button"
+ onClick={() => onStageChange(entry.id)}
+ aria-current={selected ? 'page' : undefined}
+ className={`flex w-full min-h-[44px] items-center gap-2 rounded-lg border px-2 py-2 text-left ${selected ? 'border-port-accent bg-port-accent/10' : 'border-transparent hover:bg-port-card'}`}
+ >
+ <span aria-hidden="true" className="flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-port-border text-port-text-muted">
+ <Icon size={13} />
+ </span>
+ <span className="text-sm font-medium text-port-text">{entry.label}</span>
+ </button>
+ </li>
+ );
+ })}
+ </ul>
</nav>
);
}
@@ -153,7 +176,7 @@ export default function MusicVideoLayout({
}, [stage]);
const needsYouStage = status?.needsYouStage || null;
- const tabs = progress.stages.map((entry) => {
+ const stepTabs = progress.stages.map((entry) => {
const state = stepState(entry, { needsYouStage });
return {
id: entry.id,
@@ -168,8 +191,10 @@ export default function MusicVideoLayout({
),
};
});
+ // The phone bar ends with the pages (Assets), icon only like the steps.
+ const tabs = [...stepTabs, ...MUSIC_VIDEO_PAGES.map((entry) => ({ id: entry.id, label: entry.label, icon: STAGE_ICONS[entry.id] }))];
const showSpend = spend.spentUsd > 0 || spend.capUsd > 0;
- const stageEntry = progress.stages.find((entry) => entry.id === stage);
+ const stageEntry = [...progress.stages, ...MUSIC_VIDEO_PAGES].find((entry) => entry.id === stage);
// Play runs something; an arrow goes somewhere (a step, or a Project settings tab).
const ActionIcon = nextAction?.kind === 'run' ? Play : ArrowRight;
diff --git a/client/src/components/musicVideo/MusicVideoLayout.test.jsx b/client/src/components/musicVideo/MusicVideoLayout.test.jsx
index 825a2e82e1..3acf06ea9c 100644
--- a/client/src/components/musicVideo/MusicVideoLayout.test.jsx
+++ b/client/src/components/musicVideo/MusicVideoLayout.test.jsx
@@ -1,7 +1,7 @@
import { describe, expect, it, vi } from 'vitest';
import { fireEvent, render, screen, within } from '@testing-library/react';
import MusicVideoLayout, { stepState } from './MusicVideoLayout.jsx';
-import { MUSIC_VIDEO_STAGES } from '../../lib/musicVideoStages.js';
+import { MUSIC_VIDEO_PAGES, MUSIC_VIDEO_STAGES } from '../../lib/musicVideoStages.js';
// Both the step list (md+) and the phone icon bar are "Steps"; only one shows at a time.
const stepNavs = () => screen.getAllByRole('navigation', { name: 'Steps' });
@@ -12,7 +12,7 @@ const progressFor = (current, states = {}) => ({
});
describe('music-video step navigation', () => {
- it('lists the six steps with a state word and one fact each, and opens a step on click', () => {
+ it('lists the six steps with a state word and one fact each, then Assets, and opens a step on click', () => {
const onStageChange = vi.fn();
render(<MusicVideoLayout project={{ id: 'example-project', name: 'Example Project', version: 2 }} stage="board" trackLabel="Example Track"
onStageChange={onStageChange} progress={progressFor('board', { setup: 'done', 'cast-sets': 'done' })}
@@ -28,13 +28,16 @@ describe('music-video step navigation', () => {
'4Shots' + 'Not started',
'5Final render' + 'Not started',
'6Publish' + 'Not started',
+ 'Assets',
]);
expect(steps[2]).toHaveAttribute('aria-current', 'step');
fireEvent.click(steps[3]);
expect(onStageChange).toHaveBeenCalledWith('produce');
+ fireEvent.click(steps[6]);
+ expect(onStageChange).toHaveBeenCalledWith('assets');
// The phone bar says each state to screen readers, since it shows only icons.
expect(within(phoneBar()).getAllByRole('tab').map((tab) => tab.textContent)).toEqual([
- 'Song, Done', 'Look, Done', 'Plan, Needs you', 'Shots, Not started', 'Final render, Not started', 'Publish, Not started',
+ 'Song, Done', 'Look, Done', 'Plan, Needs you', 'Shots, Not started', 'Final render, Not started', 'Publish, Not started', 'Assets',
]);
// The step names what "done" means under its title, and labels the panel.
expect(screen.getByRole('tabpanel', { name: 'Plan' })).toBeInTheDocument();
@@ -99,13 +102,13 @@ describe('music-video step navigation', () => {
expect(screen.getByRole('status', { name: 'Project status' })).toHaveClass('sr-only');
});
- it('keeps every step in the phone icon bar, each with its own icon', () => {
+ it('keeps every step and Assets in the phone icon bar, each with its own icon', () => {
render(<MusicVideoLayout project={{ id: 'example-project', name: 'Example Project' }} stage="publish"
onStageChange={() => {}} progress={progressFor('publish')} spend={{ spentUsd: 0 }} />);
const navigation = within(phoneBar());
expect(navigation.queryByRole('combobox')).not.toBeInTheDocument();
const tabs = navigation.getAllByRole('tab');
- expect(tabs).toHaveLength(MUSIC_VIDEO_STAGES.length);
+ expect(tabs).toHaveLength(MUSIC_VIDEO_STAGES.length + MUSIC_VIDEO_PAGES.length);
const icons = tabs.map((tab) => tab.querySelector('svg')?.getAttribute('class'));
expect(icons.every(Boolean)).toBe(true);
expect(new Set(icons).size).toBe(tabs.length);
diff --git a/client/src/components/musicVideo/SceneTakePicker.jsx b/client/src/components/musicVideo/SceneTakePicker.jsx
index 6278d69419..2a97c12b89 100644
--- a/client/src/components/musicVideo/SceneTakePicker.jsx
+++ b/client/src/components/musicVideo/SceneTakePicker.jsx
@@ -36,9 +36,9 @@ function otherFrameItem(scene, kind) {
const take = scene.takes?.find((t) => t.kind === other.takeKind && t.assetId === assetId);
return { kind: 'image', assetId, sceneId: scene.sceneId, prompt: take?.prompt || scene[other.prompt] || null, clipIds: [], ownFrame: other.label };
}
-const poolKey = (item) => `${item.kind}:${item.assetId}`;
+export const poolKey = (item) => `${item.kind}:${item.assetId}`;
/** "Used on #3, #12" for an item other shots (or this one) use now, else null. */
-const usedLabel = (item, shotNumbers) => {
+export const usedLabel = (item, shotNumbers) => {
const numbers = (item.inUseBy || []).map((id) => shotNumbers.get(id)).filter(Boolean);
return item.inUseBy?.length ? `Used on ${numbers.length ? numbers.map((n) => `#${n}`).join(', ') : 'a shot'}` : null;
};
@@ -274,7 +274,8 @@ export default function SceneTakePicker({ open, onClose, projectId, scene, kind,
);
}
-function DeleteConfirm({ count, noun, working, onConfirm, onCancel }) {
+/** Inline "Delete … from the media library?" with Yes, delete and Keep. */
+export function DeleteConfirm({ count, noun, working, onConfirm, onCancel }) {
return (
<div className="flex flex-wrap items-center gap-2 rounded border border-port-error/50 p-2 text-xs">
<span className="min-w-0 flex-1">Delete {count === 1 ? `this ${noun}` : `${formatCount(count)} ${noun}s`} from the media library? This can't be undone.</span>
diff --git a/client/src/components/musicVideo/stages/AssetsStage.jsx b/client/src/components/musicVideo/stages/AssetsStage.jsx
new file mode 100644
index 0000000000..8aed5eb2bc
--- /dev/null
+++ b/client/src/components/musicVideo/stages/AssetsStage.jsx
@@ -0,0 +1,211 @@
+import { useCallback, useEffect, useState } from 'react';
+import { useSearchParams } from 'react-router';
+import { Activity, Ban, Film, Image as ImageIcon, Pencil, Search, Star, Trash2 } from 'lucide-react';
+import TabPills from '../../ui/TabPills.jsx';
+import InfiniteScrollFooter from '../../ui/InfiniteScrollFooter.jsx';
+import { DeleteConfirm, filterPool, poolKey, usedLabel } from '../SceneTakePicker.jsx';
+import { shotNumbers as numberShots } from '../ShotStepper.jsx';
+import { deleteMusicVideoPoolAssets, getMusicVideoMediaPool, markMusicVideoPoolAssets, searchMusicVideoMediaPool } from '../../../services/apiMusicVideo.js';
+import { takeThumbUrl, takeClipUrl } from '../../../lib/musicVideoTakes.js';
+import { formatCount } from '../../../utils/formatters.js';
+
+const PAGE = 60;
+const KINDS = { stills: 'image', clips: 'video' };
+const NOUN = { image: 'still', video: 'clip' };
+// Unsorted is the sorting queue: not on a shot and not marked yet.
+const FILTERS = [
+ { id: 'all', label: 'All' }, { id: 'used', label: 'In use' }, { id: 'ingredient', label: '★ Ingredients' },
+ { id: 'unsorted', label: 'Unsorted' }, { id: 'bad', label: '✕ Bad' },
+];
+const inUse = (item) => item.inUseBy?.length > 0;
+const MATCHES = {
+ all: () => true,
+ used: inUse,
+ ingredient: (item) => item.mark === 'ingredient',
+ unsorted: (item) => !item.mark && !inUse(item),
+ bad: (item) => item.mark === 'bad',
+};
+const CHIP = 'min-h-[44px] rounded border px-2 text-xs sm:min-h-[28px]';
+const ACTION = 'inline-flex min-h-[44px] items-center gap-1 rounded border border-port-border px-3 text-xs disabled:opacity-50 sm:min-h-[32px]';
+
+/**
+ * Assets: every still and clip made for this video on one page, in shot order
+ * with the floor (takes a cut shot or a re-plan left behind) last. Search the
+ * prompts or a shot number, sort them ★ ingredient or ✕ bad, delete bad ones
+ * from the media library (the server refuses anything a shot uses), and jump
+ * to the shot a file was made for. The open tab and file are in the URL
+ * (`?kind=clips&asset=<id>`).
+ */
+export default function AssetsStage({ board }) {
+ const { project, takes, onEditShot } = board;
+ const projectId = project.id;
+ const shotNumbers = numberShots(project.scenes);
+ const [searchParams, setSearchParams] = useSearchParams();
+ const tab = searchParams.get('kind') === 'clips' ? 'clips' : 'stills';
+ const kind = KINDS[tab];
+ const pickedId = searchParams.get('asset');
+ const setParams = (changes) => setSearchParams((prev) => {
+ const next = new URLSearchParams(prev);
+ for (const [key, value] of Object.entries(changes)) { if (value) next.set(key, value); else next.delete(key); }
+ return next;
+ }, { replace: true });
+
+ const [pool, setPool] = useState(null);
+ const [error, setError] = useState(null);
+ const [query, setQuery] = useState('');
+ const [matches, setMatches] = useState(null);
+ const [filter, setFilter] = useState('all');
+ const [shown, setShown] = useState(PAGE);
+ const [confirmDelete, setConfirmDelete] = useState(null);
+ const [working, setWorking] = useState(false);
+
+ useEffect(() => {
+ let active = true;
+ setPool(null); setError(null);
+ getMusicVideoMediaPool(projectId, { silent: true })
+ .then((res) => { if (active) setPool(res.items || []); })
+ .catch((err) => { if (active) setError(err?.message || 'Could not load the assets'); });
+ return () => { active = false; };
+ }, [projectId]);
+
+ // Typing searches the prompts each file was made from, after a short pause.
+ useEffect(() => {
+ const q = query.trim();
+ setMatches(null);
+ if (!q) return undefined;
+ let active = true;
+ const timer = setTimeout(() => {
+ searchMusicVideoMediaPool(projectId, q, { silent: true })
+ .then((res) => { if (active) setMatches(new Set((res.items || []).map(poolKey))); })
+ .catch(() => { if (active) setMatches(new Set()); });
+ }, 300);
+ return () => { active = false; clearTimeout(timer); };
+ }, [projectId, query]);
+
+ const order = (item) => (item.sceneId && shotNumbers.get(item.sceneId)) || Infinity;
+ const searched = pool ? filterPool(pool, { kind, query, shotNumbers, matches }).sort((a, b) => order(a) - order(b)) : [];
+ const kindCounts = { stills: 0, clips: 0 };
+ for (const item of pool || []) if (item.kind === 'image') kindCounts.stills += 1; else if (item.kind === 'video') kindCounts.clips += 1;
+ const filterCounts = Object.fromEntries(FILTERS.map(({ id }) => [id, searched.filter(MATCHES[id]).length]));
+ const items = searched.filter(MATCHES[filter]);
+ const picked = pool?.find((item) => item.kind === kind && item.assetId === pickedId) || null;
+ const noun = NOUN[kind];
+ const pickedShot = picked?.sceneId ? shotNumbers.get(picked.sceneId) : null;
+
+ const run = (work) => { setWorking(true); setError(null); return work().catch((err) => setError(err?.message || 'That did not work')).finally(() => setWorking(false)); };
+ // Tapping the active mark clears it.
+ const toggleMark = (mark) => run(async () => {
+ const next = picked.mark === mark ? null : mark;
+ const result = await markMusicVideoPoolAssets(projectId, [{ kind: picked.kind, assetId: picked.assetId }], next, { silent: true });
+ // Bad rejects its takes on the shots not using it; the shots pick that up at once.
+ takes?.applyPoolMarks?.(projectId, result);
+ setPool((prev) => prev.map((item) => (poolKey(item) === poolKey(picked) ? { ...item, mark: next } : item)));
+ });
+ const remove = (targets) => run(async () => {
+ await deleteMusicVideoPoolAssets(projectId, targets.map(({ kind: k, assetId }) => ({ kind: k, assetId })), { silent: true });
+ const gone = new Set(targets.map(poolKey));
+ setPool((prev) => prev.filter((item) => !gone.has(poolKey(item))));
+ if (picked && gone.has(poolKey(picked))) setParams({ asset: null });
+ setConfirmDelete(null);
+ });
+ // A shot using it keeps it: the server refuses to delete it, so it's never offered.
+ const badHere = filter === 'bad' ? items.filter((item) => !inUse(item)) : [];
+ const showMore = useCallback(() => setShown((n) => n + PAGE), []);
+
+ return (
+ <div className="space-y-2">
+ <TabPills activeTab={tab} onChange={(id) => { setParams({ kind: id === 'clips' ? 'clips' : null, asset: null }); setShown(PAGE); setConfirmDelete(null); }}
+ variant="pills" size="sm"
+ tabs={[{ id: 'stills', label: 'Stills', icon: ImageIcon, count: kindCounts.stills }, { id: 'clips', label: 'Clips', icon: Film, count: kindCounts.clips }]} />
+ <label htmlFor="mv-assets-search" className="flex items-center gap-2 rounded border border-port-border bg-port-bg px-2">
+ <Search size={14} aria-hidden="true" className="shrink-0 text-port-text-muted" />
+ <span className="sr-only">Search prompts or shot number</span>
+ <input id="mv-assets-search" type="search" value={query} onChange={(e) => { setQuery(e.target.value); setShown(PAGE); }}
+ placeholder="Search prompts or shot #" className="min-h-[44px] min-w-0 flex-1 bg-transparent text-sm outline-none sm:min-h-[32px]" />
+ </label>
+ <div className="flex flex-wrap gap-1" role="group" aria-label="Show">
+ {FILTERS.map((entry) => (
+ <button key={entry.id} type="button" aria-pressed={filter === entry.id}
+ onClick={() => { setFilter(entry.id); setShown(PAGE); setConfirmDelete(null); }}
+ className={`${CHIP} ${filter === entry.id ? 'border-port-accent text-port-accent' : 'border-port-border'} ${entry.id === 'bad' ? 'text-port-error' : ''}`}>
+ {entry.label} {formatCount(filterCounts[entry.id], { fallback: '0' })}
+ </button>
+ ))}
+ </div>
+ {picked && (
+ <div className="space-y-2 rounded border border-port-border p-2">
+ {kind === 'video'
+ ? <video key={picked.assetId} src={takeClipUrl(picked)} poster={takeThumbUrl(picked)} controls autoPlay muted loop playsInline className="max-h-[60vh] w-full aspect-video rounded bg-black object-contain" />
+ : <img src={takeThumbUrl(picked)} alt="" className="max-h-[60vh] w-full aspect-video rounded bg-black object-contain" />}
+ <p className="text-[11px] text-port-text-muted">
+ {[pickedShot ? `Made for shot ${pickedShot}` : 'On the floor', usedLabel(picked, shotNumbers)].filter(Boolean).join(' · ')}
+ </p>
+ {picked.prompt && <p className="line-clamp-3 text-[11px] text-port-text-muted">{picked.prompt}</p>}
+ <div className="flex flex-wrap gap-2">
+ {pickedShot && onEditShot && (
+ <button type="button" onClick={() => onEditShot(picked.sceneId)} className={ACTION}>
+ <Pencil size={14} aria-hidden="true" />Open shot {pickedShot}
+ </button>
+ )}
+ <button type="button" disabled={working} onClick={() => toggleMark('ingredient')} aria-pressed={picked.mark === 'ingredient'}
+ title="Good, not placed yet: keep it as an ingredient" className={`${ACTION} ${picked.mark === 'ingredient' ? 'border-port-warning text-port-warning' : ''}`}>
+ <Star size={14} aria-hidden="true" />Ingredient
+ </button>
+ <button type="button" disabled={working} onClick={() => toggleMark('bad')} aria-pressed={picked.mark === 'bad'}
+ title="Failed or unusable: clean it up later" className={`${ACTION} ${picked.mark === 'bad' ? 'border-port-error text-port-error' : ''}`}>
+ <Ban size={14} aria-hidden="true" />Bad
+ </button>
+ {!inUse(picked) && (
+ <button type="button" disabled={working} onClick={() => setConfirmDelete('picked')} className={ACTION}>
+ <Trash2 size={14} aria-hidden="true" />Delete
+ </button>
+ )}
+ </div>
+ {confirmDelete === 'picked' && (
+ <DeleteConfirm count={1} noun={noun} working={working} onConfirm={() => remove([picked])} onCancel={() => setConfirmDelete(null)} />
+ )}
+ </div>
+ )}
+ {badHere.length > 0 && (confirmDelete === 'bad'
+ ? <DeleteConfirm count={badHere.length} noun={noun} working={working} onConfirm={() => remove(badHere)} onCancel={() => setConfirmDelete(null)} />
+ : (
+ <button type="button" disabled={working} onClick={() => setConfirmDelete('bad')}
+ className="inline-flex min-h-[44px] w-full items-center justify-center gap-1 rounded border border-port-error text-xs text-port-error disabled:opacity-50 sm:min-h-[32px]">
+ <Trash2 size={14} aria-hidden="true" />Delete {formatCount(badHere.length)} bad
+ </button>
+ ))}
+ {error && <p role="alert" className="text-xs text-port-error">{error}</p>}
+ {!pool && !error && <p className="flex items-center gap-2 text-xs text-port-text-muted"><Activity size={14} className="animate-spin" />Gathering every still and clip made for this video…</p>}
+ {pool && items.length === 0 && (
+ <p className="text-xs text-port-text-muted">{query && !matches ? 'Searching prompts…' : `No ${noun}s here.`}</p>
+ )}
+ <ul className="grid grid-cols-3 gap-2 sm:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8" aria-label={tab === 'clips' ? 'Clips' : 'Stills'}>
+ {items.slice(0, shown).map((item) => {
+ const number = item.sceneId ? shotNumbers.get(item.sceneId) : null;
+ const selected = picked?.assetId === item.assetId;
+ const used = usedLabel(item, shotNumbers);
+ return (
+ <li key={item.assetId}>
+ <button type="button" onClick={() => setParams({ asset: selected ? null : item.assetId })} aria-pressed={selected}
+ aria-label={`${noun}${number ? ` from shot ${number}` : ' on the floor'}${used ? `, ${used.toLowerCase()}` : ''}${item.prompt ? `: ${item.prompt.slice(0, 80)}` : ''}`}
+ className={`relative block w-full overflow-hidden rounded border ${selected ? 'border-port-accent ring-2 ring-port-accent' : 'border-port-border'} ${item.mark === 'bad' ? 'opacity-50' : ''}`}>
+ <img src={takeThumbUrl(item)} alt="" loading="lazy" className="block aspect-video w-full bg-black object-cover" />
+ <span className="port-media-overlay-strong absolute left-1 top-1 rounded px-1 text-[10px] leading-tight">{number ? `#${number}` : 'Floor'}</span>
+ {item.mark && (
+ <span className={`port-media-overlay-strong absolute right-1 top-1 rounded px-0.5 ${item.mark === 'bad' ? 'text-port-error' : 'text-port-warning'}`}>
+ {item.mark === 'bad' ? <Ban size={11} aria-label="bad" /> : <Star size={11} aria-label="ingredient" />}
+ </span>
+ )}
+ {inUse(item) && <span className="port-media-overlay-strong absolute bottom-1 left-1 rounded px-1 text-[10px] leading-tight">In use</span>}
+ </button>
+ </li>
+ );
+ })}
+ </ul>
+ {items.length > shown && (
+ <InfiniteScrollFooter hasMore loading={false} error={null} onLoadMore={showMore}
+ label={`Show more (${formatCount(items.length - shown)} left)`} />
+ )}
+ </div>
+ );
+}
diff --git a/client/src/components/musicVideo/stages/AssetsStage.test.jsx b/client/src/components/musicVideo/stages/AssetsStage.test.jsx
new file mode 100644
index 0000000000..1af1c24bfe
--- /dev/null
+++ b/client/src/components/musicVideo/stages/AssetsStage.test.jsx
@@ -0,0 +1,52 @@
+import { describe, expect, it, vi } from 'vitest';
+import { fireEvent, render, screen, waitFor, within } from '@testing-library/react';
+import { MemoryRouter } from 'react-router';
+
+const pool = [
+ { kind: 'image', assetId: 'late.png', sceneId: 's2', prompt: 'Reel on the bench', clipIds: [], inUseBy: ['s2'] },
+ { kind: 'image', assetId: 'floor.png', sceneId: null, prompt: 'Spare frame', clipIds: [] },
+ { kind: 'image', assetId: 'early.png', sceneId: 's1', prompt: 'Splicer close-up', clipIds: [] },
+ { kind: 'image', assetId: 'marked.png', sceneId: 's1', prompt: 'Out of focus', clipIds: [], mark: 'bad' },
+ { kind: 'video', assetId: 'clip-1', sceneId: 's1', sourceImageId: 'early.png', inUseBy: ['s1'] },
+];
+vi.mock('../../../services/apiMusicVideo.js', () => ({
+ getMusicVideoMediaPool: vi.fn(async () => ({ items: pool })),
+ markMusicVideoPoolAssets: vi.fn(async () => ({ assetMarks: { 'image:early.png': 'bad' } })),
+ deleteMusicVideoPoolAssets: vi.fn(async () => ({ deleted: 1 })),
+ searchMusicVideoMediaPool: vi.fn(async () => ({ items: [] })),
+}));
+const { default: AssetsStage } = await import('./AssetsStage.jsx');
+const api = await import('../../../services/apiMusicVideo.js');
+
+const project = { id: 'mv-1', scenes: [{ sceneId: 's2', startSec: 4 }, { sceneId: 's1', startSec: 0 }] };
+const renderPage = (board = {}) => render(
+ <MemoryRouter initialEntries={['/music-video/mv-1/assets']}>
+ <AssetsStage board={{ project, takes: { applyPoolMarks: vi.fn() }, onEditShot: vi.fn(), ...board }} />
+ </MemoryRouter>,
+);
+const tiles = () => within(screen.getByRole('list', { name: 'Stills' })).getAllByRole('button').map((b) => b.getAttribute('aria-label').split(':')[0]);
+
+describe('Music video Assets page', () => {
+ // Uniquely catches the page losing shot order, the floor's place, or the Unsorted queue counting used or marked files.
+ it('lists stills in shot order with the floor last, and Unsorted holds only unused, unmarked ones', async () => {
+ renderPage();
+ await waitFor(() => expect(tiles()).toHaveLength(4));
+ expect(tiles()).toEqual(['still from shot 1', 'still from shot 1', 'still from shot 2, used on #2', 'still on the floor']);
+ fireEvent.click(screen.getByRole('button', { name: 'Unsorted 2' }));
+ expect(tiles()).toEqual(['still from shot 1', 'still on the floor']);
+ expect(screen.getByRole('tab', { name: /Clips/ })).toBeTruthy();
+ });
+
+ // Uniquely catches a mark that skips the shots' take update, or Open shot losing which shot a file was made for.
+ it('marks a still bad, updates the shots, and opens the shot it was made for', async () => {
+ const applyPoolMarks = vi.fn();
+ const onEditShot = vi.fn();
+ renderPage({ takes: { applyPoolMarks }, onEditShot });
+ fireEvent.click(await screen.findByRole('button', { name: /still from shot 1: Splicer close-up/ }));
+ fireEvent.click(screen.getByRole('button', { name: 'Bad' }));
+ await waitFor(() => expect(api.markMusicVideoPoolAssets).toHaveBeenCalledWith('mv-1', [{ kind: 'image', assetId: 'early.png' }], 'bad', { silent: true }));
+ await waitFor(() => expect(applyPoolMarks).toHaveBeenCalledWith('mv-1', { assetMarks: { 'image:early.png': 'bad' } }));
+ fireEvent.click(screen.getByRole('button', { name: 'Open shot 1' }));
+ expect(onEditShot).toHaveBeenCalledWith('s1');
+ });
+});
diff --git a/client/src/lib/musicVideoStages.js b/client/src/lib/musicVideoStages.js
index c48f41f4c8..eae7189152 100644
--- a/client/src/lib/musicVideoStages.js
+++ b/client/src/lib/musicVideoStages.js
@@ -33,6 +33,14 @@ export const MUSIC_VIDEO_STAGES = [
{ id: 'publish', label: 'Publish', title: 'Publish', doneWhen: 'Done when every platform you turned on has a post.' },
];
+/**
+ * Pages beside the steps: listed under them, unnumbered, and never a step the
+ * project is "at". Assets is every still and clip made for the video.
+ */
+export const MUSIC_VIDEO_PAGES = [
+ { id: 'assets', label: 'Assets', title: 'Assets' },
+];
+
// Old links name the Compose tab, which is now part of Shots; the new names work as links too.
const LEGACY_STAGE_IDS = { compose: 'produce', plan: 'board', shots: 'produce' };
@@ -353,8 +361,9 @@ export function publishPlatformProgress(project, publish = {}) {
return { rows, posted, total: rows.length, done: rows.length ? posted === rows.length : posted > 0 };
}
-/** Resolve the `:stage` route param (a retired id maps to its step); an unknown or missing value is null. */
-export const resolveStageParam = (value) => (isStageId(value) ? value : LEGACY_STAGE_IDS[value] || null);
+/** Resolve the `:stage` route param (a step or a page; a retired id maps to its step); an unknown or missing value is null. */
+export const resolveStageParam = (value) => (isStageId(value) || MUSIC_VIDEO_PAGES.some((page) => page.id === value)
+ ? value : LEGACY_STAGE_IDS[value] || null);
// Footage-optional modes draw their own picture, so scene footage never gates Produce.
export const FOOTAGE_OPTIONAL_MODES = new Set(['code', 'document', 'eidoverse']);
diff --git a/client/src/pages/MusicVideo.jsx b/client/src/pages/MusicVideo.jsx
index 28cc4e342d..7b79c9ea00 100644
--- a/client/src/pages/MusicVideo.jsx
+++ b/client/src/pages/MusicVideo.jsx
@@ -84,6 +84,7 @@ import ProduceStage from '../components/musicVideo/stages/ProduceStage.jsx';
import ReviewStage from '../components/musicVideo/stages/ReviewStage.jsx';
import { PUBLISH_TARGETS } from '../components/musicVideo/PublishPostingPanel.jsx';
import PublishStage from '../components/musicVideo/stages/PublishStage.jsx';
+import AssetsStage from '../components/musicVideo/stages/AssetsStage.jsx';
import { compositionDraft } from '../components/musicVideo/compositionDraft.js';
import ContactSheetDrawer from '../components/musicVideo/ContactSheetDrawer.jsx';
import DevArtifactDrawer from '../components/musicVideo/DevArtifactDrawer.jsx';
@@ -139,6 +140,7 @@ const approvalStageFor = (tab, project, readiness, proofActive) => (tab === 'pro
const PLAYER_FIRST_STAGES = new Set(['board', 'produce', 'review']);
const STAGE_VIEWS = {
setup: SetupStage, 'cast-sets': CastSetsStage, board: PlanStage, produce: ProduceStage, review: ReviewStage, publish: PublishStage,
+ assets: AssetsStage,
};
@@ -1234,6 +1236,7 @@ export default function MusicVideo() {
reviewDraftState,
activeSceneId: routeSceneId || null,
onToggleSceneExpand: handleToggleSceneExpand,
+ onEditShot: editShot,
autopilotRun,
autonomous,
runStage,
@@ -1644,7 +1647,8 @@ export default function MusicVideo() {
}}
/>
)}
- dock={withTitleCard(
+ // Assets is a contact sheet: it takes the whole column, no player beside it.
+ dock={activeStage === 'assets' ? null : withTitleCard(
<PreviewDock
project={selected}
sources={previewSources}
diff --git a/server/lib/navManifest.js b/server/lib/navManifest.js
index a67d4cad62..0b6939934d 100644
--- a/server/lib/navManifest.js
+++ b/server/lib/navManifest.js
@@ -68,6 +68,7 @@ const RAW_NAV_COMMANDS = [
{ id: 'nav.create.music-video.produce', path: '/music-video/produce', label: 'Music Video Shots', section: 'Create', aliases: ['music-video-shots', 'mv-shots', 'scene-board', 'produce', 'music-video-produce', 'mv-produce', 'music-video-make', 'mv-make', 'compose', 'music-video-compose', 'mv-compose'], keywords: ['music video', 'shots', 'scenes', 'stills', 'clips', 'locks', 'make', 'footage', 'typography', 'takes', 'production'] },
{ id: 'nav.create.music-video.review', path: '/music-video/review', label: 'Music Video Final Render', section: 'Create', aliases: ['music-video-review', 'mv-review', 'music video review', 'music-video-render', 'mv-render'], keywords: ['music video', 'final render', 'render', 'review', 'export', 'drafts'] },
{ id: 'nav.create.music-video.publish', path: '/music-video/publish', label: 'Music Video Publish', section: 'Create', aliases: ['music-video-publish', 'mv-publish', 'music video publish'], keywords: ['music video', 'publish', 'release', 'kit', 'social'] },
+ { id: 'nav.create.music-video.assets', path: '/music-video/assets', label: 'Music Video Assets', section: 'Create', aliases: ['music-video-assets', 'mv-assets', 'music video assets', 'asset-manager', 'asset manager'], keywords: ['music video', 'assets', 'stills', 'clips', 'takes', 'ingredients', 'bad', 'cleanup', 'media'] },
{ id: 'nav.create.decks', path: '/decks', label: 'Decks', section: 'Create', aliases: ['decks', 'deck', 'card-deck', 'playing-cards', 'tarot', 'tarot-deck', 'cards'], keywords: ['playing cards', 'tarot', 'card deck', 'card design', 'suits', 'arcana', 'style guide', 'batch render', 'card art'] },
{ id: 'nav.create.mood-boards', path: '/mood-boards', label: 'Mood Boards', section: 'Create', aliases: ['mood-boards', 'mood-board', 'moodboard', 'mood', 'inspiration', 'references'], keywords: ['inspiration', 'reference', 'pin', 'visual', 'canvas', 'collect', 'pinboard', 'palette', 'ideas'] },
// Promoted out of the Media Gen tabs to a top-level Create page (#2930).