import React, { useState, useRef } from 'react'; import { Upload, Music, FileAudio } from 'lucide-react'; import './FileUpload.css'; const FileUpload = ({ onFileUpload }) => { const [isDragOver, setIsDragOver] = useState(false); const fileInputRef = useRef(null); const handleDragOver = (e) => { e.preventDefault(); setIsDragOver(true); }; const handleDragLeave = (e) => { e.preventDefault(); setIsDragOver(false); }; const handleDrop = (e) => { e.preventDefault(); setIsDragOver(false); const files = e.dataTransfer.files; if (files.length > 0) { handleFileSelect(files[0]); } }; const handleFileSelect = (file) => { if (file && file.type.startsWith('audio/')) { onFileUpload(file); } else { alert('Please select a valid audio file (MP3, WAV, FLAC, etc.)'); } }; const handleClick = () => { fileInputRef.current?.click(); }; const handleFileInputChange = (e) => { const file = e.target.files[0]; if (file) { handleFileSelect(file); } }; return (
Drag and drop an audio file here, or click to browse
Upload your audio file
AI separates the tracks
Download isolated stems