'use client' import type { FC } from 'react' import React from 'react' import { useTranslation } from 'react-i18next' import { RiDeleteBinLine, } from '@remixicon/react' import Indicator from '../../../indicator' import Operate from '../data-source-notion/operate' import { DataSourceType } from './types' import s from './style.module.css' import cn from '@/utils/classnames' 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 || function () { } return (
{payload.name}
{ payload.isActive ? : }
{ payload.isActive ? t(isNotion ? 'common.dataSource.notion.connected' : 'common.dataSource.website.active') : t(isNotion ? 'common.dataSource.notion.disconnected' : 'common.dataSource.website.inactive') }
{isNotion && ( )} { isWebsite && !readOnly && (
) }
) } export default React.memo(ConfigItem)