import React, { useCallback } from 'react'; import { Upload, FileText, Loader2 } from 'lucide-react'; import { motion } from 'framer-motion'; const FileUpload = ({ onFileUpload, loading = false }) => { const handleDrop = useCallback((e) => { if (loading) return; // Prevent upload while processing e.preventDefault(); e.stopPropagation(); const files = Array.from(e.dataTransfer.files); if (files.length > 0) { onFileUpload(files); } }, [onFileUpload, loading]); const handleDragOver = (e) => { e.preventDefault(); e.stopPropagation(); }; const handleFileSelect = (e) => { if (loading) return; // Prevent upload while processing const files = Array.from(e.target.files); if (files.length > 0) { onFileUpload(files); } }; return ( !loading && document.getElementById('fileInput').click()} >
{loading ? ( ) : ( )}

{loading ? 'Processando arquivos...' : 'Arraste e solte seus arquivos CSV'}

{loading ? 'Aguarde enquanto processamos seus dados' : 'ou clique para selecionar do computador'}

{!loading && (
Google Maps Exports
)}
); }; export default FileUpload;