import { useRef, useState } from 'react' function UploadBox({ onUpload, isUploading }) { const inputRef = useRef(null) const [isDragOver, setIsDragOver] = useState(false) const handleClick = () => { if (!isUploading) { inputRef.current?.click() } } const handleChange = (e) => { const file = e.target.files?.[0] if (file) { onUpload(file) } } const handleDragOver = (e) => { e.preventDefault() setIsDragOver(true) } const handleDragLeave = (e) => { e.preventDefault() setIsDragOver(false) } const handleDrop = (e) => { e.preventDefault() setIsDragOver(false) const file = e.dataTransfer.files?.[0] if (file) { onUpload(file) } } return (
{isUploading ? 'Creating shorts...' : 'Drag & drop or click to browse' }