'use client' import type { FC } from 'react' import { RiDeleteBinLine, } from '@remixicon/react' import { noop } from 'es-toolkit/function' import * as React from 'react' import { useTranslation } from 'react-i18next' import { cn } from '@/utils/classnames' import Indicator from '../../../indicator' import Operate from '../data-source-notion/operate' import s from './style.module.css' import { DataSourceType } from './types' export type ConfigItemType = { id: string logo: any name: string isActive: boolean notionConfig?: { total: number } } type Props = { type: DataSourceType payload: ConfigItemType onRemove: () => void notionActions?: { onChangeAuthorizedPage: () => void } readOnly: boolean } const ConfigItem: FC = ({ type, payload, onRemove, notionActions, readOnly, }) => { const { t } = useTranslation() const isNotion = type === DataSourceType.notion const isWebsite = type === DataSourceType.website const onChangeAuthorizedPage = notionActions?.onChangeAuthorizedPage || noop return (
{payload.name}
{ payload.isActive ? : }
{ payload.isActive ? t(isNotion ? 'dataSource.notion.connected' : 'dataSource.website.active', { ns: 'common' }) : t(isNotion ? 'dataSource.notion.disconnected' : 'dataSource.website.inactive', { ns: 'common' }) }
{isNotion && ( )} { isWebsite && !readOnly && (
) }
) } export default React.memo(ConfigItem)