summaryrefslogtreecommitdiff
path: root/apps/web/src/stores/timeline-store.ts
diff options
context:
space:
mode:
authorSimon Orzel <simonorzel@gmail.com>2025-07-20 18:35:06 +0200
committerSimon Orzel <simonorzel@gmail.com>2025-07-20 18:35:06 +0200
commitb03287df8d6fa14153af264c6a3e3da5b2a06153 (patch)
tree100b2c2a729295419dce61655bca418e74195ec4 /apps/web/src/stores/timeline-store.ts
parent061624ab588afff18073ae62fbac425c1aa5cf3a (diff)
parentba3da43728bc051aa033dc7b45042b0f0f788e63 (diff)
downloadopencut-b03287df8d6fa14153af264c6a3e3da5b2a06153.tar.gz
Merge branch 'main' into feat/project-preview-images
Diffstat (limited to 'apps/web/src/stores/timeline-store.ts')
-rw-r--r--apps/web/src/stores/timeline-store.ts40
1 files changed, 25 insertions, 15 deletions
diff --git a/apps/web/src/stores/timeline-store.ts b/apps/web/src/stores/timeline-store.ts
index 25a56943..ca4da916 100644
--- a/apps/web/src/stores/timeline-store.ts
+++ b/apps/web/src/stores/timeline-store.ts
@@ -1,27 +1,28 @@
+import { toast } from "sonner";
import { create } from "zustand";
+import { TIMELINE_CONSTANTS } from "@/constants/timeline-constants";
+import { storageService } from "@/lib/storage/storage-service";
+import { checkElementOverlaps, resolveElementOverlaps } from "@/lib/timeline";
+import { generateUUID } from "@/lib/utils";
import {
- TrackType,
- TimelineElement,
- CreateTimelineElement,
- TimelineTrack,
- TextElement,
- DragData,
- sortTracksByOrder,
+ type CreateTimelineElement,
+ type DragData,
ensureMainTrack,
+ sortTracksByOrder,
+ type TextElement,
+ type TimelineElement,
+ type TimelineTrack,
+ type TrackType,
validateElementTrackCompatibility,
} from "@/types/timeline";
import { useEditorStore } from "./editor-store";
import {
- useMediaStore,
getMediaAspectRatio,
type MediaItem,
+ type MediaType,
+ useMediaStore,
} from "./media-store";
-import { storageService } from "@/lib/storage/storage-service";
import { useProjectStore } from "./project-store";
-import { generateUUID } from "@/lib/utils";
-import { TIMELINE_CONSTANTS } from "@/constants/timeline-constants";
-import { toast } from "sonner";
-import { checkElementOverlaps, resolveElementOverlaps } from "@/lib/timeline";
// Helper function to manage element naming with suffixes
const getElementNameWithSuffix = (
@@ -782,7 +783,7 @@ export const useTimelineStore = create<TimelineStore>((set, get) => {
// For ripple editing, we need to move elements that come after the moved element
const currentElementStart = currentElement.startTime;
- const currentElementEnd =
+ const _currentElementEnd =
currentElement.startTime +
(currentElement.duration -
currentElement.trimStart -
@@ -1072,7 +1073,16 @@ export const useTimelineStore = create<TimelineStore>((set, get) => {
if (!fileType) return false;
// Process the new media file
- let mediaData: any = {
+ const mediaData: {
+ name: string;
+ type: MediaType;
+ file: File;
+ url: string;
+ duration?: number;
+ thumbnailUrl?: string;
+ width?: number;
+ height?: number;
+ } = {
name: newFile.name,
type: fileType,
file: newFile,