Commit 9730b243 authored by Joel's avatar Joel

fix: can pass multi files

parent 818c0ce8
...@@ -42,6 +42,7 @@ const FileUploader = ({ ...@@ -42,6 +42,7 @@ const FileUploader = ({
const dropRef = useRef<HTMLDivElement>(null) const dropRef = useRef<HTMLDivElement>(null)
const dragRef = useRef<HTMLDivElement>(null) const dragRef = useRef<HTMLDivElement>(null)
const fileUploader = useRef<HTMLInputElement>(null) const fileUploader = useRef<HTMLInputElement>(null)
const hideUpload = notSupportBatchUpload && fileList.length > 0
const { data: fileUploadConfigResponse } = useSWR({ url: '/files/upload' }, fetchFileUploadConfig) const { data: fileUploadConfigResponse } = useSWR({ url: '/files/upload' }, fetchFileUploadConfig)
const { data: supportFileTypesResponse } = useSWR({ url: '/files/support-type' }, fetchSupportFileTypes) const { data: supportFileTypesResponse } = useSWR({ url: '/files/support-type' }, fetchSupportFileTypes)
...@@ -254,30 +255,36 @@ const FileUploader = ({ ...@@ -254,30 +255,36 @@ const FileUploader = ({
return ( return (
<div className={s.fileUploader}> <div className={s.fileUploader}>
<input {!hideUpload && (
ref={fileUploader} <input
id="fileUploader" ref={fileUploader}
style={{ display: 'none' }} id="fileUploader"
type="file" style={{ display: 'none' }}
multiple={!notSupportBatchUpload} type="file"
accept={ACCEPTS.join(',')} multiple={!notSupportBatchUpload}
onChange={fileChangeHandle} accept={ACCEPTS.join(',')}
/> onChange={fileChangeHandle}
/>
)}
<div className={cn(s.title, titleClassName)}>{t('datasetCreation.stepOne.uploader.title')}</div> <div className={cn(s.title, titleClassName)}>{t('datasetCreation.stepOne.uploader.title')}</div>
<div ref={dropRef} className={cn(s.uploader, dragging && s.dragging)}> {!hideUpload && (
<div className='flex justify-center items-center min-h-6 mb-2'>
<span className={s.uploadIcon} /> <div ref={dropRef} className={cn(s.uploader, dragging && s.dragging)}>
<span> <div className='flex justify-center items-center min-h-6 mb-2'>
{t('datasetCreation.stepOne.uploader.button')} <span className={s.uploadIcon} />
<label className={s.browse} onClick={selectHandle}>{t('datasetCreation.stepOne.uploader.browse')}</label> <span>
</span> {t('datasetCreation.stepOne.uploader.button')}
<label className={s.browse} onClick={selectHandle}>{t('datasetCreation.stepOne.uploader.browse')}</label>
</span>
</div>
<div className={s.tip}>{t('datasetCreation.stepOne.uploader.tip', {
size: fileUploadConfig.file_size_limit,
supportTypes: supportTypesShowNames,
})}</div>
{dragging && <div ref={dragRef} className={s.draggingCover} />}
</div> </div>
<div className={s.tip}>{t('datasetCreation.stepOne.uploader.tip', { )}
size: fileUploadConfig.file_size_limit,
supportTypes: supportTypesShowNames,
})}</div>
{dragging && <div ref={dragRef} className={s.draggingCover} />}
</div>
<div className={s.fileList}> <div className={s.fileList}>
{fileList.map((fileItem, index) => ( {fileList.map((fileItem, index) => (
<div <div
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment