'use client' import type { FC } from 'react' import React from 'react' import { useTranslation } from 'react-i18next' import { PlusIcon } from '@heroicons/react/24/solid' import cn from 'classnames' import type { ConfigItemType } from './config-item' import ConfigItem from './config-item' import s from './style.module.css' import { DataSourceType } from './types' type Props = { type: DataSourceType isConfigured: boolean onConfigure: () => void readonly: boolean isSupportList?: boolean configuredList: ConfigItemType[] onRemove: () => void notionActions?: { onChangeAuthorizedPage: () => void } } const Panel: FC = ({ type, isConfigured, onConfigure, readonly, configuredList, isSupportList, onRemove, notionActions, }) => { const { t } = useTranslation() const isNotion = type === DataSourceType.notion const isWebsite = type === DataSourceType.website return (
{t(`common.dataSource.${type}.title`)}
{isWebsite && (
{t('common.dataSource.website.with')} 🔥 FireCrawl
)}
{ !isConfigured && (
{t(`common.dataSource.${type}.description`)}
) }
{isNotion && ( <> { isConfigured ? (
{t('common.dataSource.configure')}
) : ( <> {isSupportList &&
{t('common.dataSource.notion.addWorkspace')}
} ) } )} {isWebsite && !isConfigured && (
{t('common.dataSource.configure')}
)}
{ isConfigured && (
{isNotion ? t('common.dataSource.notion.connectedWorkspace') : t('common.dataSource.website.configuredCrawlers')}
) } { isConfigured && (
{ configuredList.map(item => ( )) }
) }
) } export default React.memo(Panel)