feat: Refactor dataset components and update translations for new dataset creation options
parent
d1287f08b4
commit
9392ce259f
@ -1,42 +0,0 @@
|
|||||||
'use client'
|
|
||||||
import { useTranslation } from 'react-i18next'
|
|
||||||
import { basePath } from '@/utils/var'
|
|
||||||
import {
|
|
||||||
RiAddLine,
|
|
||||||
RiArrowRightLine,
|
|
||||||
} from '@remixicon/react'
|
|
||||||
|
|
||||||
const CreateAppCard = (
|
|
||||||
{
|
|
||||||
ref,
|
|
||||||
..._
|
|
||||||
},
|
|
||||||
) => {
|
|
||||||
const { t } = useTranslation()
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className='bg-background-default-dimm flex min-h-[160px] flex-col rounded-xl border-[0.5px]
|
|
||||||
border-components-panel-border transition-all duration-200 ease-in-out'
|
|
||||||
>
|
|
||||||
<a ref={ref} className='group flex grow cursor-pointer items-start p-4' href={`${basePath}/datasets/create`}>
|
|
||||||
<div className='flex items-center gap-3'>
|
|
||||||
<div className='flex h-10 w-10 items-center justify-center rounded-lg border border-dashed border-divider-regular bg-background-default-lighter
|
|
||||||
p-2 group-hover:border-solid group-hover:border-effects-highlight group-hover:bg-background-default-dodge'
|
|
||||||
>
|
|
||||||
<RiAddLine className='h-4 w-4 text-text-tertiary group-hover:text-text-accent'/>
|
|
||||||
</div>
|
|
||||||
<div className='system-md-semibold text-text-secondary group-hover:text-text-accent'>{t('dataset.createDataset')}</div>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
<div className='system-xs-regular p-4 pt-0 text-text-tertiary'>{t('dataset.createDatasetIntro')}</div>
|
|
||||||
<a className='group flex cursor-pointer items-center gap-1 rounded-b-xl border-t-[0.5px] border-divider-subtle p-4' href={`${basePath}/datasets/connect`}>
|
|
||||||
<div className='system-xs-medium text-text-tertiary group-hover:text-text-accent'>{t('dataset.connectDataset')}</div>
|
|
||||||
<RiArrowRightLine className='h-3.5 w-3.5 text-text-tertiary group-hover:text-text-accent' />
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
CreateAppCard.displayName = 'CreateAppCard'
|
|
||||||
|
|
||||||
export default CreateAppCard
|
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
'use client'
|
||||||
|
import React from 'react'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
|
import { basePath } from '@/utils/var'
|
||||||
|
import {
|
||||||
|
RiAddLine,
|
||||||
|
RiFunctionAddLine,
|
||||||
|
} from '@remixicon/react'
|
||||||
|
import Link from './link'
|
||||||
|
import { ApiConnectionMod } from '@/app/components/base/icons/src/vender/solid/development'
|
||||||
|
|
||||||
|
type CreateAppCardProps = {
|
||||||
|
ref: React.RefObject<HTMLAnchorElement>
|
||||||
|
}
|
||||||
|
|
||||||
|
const CreateAppCard = ({
|
||||||
|
ref,
|
||||||
|
..._
|
||||||
|
}: CreateAppCardProps) => {
|
||||||
|
const { t } = useTranslation()
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='flex min-h-[166px] flex-col gap-y-0.5 rounded-xl bg-background-default-dimmed'>
|
||||||
|
<div className='flex grow flex-col items-center justify-center p-2'>
|
||||||
|
<Link href={`${basePath}/datasets/create-pipeline`} Icon={RiFunctionAddLine} text={t('dataset.createFromPipeline')} />
|
||||||
|
<Link ref={ref} href={`${basePath}/datasets/create`} Icon={RiAddLine} text={t('dataset.createDataset')} />
|
||||||
|
</div>
|
||||||
|
<div className='border-t-[0.5px] border-divider-subtle p-2'>
|
||||||
|
<Link href={`${basePath}/datasets/connect`} Icon={ApiConnectionMod} text={t('dataset.connectDataset')} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
CreateAppCard.displayName = 'CreateAppCard'
|
||||||
|
|
||||||
|
export default CreateAppCard
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
type LinkProps = {
|
||||||
|
Icon: React.ComponentType<{ className?: string }>
|
||||||
|
text: string
|
||||||
|
href: string
|
||||||
|
ref?: React.RefObject<HTMLAnchorElement>
|
||||||
|
}
|
||||||
|
|
||||||
|
const Link = ({
|
||||||
|
Icon,
|
||||||
|
text,
|
||||||
|
href,
|
||||||
|
ref,
|
||||||
|
}: LinkProps) => {
|
||||||
|
return (
|
||||||
|
<a
|
||||||
|
ref={ref}
|
||||||
|
className='flex w-full items-center gap-x-2 rounded-lg bg-transparent px-4 py-2 text-text-tertiary shadow-shadow-shadow-3 hover:bg-background-default-dodge hover:text-text-secondary hover:shadow-xs'
|
||||||
|
href={href}
|
||||||
|
>
|
||||||
|
<Icon className='h-4 w-4' />
|
||||||
|
<span className='system-sm-medium'>{text}</span>
|
||||||
|
</a>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Link
|
||||||
Loading…
Reference in New Issue