From 6a22a3ecbdff2d0e6a4c24c8db40bb86bc01b692 Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Sat, 25 Apr 2026 03:56:22 +0200 Subject: refactor: centralize editor interaction state Move timeline and preview gestures into dedicated controllers so hooks stay thin around editor state and DOM events. This also routes drag and playback synchronization through manager APIs and reuses persistent wasm surfaces so scrubbing, seeking, and preview rendering stay in sync. Made-with: Cursor --- apps/web/src/media/use-file-upload.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'apps/web/src/media') diff --git a/apps/web/src/media/use-file-upload.ts b/apps/web/src/media/use-file-upload.ts index 1ee30ad9..c8c62073 100644 --- a/apps/web/src/media/use-file-upload.ts +++ b/apps/web/src/media/use-file-upload.ts @@ -1,5 +1,5 @@ import { useState, useRef } from "react"; -import { hasDragData } from "@/timeline/drag-data"; +import { useEditor } from "@/editor/use-editor"; interface UseFileUploadOptions { accept?: string; @@ -7,19 +7,23 @@ interface UseFileUploadOptions { onFilesSelected?: (files: File[]) => void; } -function containsFiles(dataTransfer: DataTransfer): boolean { - return !hasDragData({ dataTransfer }) && dataTransfer.types.includes("Files"); -} - export function useFileUpload({ accept, multiple, onFilesSelected, }: UseFileUploadOptions = {}) { + const editor = useEditor(); const [isDragOver, setIsDragOver] = useState(false); const dragCounterRef = useRef(0); const inputRef = useRef(null); + function containsFiles(dataTransfer: DataTransfer): boolean { + return ( + !editor.timeline.dragSource.isActive() && + dataTransfer.types.includes("Files") + ); + } + function openFilePicker() { if (!inputRef.current) return; -- cgit v1.3.1