Commit 8a521916 authored by StyleZhang's avatar StyleZhang

fix: dataset document add pages tip

parent 226f28ed
...@@ -12,6 +12,7 @@ import { upload } from '@/service/base' ...@@ -12,6 +12,7 @@ import { upload } from '@/service/base'
type IFileUploaderProps = { type IFileUploaderProps = {
file?: FileEntity file?: FileEntity
titleClassName?: string
onFileUpdate: (file?: FileEntity) => void onFileUpdate: (file?: FileEntity) => void
} }
...@@ -29,7 +30,7 @@ const ACCEPTS = [ ...@@ -29,7 +30,7 @@ const ACCEPTS = [
const MAX_SIZE = 15 * 1024 * 1024 const MAX_SIZE = 15 * 1024 * 1024
const FileUploader = ({ file, onFileUpdate }: IFileUploaderProps) => { const FileUploader = ({ file, onFileUpdate, titleClassName }: IFileUploaderProps) => {
const { t } = useTranslation() const { t } = useTranslation()
const { notify } = useContext(ToastContext) const { notify } = useContext(ToastContext)
const [dragging, setDragging] = useState(false) const [dragging, setDragging] = useState(false)
...@@ -189,7 +190,7 @@ const FileUploader = ({ file, onFileUpdate }: IFileUploaderProps) => { ...@@ -189,7 +190,7 @@ const FileUploader = ({ file, onFileUpdate }: IFileUploaderProps) => {
accept={ACCEPTS.join(',')} accept={ACCEPTS.join(',')}
onChange={fileChangeHandle} onChange={fileChangeHandle}
/> />
<div className={s.title}>{t('datasetCreation.stepOne.uploader.title')}</div> <div className={cn(s.title, titleClassName)}>{t('datasetCreation.stepOne.uploader.title')}</div>
<div ref={dropRef}> <div ref={dropRef}>
{!currentFile && !file && ( {!currentFile && !file && (
<div className={cn(s.uploader, dragging && s.dragging)}> <div className={cn(s.uploader, dragging && s.dragging)}>
......
...@@ -80,53 +80,61 @@ const StepOne = ({ ...@@ -80,53 +80,61 @@ const StepOne = ({
return ( return (
<div className='flex w-full h-full'> <div className='flex w-full h-full'>
<div className='grow overflow-y-auto relative'> <div className='grow overflow-y-auto relative'>
<div className={s.stepHeader}>{t('datasetCreation.steps.one')}</div> {
!datasetId && (
<div className={s.stepHeader}>{t('datasetCreation.steps.one')}</div>
)
}
<div className={s.form}> <div className={s.form}>
<div className={s.dataSourceTypeList}> {
<div !datasetId && (
className={cn( <div className={s.dataSourceTypeList}>
s.dataSourceItem, <div
dataSourceType === DataSourceType.FILE && s.active, className={cn(
dataSourceTypeDisable && dataSourceType !== DataSourceType.FILE && s.disabled, s.dataSourceItem,
)} dataSourceType === DataSourceType.FILE && s.active,
onClick={() => { dataSourceTypeDisable && dataSourceType !== DataSourceType.FILE && s.disabled,
if (dataSourceTypeDisable) )}
return onClick={() => {
changeType(DataSourceType.FILE) if (dataSourceTypeDisable)
hidePreview() return
}} changeType(DataSourceType.FILE)
> hidePreview()
<span className={cn(s.datasetIcon)} /> }}
{t('datasetCreation.stepOne.dataSourceType.file')} >
</div> <span className={cn(s.datasetIcon)} />
<div {t('datasetCreation.stepOne.dataSourceType.file')}
className={cn( </div>
s.dataSourceItem, <div
dataSourceType === DataSourceType.NOTION && s.active, className={cn(
dataSourceTypeDisable && dataSourceType !== DataSourceType.NOTION && s.disabled, s.dataSourceItem,
)} dataSourceType === DataSourceType.NOTION && s.active,
onClick={() => { dataSourceTypeDisable && dataSourceType !== DataSourceType.NOTION && s.disabled,
if (dataSourceTypeDisable) )}
return onClick={() => {
changeType(DataSourceType.NOTION) if (dataSourceTypeDisable)
hidePreview() return
}} changeType(DataSourceType.NOTION)
> hidePreview()
<span className={cn(s.datasetIcon, s.notion)} /> }}
{t('datasetCreation.stepOne.dataSourceType.notion')} >
</div> <span className={cn(s.datasetIcon, s.notion)} />
<div {t('datasetCreation.stepOne.dataSourceType.notion')}
className={cn(s.dataSourceItem, s.disabled, dataSourceType === DataSourceType.WEB && s.active)} </div>
// onClick={() => changeType(DataSourceType.WEB)} <div
> className={cn(s.dataSourceItem, s.disabled, dataSourceType === DataSourceType.WEB && s.active)}
<span className={s.comingTag}>Coming soon</span> // onClick={() => changeType(DataSourceType.WEB)}
<span className={cn(s.datasetIcon, s.web)} /> >
{t('datasetCreation.stepOne.dataSourceType.web')} <span className={s.comingTag}>Coming soon</span>
</div> <span className={cn(s.datasetIcon, s.web)} />
</div> {t('datasetCreation.stepOne.dataSourceType.web')}
</div>
</div>
)
}
{dataSourceType === DataSourceType.FILE && ( {dataSourceType === DataSourceType.FILE && (
<> <>
<FileUploader onFileUpdate={updateFile} file={file} /> <FileUploader onFileUpdate={updateFile} file={file} titleClassName={datasetId && 'mt-[30px] !mb-[44px] !text-lg !font-semibold !text-gray-900'} />
<Button disabled={!file} className={s.submitButton} type='primary' onClick={onStepChange}>{t('datasetCreation.stepOne.button')}</Button> <Button disabled={!file} className={s.submitButton} type='primary' onClick={onStepChange}>{t('datasetCreation.stepOne.button')}</Button>
</> </>
)} )}
......
...@@ -220,7 +220,7 @@ const Documents: FC<IDocumentsProps> = ({ datasetId }) => { ...@@ -220,7 +220,7 @@ const Documents: FC<IDocumentsProps> = ({ datasetId }) => {
? <Loading type='app' /> ? <Loading type='app' />
: total > 0 : total > 0
? <List documents={documentsList || []} datasetId={datasetId} onUpdate={mutate} /> ? <List documents={documentsList || []} datasetId={datasetId} onUpdate={mutate} />
: <EmptyElement onClick={routeToDocCreate} /> : <EmptyElement onClick={routeToDocCreate} type={isDataSourceNotion ? 'sync' : 'upload'} />
} }
{/* Show Pagination only if the total is more than the limit */} {/* Show Pagination only if the total is more than the limit */}
{(total && total > limit) {(total && total > limit)
......
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