AI media harness for planning, generating, and editing locally
TypeScript
Fix image project cover startup crash
Bitti1b9f31067e79
diff --git a/src/App.test.tsx b/src/App.test.tsxindex ea758d8..733488c 100644--- a/src/App.test.tsx+++ b/src/App.test.tsx@@ -53,6 +53,26 @@ describe("project library controls", () => {beforeEach(() => localStorage.clear());afterEach(cleanup);+ it("loads a saved image project with a generated cover and no timeline clips", async () => {+ const config = createProjectConfig({ name: "Saved illustration", prompt: "A ceramic lamp", generationType: "image", aspectRatio: "16:9", resolution: "1080p", targetDurationSeconds: 30 });+ config.assets = [{+ id: "image-cover", kind: "image", name: "Generated illustration", relativePath: "media/illustration.jpg", sourcePath: null,+ mimeType: "image/jpeg", durationMs: null, width: 1920, height: 1088, createdAt: config.createdAt,+ }];+ config.imageScene!.outputAssetId = "image-cover";+ expect(config.timeline.tracks.every((track) => track.clips.length === 0)).toBe(true);+ localStorage.setItem("slopus.web-projects.v1", JSON.stringify([{ folderPath: "~/Slopus/Saved illustration", config }]));++ render(<App />);++ const card = await screen.findByRole("button", { name: "Open Saved illustration" });+ expect(card.querySelector(".media-thumb")).toHaveAttribute("aria-label", "Generated illustration");+ fireEvent.click(card);+ expect(await screen.findByRole("button", { name: "Editor" })).toHaveAttribute("aria-current", "page");+ fireEvent.click(screen.getByRole("button", { name: "Back to project library" }));+ expect(await screen.findByRole("button", { name: "Open Saved illustration" })).toBeInTheDocument();+ });+it("uses a named New Project form with a default Look instead of a length", async () => {render(<App />);await screen.findByText("Northern Light — Brand Film");diff --git a/src/components/ProjectCard.tsx b/src/components/ProjectCard.tsxindex 97b90bf..56737fd 100644--- a/src/components/ProjectCard.tsx+++ b/src/components/ProjectCard.tsx@@ -58,6 +58,7 @@ export function ProjectCard({ project, index, onOpen, onDelete }: ProjectCardProassetsById,);const firstAsset = config.generationType === "image" ? config.assets.find((asset) => asset.id === config.imageScene?.outputAssetId) : firstClip ? config.assets.find((asset) => asset.id === firstClip.assetId) : undefined;+ const posterTimeMs = firstClip?.sourceStartMs ?? 0;useEffect(() => {if (!menuOpen) return;@@ -84,10 +85,10 @@ export function ProjectCard({ project, index, onOpen, onDelete }: ProjectCardPro<button className="project-card__art-button" onClick={() => onOpen(project)} aria-label={`Open ${config.name}`}><div className={`project-card__art project-card__art--${artwork[index % artwork.length]}${firstAsset ? " project-card__art--media" : ""}`} style={style}>{firstAsset && <MediaThumbnail- key={`${firstAsset.id}-${(firstClip?.sourceStartMs ?? 0)}`}+ key={`${firstAsset.id}-${posterTimeMs}`}folderPath={project.folderPath}asset={firstAsset}- posterTimeSeconds={firstClip!.sourceStartMs / 1000}+ posterTimeSeconds={posterTimeMs / 1000}jpegQuality={0.9}/>}<span className="project-card__format"><Ratio size={13} /> {config.settings.aspectRatio}</span>