Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions electron/ai-edition/document-service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ describe("DocumentService", () => {
});

describe("createProject", () => {
it("creates a v5 doc with the given title and writes it to disk", async () => {
it("creates a v6 doc with the given title and writes it to disk", async () => {
const doc = await service.createProject("Demo Project");
expect(doc.schemaVersion).toBe(5);
expect(doc.schemaVersion).toBe(6);
expect(doc.project.title).toBe("Demo Project");
expect(doc.project.id).toMatch(/^proj_/);
expect(doc.assets).toEqual([]);

const filePath = path.join(tempDir, `${doc.project.id}.openscreen`);
const raw = await fs.readFile(filePath, "utf8");
expect(JSON.parse(raw)).toMatchObject({
schemaVersion: 5,
schemaVersion: 6,
project: { title: "Demo Project" },
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/components/ai-edition/WebcamOverlay.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const CLIP_WITHOUT_CAMERA: AxcutClip = {

function makeDocument(): AxcutDocument {
return {
schemaVersion: 5,
schemaVersion: 6,
project: {
id: "proj_test",
title: "Test",
Expand Down
24 changes: 5 additions & 19 deletions src/components/ai-edition/v4/V4Timeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { ZOOM_DEPTH_SCALES } from "@/components/video-editor/types";
import { useScopedT } from "@/contexts/I18nContext";
import { useAudioPeaks } from "@/hooks/useAudioPeaks";
import { createId } from "@/lib/ai-edition/document/ids";
import { collectNativeFormats, referenceClipDims } from "@/lib/ai-edition/document/outputFormat";
import { collectNativeFormats } from "@/lib/ai-edition/document/outputFormat";
import type { AxcutClip } from "@/lib/ai-edition/schema";
import { useProjectStore } from "@/lib/ai-edition/store/projectStore";
import { useChatPromptBus } from "@/lib/ai-edition/store/useChatPromptBus";
Expand All @@ -46,11 +46,7 @@ import {
} from "@/lib/ai-edition/timeline/trim-mapping";
import { buildAutoZoomSuggestions } from "@/lib/ai-edition/timeline/zoom-suggestions";
import { nativeBridgeClient } from "@/native/client";
import {
ASPECT_RATIO_PRESETS,
getAspectRatioLabel,
toAspectRatioToken,
} from "@/utils/aspectRatioUtils";
import { ASPECT_RATIO_PRESETS, getAspectRatioLabel } from "@/utils/aspectRatioUtils";
import { TransportBar } from "../TransportBar";
import type { VideoSource } from "../VirtualPreview";
import styles from "./EditorShellV4.module.css";
Expand Down Expand Up @@ -271,16 +267,6 @@ export function V4Timeline({
// stays a pure list of fixed choices, and "which shapes are my clips" lives solely in ORIGINAL
// (no more per-preset badge, which split that one answer across two places).
const timelineIsMixed = nativeFormats.length > 1;
// A project saved before the shapes were enumerated still stores "native". Resolve it to the
// shape it currently means so the menu highlights a real row (and the button names a real
// ratio) instead of showing a selection that matches nothing. Picking that row rewrites the
// document to the concrete token — which is how those projects self-migrate off the value
// that silently moved with the clip list.
const activeToken = useMemo(() => {
if (settings.aspectRatio !== "native" || !document) return settings.aspectRatio;
const reference = referenceClipDims(document);
return toAspectRatioToken(reference.width, reference.height) ?? settings.aspectRatio;
}, [settings.aspectRatio, document]);

const [aspectMenuOpen, setAspectMenuOpen] = useState(false);
const [autoEnhanceOpen, setAutoEnhanceOpen] = useState(false);
Expand Down Expand Up @@ -1115,7 +1101,7 @@ export function V4Timeline({
title={t("toolbar.aspectRatio")}
aria-label={t("toolbar.aspectRatio")}
>
{getAspectRatioLabel(activeToken)}
{getAspectRatioLabel(settings.aspectRatio)}
<ChevronDown size={10} />
</button>
</PopoverTrigger>
Expand All @@ -1134,7 +1120,7 @@ export function V4Timeline({
type="button"
key={ratio}
className={`${styles.recMenuRow}${
ratio === activeToken ? ` ${styles.active}` : ""
ratio === settings.aspectRatio ? ` ${styles.active}` : ""
}`}
onClick={() => {
void setSettings({ aspectRatio: ratio });
Expand All @@ -1152,7 +1138,7 @@ export function V4Timeline({
type="button"
key={format.token}
className={`${styles.recMenuRow}${
format.token === activeToken ? ` ${styles.active}` : ""
format.token === settings.aspectRatio ? ` ${styles.active}` : ""
}`}
onClick={() => {
void setSettings({ aspectRatio: format.token });
Expand Down
2 changes: 1 addition & 1 deletion src/lib/ai-edition/document/migrate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe("migrateProjectDataToAxcutDocument", () => {
it("produces a v3 document with one asset and one clip from a v2 single-recording project", () => {
const doc = migrateProjectDataToAxcutDocument(makeV2Project());

expect(doc.schemaVersion).toBe(5);
expect(doc.schemaVersion).toBe(6);
expect(doc.assets).toHaveLength(1);
const asset = doc.assets[0];
expect(asset.kind).toBe("video");
Expand Down
Loading
Loading