diff --git a/src/components/FileUpload.tsx b/src/components/FileUpload.tsx index 6e10fd77..d25214bd 100644 --- a/src/components/FileUpload.tsx +++ b/src/components/FileUpload.tsx @@ -1,6 +1,6 @@ "use client"; -import { useRef, useState, useEffect} from "react"; +import { useRef, useState, useEffect } from "react"; import { Film, FolderOpen } from "lucide-react"; import LottiePlayer from "./LottiePlayer"; import uploadAnim from "@/lib/lottie/upload.json"; @@ -25,7 +25,7 @@ export default function FileUpload({ const [dragging, setDragging] = useState(false); const [error, setError] = useState(""); const [warning, setWarning] = useState(""); - + useEffect(() => { const handler = (e: KeyboardEvent) => { if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "o") { @@ -41,18 +41,11 @@ export default function FileUpload({ setError(""); setWarning(""); - // Validate type if (!file.type.startsWith("video/")) { setError("Only video files are allowed."); return; } - if (file.size > 500 * 1024 * 1024) { - setError("File size exceeds 500MB limit. Please select a smaller video."); - return; - } - - // Hard limit if (file.size > MAX_FILE_SIZE) { setError( `File too large (${formatBytes( @@ -62,7 +55,6 @@ export default function FileUpload({ return; } - // Soft warning if (file.size > WARNING_FILE_SIZE) { const estimatedMinutes = Math.max(1, Math.round(file.size / (100 * 1024 * 1024))); setWarning( @@ -83,58 +75,62 @@ export default function FileUpload({ if (file) handleFile(file); }; - const FileInfo = () => ( -
- {currentFile?.name} -
- {currentFile && ( - - {currentFile.name.includes(".") - ? currentFile.name.split(".").pop() - : "VIDEO"} - - )} + const FileInfo = () => ( +{formatBytes(currentFile?.size ?? 0)}
- -
+
+ {currentFile?.name} +
++ {formatBytes(currentFile?.size ?? 0)} {duration > 0 - ? `Duration: ${formatDuration(duration)}` - : "Loading duration..."} + ? ` - ${formatDuration(duration)}` + : " - Loading duration..."}
+ Supports MP4, MOV, AVI, MKV, WebM, and most video formats +
++
{fileError}
)} +- Supports: MP4, MOV, AVI, MKV, WebM, and most video formats -
- - {fileError && ( -{fileError}
- )} - - { - const f = e.target.files?.[0]; - if (f) handleFile(f); - }} - /> -+ {feedback} +
+ )} ++ Custom +
++ {recipe.customWidth} x {recipe.customHeight} - {getOrientationLabel( + recipe.customWidth || 1, + recipe.customHeight || 1, + )} +
+- We detected a {recommendedPreset.label.replace(/\s/g, "")} video → Recommended: {recommendedPreset.platform.split("·")[0].trim()} ({recommendedPreset.label.replace(/\s/g, "")}) + We detected a {recommendedPreset.label.replace(/\s/g, "")} video - Recommended: {recommendedPreset.platform.split("·")[0].trim()} ({recommendedPreset.label.replace(/\s/g, "")})