refactor: reduce code duplication

This commit is contained in:
Maze Winther
2025-09-01 16:19:14 +02:00
parent 350b55081c
commit dd02e31380
2 changed files with 3 additions and 8 deletions
@@ -13,6 +13,7 @@ import {
DialogTitle, DialogTitle,
} from "@/components/ui/dialog"; } from "@/components/ui/dialog";
import { Progress } from "@/components/ui/progress"; import { Progress } from "@/components/ui/progress";
import { createMainScene } from "@/stores/project-store";
interface MigrationProgress { interface MigrationProgress {
current: number; current: number;
@@ -87,13 +88,7 @@ export function ScenesMigrator({ children }: { children: React.ReactNode }) {
const migrateLegacyProject = async (project: TProject) => { const migrateLegacyProject = async (project: TProject) => {
try { try {
const mainScene: Scene = { const mainScene = createMainScene();
id: generateUUID(),
name: "Main Scene",
isMain: true,
createdAt: new Date(),
updatedAt: new Date(),
};
const migratedProject: TProject = { const migratedProject: TProject = {
...project, ...project,
+1 -1
View File
@@ -11,7 +11,7 @@ import { CanvasSize, CanvasMode } from "@/types/editor";
export const DEFAULT_CANVAS_SIZE: CanvasSize = { width: 1920, height: 1080 }; export const DEFAULT_CANVAS_SIZE: CanvasSize = { width: 1920, height: 1080 };
export const DEFAULT_FPS = 30; export const DEFAULT_FPS = 30;
function createMainScene(): Scene { export function createMainScene(): Scene {
return { return {
id: generateUUID(), id: generateUUID(),
name: "Main Scene", name: "Main Scene",