2025-06-30 16:16:16 +08:00
|
|
|
import { memo } from 'react'
|
2025-06-27 15:01:33 +08:00
|
|
|
import Item from './item'
|
2025-06-30 16:16:16 +08:00
|
|
|
import Configure from './configure'
|
2025-07-17 11:17:49 +08:00
|
|
|
import type { DataSourceAuth } from './types'
|
|
|
|
import { useRenderI18nObject } from '@/hooks/use-i18n'
|
|
|
|
|
|
|
|
type CardProps = {
|
|
|
|
item: DataSourceAuth
|
|
|
|
}
|
|
|
|
const Card = ({
|
|
|
|
item,
|
|
|
|
}: CardProps) => {
|
|
|
|
const renderI18nObject = useRenderI18nObject()
|
|
|
|
const {
|
|
|
|
icon,
|
|
|
|
label,
|
|
|
|
author,
|
|
|
|
provider,
|
|
|
|
credentials_list,
|
|
|
|
} = item
|
2025-06-27 15:01:33 +08:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div className='rounded-xl bg-background-section-burn'>
|
|
|
|
<div className='flex items-center p-3 pb-2'>
|
2025-07-17 11:17:49 +08:00
|
|
|
<img
|
|
|
|
src={icon}
|
|
|
|
className='mr-3 flex h-10 w-10 shrink-0 items-center justify-center'
|
|
|
|
/>
|
2025-06-27 15:01:33 +08:00
|
|
|
<div className='grow'>
|
|
|
|
<div className='system-md-semibold text-text-primary'>
|
2025-07-17 11:17:49 +08:00
|
|
|
{renderI18nObject(label)}
|
2025-06-27 15:01:33 +08:00
|
|
|
</div>
|
|
|
|
<div className='system-xs-regular flex h-4 items-center text-text-tertiary'>
|
2025-07-17 11:17:49 +08:00
|
|
|
{author}
|
2025-06-27 15:01:33 +08:00
|
|
|
<div className='text-text-quaternary'>/</div>
|
2025-07-17 11:17:49 +08:00
|
|
|
{provider}
|
2025-06-27 15:01:33 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
2025-06-30 16:16:16 +08:00
|
|
|
<Configure />
|
2025-06-27 15:01:33 +08:00
|
|
|
</div>
|
|
|
|
<div className='system-xs-medium flex h-4 items-center pl-3 text-text-tertiary'>
|
|
|
|
Connected workspace
|
|
|
|
<div className='ml-3 h-[1px] grow bg-divider-subtle'></div>
|
|
|
|
</div>
|
2025-07-17 11:17:49 +08:00
|
|
|
{
|
|
|
|
!!credentials_list.length && (
|
|
|
|
<div className='space-y-1 p-3 pt-2'>
|
|
|
|
<Item />
|
|
|
|
<Item />
|
|
|
|
<Item />
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
{
|
|
|
|
!credentials_list.length && (
|
|
|
|
<div className='p-3 pt-1'>
|
|
|
|
<div className='system-xs-regular flex h-10 items-center justify-center rounded-[10px] bg-background-section text-text-tertiary'>
|
|
|
|
Please configure authentication
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
2025-06-27 15:01:33 +08:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2025-06-30 16:16:16 +08:00
|
|
|
export default memo(Card)
|