AI media harness for planning, generating, and editing locally
TypeScript
Keep generation status over shot previews
Bittie62d7dae07ce
diff --git a/src/components/workspace/ShotThumbnail.test.tsx b/src/components/workspace/ShotThumbnail.test.tsxindex 15ca141..66d73b5 100644--- a/src/components/workspace/ShotThumbnail.test.tsx+++ b/src/components/workspace/ShotThumbnail.test.tsx@@ -117,7 +117,7 @@ describe("a shot's picture", () => {});});it("autoplays and loops generation in the card with the finished shot's controls", async () => {- const folder = "C:/Live preview", job = { ...rendered(folder), status: "generating" as const };+ const folder = "C:/Live preview", job = { ...rendered(folder), status: "generating" as const, progress: .42 };const preview = { jobId: "work", width: 256, height: 144, fps: 4, step: 1, frames: Array(36).fill("/9j/AA==") };await withFakeFile({ seconds: 9 }, async seen => {const contents = (url: string) => <GenerationPreviewContext.Provider value={{ preview, url }}>@@ -128,6 +128,8 @@ describe("a shot's picture", () => {const view = render(contents("blob:preview1"));await screen.findByRole("button", { name: "Pause shot 1 of First scene" });const video = document.querySelector(".shot-thumb video") as HTMLVideoElement;+ expect(screen.getByText("Rendering 42%").closest(".shot-thumb")).toBe(video.parentElement);+ expect(screen.getByText("Estimating time left…").closest(".shot-thumb")).toBe(video.parentElement);expect(video.autoplay).toBe(true); expect(video.loop).toBe(true); expect(video.muted).toBe(true);expect(video.currentTime).toBe(2); expect(seen.reads()).toBe(0);video.currentTime = 4; fireEvent.timeUpdate(video);diff --git a/src/components/workspace/ShotThumbnail.tsx b/src/components/workspace/ShotThumbnail.tsxindex a0c034d..8a03282 100644--- a/src/components/workspace/ShotThumbnail.tsx+++ b/src/components/workspace/ShotThumbnail.tsx@@ -446,6 +446,16 @@ export function ShotThumbnail({ folderPath, job, seconds, endSeconds = sceneDura}};+ const { icon, word } = placeholder(job, result.failed, cancelling);+ const estimateLine = job.status === "generating" && !cancelling+ ? estimatedCompletionAt === null+ ? "Estimating time left…"+ : formatEstimatedTimeLeft(estimatedCompletionAt - estimateNow)+ : null;+ const progress = job.status === "generating" && <span className="shot-thumb__progress" aria-hidden="true">+ <i style={{ width: `${Math.max(0, Math.min(100, job.progress * 100))}%` }} />+ </span>;+if (result.poster || generation) {const poster = generation ? `data:image/jpeg;base64,${generation.preview.frames[Math.min(generation.preview.frames.length - 1, Math.floor(at * generation.preview.fps))]}` : result.poster!;const shape = generation ? `${generation.preview.width} / ${generation.preview.height}` : POSTER_SHAPES.get(poster);@@ -480,6 +490,13 @@ export function ShotThumbnail({ folderPath, job, seconds, endSeconds = sceneDuraPOSTER_SHAPES.set(poster, `${width} / ${height}`);setShapeSeen((count) => count + 1);}} />}+ {generation && <>+ <span className="shot-thumb__status">+ <em>{word}</em>+ {estimateLine && <small className="shot-thumb__eta">{estimateLine}</small>}+ </span>+ {progress}+ </>}<span className={`shot-thumb__play ${loadingPlayback ? "shot-thumb__play--loading" : ""}`} aria-hidden="true">{loadingPlayback ? <Spinner20 className="spin" /> : playing ? <Pause20 /> : playFailed ? <Warning20 /> : <Play20Filled />}</span>@@ -494,18 +511,10 @@ export function ShotThumbnail({ folderPath, job, seconds, endSeconds = sceneDuraposter={poster} title={`shot ${shotNumber} of ${job.title}`} onClose={() => { setPopoutHost(null); popoutButton.current?.focus(); }} />, popoutHost)}</div>;}- const { icon, word } = placeholder(job, result.failed, cancelling);- const estimateLine = job.status === "generating" && !cancelling- ? estimatedCompletionAt === null- ? "Estimating time left…"- : formatEstimatedTimeLeft(estimatedCompletionAt - estimateNow)- : null;return <span className={`shot-thumb shot-thumb--${job.status}`} role="img" aria-label={`Shot ${shotNumber} — ${word}${estimateLine ? `. ${estimateLine}` : ""}`}>{icon}<em>{word}</em>{estimateLine && <small className="shot-thumb__eta">{estimateLine}</small>}- {job.status === "generating" && <span className="shot-thumb__progress" aria-hidden="true">- <i style={{ width: `${Math.max(0, Math.min(100, job.progress * 100))}%` }} />- </span>}+ {progress}</span>;}diff --git a/src/styles/generator.css b/src/styles/generator.cssindex 91578fe..bfeaea6 100644--- a/src/styles/generator.css+++ b/src/styles/generator.css@@ -707,6 +707,19 @@text-align: center;}+.shot-thumb__status {+ position: absolute;+ inset: auto 0 0;+ display: grid;+ gap: var(--space-1);+ padding: var(--space-4) var(--space-2) var(--space-2);+ color: var(--on-stage);+ background: linear-gradient(transparent, color-mix(in srgb, var(--stage-bg) 90%, transparent));+ pointer-events: none;+}++.shot-thumb__status .shot-thumb__eta { color: inherit; }+.shot-thumb--generating,.shot-thumb--ready {color: var(--accent-bright);