import React, { useCallback } from 'react'; import { useDropzone } from 'react-dropzone'; import { UploadIcon } from 'lucide-react'; import { __ } from '@wordpress/i18n'; export const FileUploader = ({ accept, maxSize, onUpload }) => { const onDrop = useCallback((acceptedFiles) => { if (acceptedFiles?.[0]) { onUpload(acceptedFiles[0]); } }, [onUpload]); const { getRootProps, getInputProps, isDragActive } = useDropzone({ onDrop, accept: { 'application/pdf': ['.pdf'] }, maxSize: maxSize * 1024 * 1024, // Convert MB to bytes multiple: false }); return (

{isDragActive ? __('Drop the file here...', 'aisk-ai-chat') : __('Drag & drop a PDF file here, or click to select', 'aisk-ai-chat')}

{__('Maximum file size:', 'aisk-ai-chat')} {maxSize}MB

); };