feat: Add conversion functionality to Knowledge Pipeline with UI and translations
parent
7c6bdb9ec9
commit
a2e0bc26c6
@ -0,0 +1,71 @@
|
|||||||
|
import React, { useCallback, useState } from 'react'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
|
import Button from '../base/button'
|
||||||
|
import PipelineScreenShot from './screenshot'
|
||||||
|
import Confirm from '../base/confirm'
|
||||||
|
|
||||||
|
const Conversion = () => {
|
||||||
|
const { t } = useTranslation()
|
||||||
|
const [showConfirmModal, setShowConfirmModal] = useState(false)
|
||||||
|
|
||||||
|
const handleConvert = useCallback(() => {
|
||||||
|
setShowConfirmModal(false)
|
||||||
|
// todo: Add conversion logic here
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
const handleShowConfirmModal = useCallback(() => {
|
||||||
|
setShowConfirmModal(true)
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
const handleCancelConversion = useCallback(() => {
|
||||||
|
setShowConfirmModal(false)
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='flex h-full w-full items-center justify-center bg-background-body p-6 pb-16'>
|
||||||
|
<div className='flex rounded-2xl border-[0.5px] border-components-card-border bg-components-card-bg shadow-sm shadow-shadow-shadow-4'>
|
||||||
|
<div className='flex max-w-[480px] flex-col justify-between p-10'>
|
||||||
|
<div className='flex flex-col gap-y-2.5'>
|
||||||
|
<div className='title-4xl-semi-bold text-text-primary'>
|
||||||
|
{t('datasetPipeline.conversion.title')}
|
||||||
|
</div>
|
||||||
|
<div className='body-md-medium'>
|
||||||
|
<span className='text-text-secondary'>{t('datasetPipeline.conversion.descriptionChunk1')}</span>
|
||||||
|
<span className='text-text-tertiary'>{t('datasetPipeline.conversion.descriptionChunk2')}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className='flex items-center gap-x-4'>
|
||||||
|
<Button
|
||||||
|
variant='primary'
|
||||||
|
className='w-32'
|
||||||
|
onClick={handleShowConfirmModal}
|
||||||
|
>
|
||||||
|
{t('datasetPipeline.operations.convert')}
|
||||||
|
</Button>
|
||||||
|
<span className='system-xs-regular text-text-warning'>
|
||||||
|
{t('datasetPipeline.conversion.warning')}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className='pb-8 pl-[25px] pr-0 pt-6'>
|
||||||
|
<div className='rounded-l-xl border border-effects-highlight bg-background-default p-1 shadow-md shadow-shadow-shadow-5 backdrop-blur-[5px]'>
|
||||||
|
<div className='overflow-hidden rounded-l-lg'>
|
||||||
|
<PipelineScreenShot />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{showConfirmModal && (
|
||||||
|
<Confirm
|
||||||
|
title={t('datasetPipeline.conversion.confirm.title')}
|
||||||
|
content={t('datasetPipeline.conversion.confirm.content')}
|
||||||
|
isShow={showConfirmModal}
|
||||||
|
onConfirm={handleConvert}
|
||||||
|
onCancel={handleCancelConversion}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default React.memo(Conversion)
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import useTheme from '@/hooks/use-theme'
|
||||||
|
import { basePath } from '@/utils/var'
|
||||||
|
import Image from 'next/image'
|
||||||
|
|
||||||
|
const PipelineScreenShot = () => {
|
||||||
|
const { theme } = useTheme()
|
||||||
|
|
||||||
|
return (
|
||||||
|
<picture>
|
||||||
|
<source media="(resolution: 1x)" srcSet={`${basePath}/screenshots/${theme}/Pipeline.png`} />
|
||||||
|
<source media="(resolution: 2x)" srcSet={`${basePath}/screenshots/${theme}/Pipeline@2x.png`} />
|
||||||
|
<source media="(resolution: 3x)" srcSet={`${basePath}/screenshots/${theme}/Pipeline@3x.png`} />
|
||||||
|
<Image
|
||||||
|
src={`${basePath}/screenshots/${theme}/Pipeline.png`}
|
||||||
|
alt='Pipeline Screenshot'
|
||||||
|
width={692} height={456} />
|
||||||
|
</picture>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default React.memo(PipelineScreenShot)
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 68 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 186 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 348 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 62 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 166 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 305 KiB |
Loading…
Reference in New Issue