| | |
| | | import DialogCloseButton from './DialogCloseButton'; |
| | | import { usePapaParse } from './usePapaParse'; |
| | | |
| | | export function ImportModal({ open, onClose, sampleCsv, useCodeImport }) { |
| | | const ImportModal = ({ open, onClose, importTemp, useCodeImport, onceBatch = 10 }) => { |
| | | const refresh = useRefresh(); |
| | | |
| | | const SAMPLE_URL = `data:text/csv;name=crm_contacts_sample.csv;charset=utf-8,${encodeURIComponent(sampleCsv.default)}`; |
| | | |
| | | const { processBatch } = useCodeImport(); |
| | | const { importer, parseCsv, reset } = usePapaParse({ |
| | | batchSize: 10, |
| | | batchSize: onceBatch, |
| | | processBatch, |
| | | }); |
| | | |
| | |
| | | component={Link} |
| | | label="Download CSV sample" |
| | | color="info" |
| | | to={SAMPLE_URL} |
| | | to={importTemp} |
| | | download={'crm_contacts_sample.csv'} |
| | | /> |
| | | } |
| | |
| | | |
| | | return `${minutes}m ${seconds}s`; |
| | | } |
| | | |
| | | export default ImportModal; |