import React, { useCallback } from 'react'; import { useDropzone } from 'react-dropzone'; import { Upload, FileText, Loader2 } from 'lucide-react'; import { useApp } from '../../context/AppContext'; export const FileUpload: React.FC = () => { const { state, handleUpload } = useApp(); const onDrop = useCallback( (acceptedFiles: File[]) => { const pdfFile = acceptedFiles.find(file => file.type === 'application/pdf'); if (pdfFile) { handleUpload(pdfFile); } }, [handleUpload] ); const { getRootProps, getInputProps, isDragActive } = useDropzone({ onDrop, accept: { 'application/pdf': ['.pdf'], }, maxFiles: 1, }); return (
Processing... {state.uploadProgress}%
Drop your PDF here
Drag & drop a PDF
or click to browse
Supports PDF files up to 10MB