import { IModalProps } from '@/interfaces/common'; import { InboxOutlined } from '@ant-design/icons'; import { Flex, Modal, Segmented, Tabs, TabsProps, Upload, UploadFile, UploadProps, } from 'antd'; import { Dispatch, SetStateAction, useState } from 'react'; import { useHandleUploadFile } from '../hooks'; const { Dragger } = Upload; const FileUpload = ({ directory, fileList, setFileList, }: { directory: boolean; fileList: UploadFile[]; setFileList: Dispatch>; }) => { const props: UploadProps = { multiple: true, onRemove: (file) => { const index = fileList.indexOf(file); const newFileList = fileList.slice(); newFileList.splice(index, 1); setFileList(newFileList); }, beforeUpload: (file) => { setFileList((pre) => { return [...pre, file]; }); return false; }, directory, fileList, }; return (

Click or drag file to this area to upload

Support for a single or bulk upload. Strictly prohibited from uploading company data or other banned files.

); }; const FileUploadModal = ({ visible, hideModal }: IModalProps) => { const [value, setValue] = useState('local'); const { onFileUploadOk, fileUploadLoading } = useHandleUploadFile(); const [fileList, setFileList] = useState([]); const [directoryFileList, setDirectoryFileList] = useState([]); const onOk = () => { onFileUploadOk([...fileList, ...directoryFileList]); }; const items: TabsProps['items'] = [ { key: '1', label: 'File', children: ( ), }, { key: '2', label: 'Directory', children: ( ), }, ]; return ( <> {value === 'local' ? ( ) : ( 'coming soon' )} ); }; export default FileUploadModal;