AI media harness for planning, generating, and editing locally
TypeScript
Restore open video when returning to Video tab
Bitti08d7eb59a8a4
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.mdindex 268d4ab..d6d5292 100644--- a/RELEASE_NOTES.md+++ b/RELEASE_NOTES.md@@ -22,7 +22,7 @@ Changes since 0.3.2.## Fixes and improvements-- Video cards match Shot sizing, show the opening playback frame and open scenes on click; card/popout playback shares Timeline's prepared players and continuous display.+- Video cards match Shot sizing, show the opening playback frame and open scenes on click; playback shares Timeline's prepared players. Returning to the Video tab restores the open video.- Editing generated music creates a separate draft; cards distinguish drafts from playable songs.- Single Shot uses previous latents only as its starting anchor, fresh noise for the middle and a generated ending anchor, avoiding repeated source imagery.- Updated First/Last Frame Fast to the eight-step FastH3 Omni model and corrected Omni and First/Last Frame weight fallbacks.diff --git a/src/components/ProjectWorkspace.tsx b/src/components/ProjectWorkspace.tsxindex b12e69e..ab06911 100644--- a/src/components/ProjectWorkspace.tsx+++ b/src/components/ProjectWorkspace.tsx@@ -152,6 +152,7 @@ export function ProjectWorkspace({ project, initialView, runtime = null, onBack,const [savingProjectSettings, setSavingProjectSettings] = useState(false);const [selectedGenerationJobId, setSelectedGenerationJobId] = useState<string | undefined>(project.config.generationJobs[0]?.id);const [videoNavigation, setVideoNavigation] = useState<{ id: string }>();+ const [openVideoId, setOpenVideoId] = useState<string>();const [imageNavigation, setImageNavigation] = useState<{ id: string }>();const [musicNavigation, setMusicNavigation] = useState<{ id: string }>();const [referenceNavigation, setReferenceNavigation] = useState<{ id: string }>();@@ -304,7 +305,7 @@ export function ProjectWorkspace({ project, initialView, runtime = null, onBack,</div>}{view === "editor" && <ImageEditor openImage={imageNavigation} onImageOpened={() => setImageNavigation(undefined)} config={config} folderPath={project.folderPath} onChange={changeConfig} onGenerate={(template, count) => queue.enqueueImage(session, template, count)} onGenerateCharacterSheet={(template, sourceId, options) => queue.enqueueCharacterSheet(session, template, sourceId, options)} onGenerateExtend={(template, sourceId, options) => queue.enqueueExtendImage(session, template, sourceId, options)} onCancel={(id) => queue.cancel(id)} workItems={projectItems.filter((item) => item.kind === "image")} onOpenGenerator={(jobId) => { setSelectedGenerationJobId(jobId); setVideoNavigation(jobId ? { id: jobId } : undefined); setView("generator"); }} onOpenReferences={() => setView("references")} />}{view === "timeline" && <TimelineView config={config} openSceneId={selectedGenerationJobId} folderPath={project.folderPath} generationCompletionTimes={generationCompletionTimes} onChange={changeConfig} onMeasured={recordMeasurement} onOpenGenerator={(jobId) => { setSelectedGenerationJobId(jobId); setVideoNavigation(jobId ? { id: jobId } : undefined); setView("generator"); }} />}- {view === "generator" && <VideoLibraryView openScene={videoNavigation} onSceneOpened={() => setVideoNavigation(undefined)} onGenerate={(submissions) => queue.enqueue(session, submissions)} onCancelGeneration={(ids) => queue.cancelScenes(session, ids)} cancellingJobIds={cancellingJobIds} config={config} folderPath={project.folderPath} generationCompletionTimes={generationCompletionTimes} runtime={runtime?.slopfab ?? null} onRuntimeChange={onGeneratorRuntimeChange} onChange={changeConfig} selectedJobId={selectedGenerationJobId} onSelectedJobChange={setSelectedGenerationJobId} onOpenTimeline={() => setView("timeline")} />}+ {view === "generator" && <VideoLibraryView initialOpenVideoId={openVideoId} onOpenVideoChange={setOpenVideoId} openScene={videoNavigation} onSceneOpened={() => setVideoNavigation(undefined)} onGenerate={(submissions) => queue.enqueue(session, submissions)} onCancelGeneration={(ids) => queue.cancelScenes(session, ids)} cancellingJobIds={cancellingJobIds} config={config} folderPath={project.folderPath} generationCompletionTimes={generationCompletionTimes} runtime={runtime?.slopfab ?? null} onRuntimeChange={onGeneratorRuntimeChange} onChange={changeConfig} selectedJobId={selectedGenerationJobId} onSelectedJobChange={setSelectedGenerationJobId} onOpenTimeline={() => setView("timeline")} />}{view === "references" && <ReferencesView openReference={referenceNavigation} onReferenceOpened={() => setReferenceNavigation(undefined)} config={config} folderPath={project.folderPath} onChange={changeConfig} onRegenerateIcon={(id) => queue.regenerateReferenceIcon(session, id)} onExportRefmod={(id, outputPath) => queue.exportReferenceRefmod(session, id, outputPath)} onGenerateBuiltinIcons={() => queue.generateBuiltinReferenceIcons(session)} onRegenerateBuiltinIcon={(id) => queue.regenerateBuiltinReferenceIcon(session, id)} pendingBuiltinIconIds={queue.pendingBuiltinIconIds()} pendingIconIds={new Set(config.references.filter((reference) => queue.isReferenceIconPending(session, reference.id)).map((reference) => reference.id))} onOpenGenerator={(jobId) => { setSelectedGenerationJobId(jobId); setVideoNavigation(jobId ? { id: jobId } : undefined); setView("generator"); }} />}{view === "export" && <div className="project-export"><SelectorBar aria-label="Export type" className="project-export__types" value={mediaMode} onChange={setMediaMode} items={[{ value: "video", label: "Video" }, { value: "image", label: "Image" }, { value: "music", label: "Music" }]} />diff --git a/src/components/workspace/VideoLibraryView.test.tsx b/src/components/workspace/VideoLibraryView.test.tsxindex 1832caa..fa3d5c6 100644--- a/src/components/workspace/VideoLibraryView.test.tsx+++ b/src/components/workspace/VideoLibraryView.test.tsx@@ -61,6 +61,34 @@ it("creates a whole-song scene sequence and opens the owner for a timeline navigconst next = view.config(); view.unmount(); mount(next, { id: next.generationJobs[1].id }); expect(screen.getByLabelText("Scenes editor")).toBeInTheDocument();});+it("restores the open video after leaving the tab, respects Back and lets scene navigation override it", () => {+ const config = project();+ config.videoFolders = [{ id: "folder", name: "Collection" }];+ config.videos = [{ ...newVideo("folder"), title: "First", sceneIds: ["a"] }, { ...newVideo(null), title: "Second", sceneIds: ["b"] }];+ config.generationJobs = ["a", "b"].map((id) => createDraftGenerationJob(id, { id }));+ function Harness() {+ const [visible, setVisible] = useState(true), [openId, setOpenId] = useState<string>();+ const [openScene, setOpenScene] = useState<{ id: string }>();+ return <><button onClick={() => setVisible(!visible)}>Switch tab</button><button onClick={() => { setOpenScene({ id: "b" }); setVisible(true); }}>Open scene B</button>+ {visible && <VideoLibraryView config={config} folderPath="D:/Project" onChange={() => {}} onOpenTimeline={() => {}}+ initialOpenVideoId={openId} onOpenVideoChange={setOpenId} openScene={openScene} onSceneOpened={() => setOpenScene(undefined)} />}</>;+ }+ render(<Harness />);+ const switchTab = () => fireEvent.click(screen.getByRole("button", { name: "Switch tab" }));+ fireEvent.click(screen.getByRole("button", { name: "Open Collection" }));+ fireEvent.click(screen.getByRole("button", { name: "Open First" }));+ switchTab(); expect(screen.queryByLabelText("Scenes editor")).not.toBeInTheDocument(); switchTab();+ expect(screen.getByLabelText("Scenes editor")).toHaveTextContent("a");+ fireEvent.click(screen.getByRole("button", { name: "Back to Video" }));+ expect(screen.getByRole("button", { name: "Open First" })).toBeInTheDocument();+ switchTab(); switchTab(); expect(screen.queryByLabelText("Scenes editor")).not.toBeInTheDocument();+ fireEvent.click(screen.getByRole("button", { name: "Open Collection" }));+ fireEvent.click(screen.getByRole("button", { name: "Open First" }));+ switchTab(); fireEvent.click(screen.getByRole("button", { name: "Open scene B" }));+ expect(screen.getByLabelText("Scenes editor")).toHaveTextContent("b");+ switchTab(); switchTab(); expect(screen.getByLabelText("Scenes editor")).toHaveTextContent("b");+});+it("removes folders without deleting their videos and removes video scenes without removing timeline media", async () => {const config = project(); config.videoFolders = [{ id: "folder", name: "Collection" }]; config.videos = [{ ...newVideo("folder"), title: "Film", sceneIds: ["a"] }]; config.generationJobs = [createDraftGenerationJob("A", { id: "a" })];const view = mount(config); fireEvent.contextMenu(screen.getByRole("button", { name: "Open Collection" })); fireEvent.click(screen.getByRole("menuitem", { name: "Remove folder" }));diff --git a/src/components/workspace/VideoLibraryView.tsx b/src/components/workspace/VideoLibraryView.tsxindex 82c5f53..4dee42a 100644--- a/src/components/workspace/VideoLibraryView.tsx+++ b/src/components/workspace/VideoLibraryView.tsx@@ -16,13 +16,13 @@ const VIDEO_DRAG = "application/x-slopus-video";const sourceValue = (source: VideoSource | null | undefined) => source ? `${source.kind}:${source.id}` : "";const parseSource = (value: string): VideoSource | null => value ? { kind: value.startsWith("asset:") ? "asset" : "reference", id: value.slice(value.indexOf(":") + 1) } : null;-export function VideoLibraryView(props: ComponentProps<typeof GeneratorView> & { openScene?: { id: string }; onSceneOpened?: () => void }) {+export function VideoLibraryView(props: ComponentProps<typeof GeneratorView> & { openScene?: { id: string }; onSceneOpened?: () => void; initialOpenVideoId?: string; onOpenVideoChange?: (id: string | undefined) => void }) {const { config, onChange, folderPath } = props;const latest = useRef(config); latest.current = config;const videos = videoLibrary(config), folders = config.videoFolders ?? [];- const [folderId, setFolderId] = useState<string | null>(null);- const [selectedId, setSelectedId] = useState<string>();- const [openId, setOpenId] = useState<string>();+ const [folderId, setFolderId] = useState<string | null>(() => videos.find((video) => video.id === props.initialOpenVideoId)?.folderId ?? null);+ const [selectedId, setSelectedId] = useState<string | undefined>(props.initialOpenVideoId);+ const [openId, setOpenId] = useState<string | undefined>(props.initialOpenVideoId);const [playback, setPlayback] = useState<{ id: string; popout: boolean }>();const [creatingFolder, setCreatingFolder] = useState(false), [folderName, setFolderName] = useState("");const [view, setView] = useState<"grid" | "list">(() => localStorage.getItem("slopus.video.view") === "list" ? "list" : "grid");@@ -32,6 +32,7 @@ export function VideoLibraryView(props: ComponentProps<typeof GeneratorView> & {const visible = videos.filter((video) => (video.folderId ?? null) === currentFolderId);const selected = visible.find((video) => video.id === selectedId) ?? visible[0];const open = videos.find((video) => video.id === openId);+ useEffect(() => { props.onOpenVideoChange?.(open?.id); }, [open?.id, props.onOpenVideoChange]);const playing = videos.find((video) => video.id === playback?.id);const breadcrumbs: { id: string | null; name: string }[] = [];const visited = new Set<string>();