#
luxiaotao1123
2024-09-19 baf8c53a9d798861451a68620cdb946083d5c8a1
zy-acs-flow/src/page/components/ImportModal.jsx
File was renamed from zy-acs-flow/src/page/code/ImportModal.jsx
@@ -1,3 +1,4 @@
import { useEffect, useState } from 'react';
import { Box, CircularProgress, Stack, Typography } from '@mui/material';
import Alert from '@mui/material/Alert';
import Dialog from '@mui/material/Dialog';
@@ -14,20 +15,16 @@
    useRefresh,
} from 'react-admin';
import { Link } from 'react-router-dom';
import { DialogCloseButton } from '../misc/DialogCloseButton';
import { usePapaParse } from '../misc/usePapaParse';
import { ContactImportSchema, useContactImport } from './useContactImport';
import DialogCloseButton from './DialogCloseButton';
import { usePapaParse } from './usePapaParse';
import { MouseEvent, useEffect, useState } from 'react';
import * as sampleCsv from './contacts_export.csv?raw';
const SAMPLE_URL = `data:text/csv;name=crm_contacts_sample.csv;charset=utf-8,${encodeURIComponent(sampleCsv.default)}`;
export function ImportModal({ open, onClose }) {
export function ImportModal({ open, onClose, sampleCsv, useCodeImport }) {
    const refresh = useRefresh();
    const { processBatch } = useContactImport();
    const { importer, parseCsv, reset } = usePapaParse<ContactImportSchema>({
    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,
        processBatch,
    });