dify/web/app/components/plugins/plugin-detail-panel/endpoint-list.tsx

50 lines
1.5 KiB
TypeScript
Raw Normal View History

2024-10-12 16:29:46 +08:00
import React from 'react'
2024-10-13 10:49:55 +08:00
import { useTranslation } from 'react-i18next'
2024-10-19 14:18:51 +08:00
import { RiAddLine } from '@remixicon/react'
2024-10-19 14:46:17 +08:00
import type { EndpointListItem, PluginEndpointDeclaration } from '../types'
2024-10-19 14:18:51 +08:00
import EndpointCard from './endpoint-card'
2024-10-13 10:49:55 +08:00
import ActionButton from '@/app/components/base/action-button'
import Tooltip from '@/app/components/base/tooltip'
2024-10-19 14:18:51 +08:00
type Props = {
2024-10-19 14:46:17 +08:00
declaration: PluginEndpointDeclaration
list: EndpointListItem[]
2024-10-13 10:49:55 +08:00
}
2024-10-12 16:29:46 +08:00
2024-10-19 14:18:51 +08:00
const EndpointList = ({
declaration,
list,
}: Props) => {
2024-10-13 10:49:55 +08:00
const { t } = useTranslation()
2024-10-12 16:29:46 +08:00
return (
2024-10-13 10:49:55 +08:00
<div className='px-4 py-2 border-t border-divider-subtle'>
<div className='mb-1 h-6 flex items-center justify-between text-text-secondary system-sm-semibold-uppercase'>
<div className='flex items-center gap-0.5'>
{t('plugin.detailPanel.endpoints')}
<Tooltip
popupContent={
2024-10-19 14:46:17 +08:00
<div className='w-[180px]'>TODO</div>
2024-10-13 10:49:55 +08:00
}
/>
</div>
<ActionButton>
<RiAddLine className='w-4 h-4' />
</ActionButton>
</div>
2024-10-19 14:18:51 +08:00
{list.length === 0 && (
<div className='mb-1 p-3 flex justify-center rounded-[10px] bg-background-section text-text-tertiary system-xs-regular'>{t('plugin.detailPanel.endpointsEmpty')}</div>
)}
2024-10-13 10:49:55 +08:00
<div className='flex flex-col gap-2'>
2024-10-19 14:18:51 +08:00
{list.map((item, index) => (
2024-10-19 14:46:17 +08:00
<EndpointCard
key={index}
data={item}
/>
2024-10-19 14:18:51 +08:00
))}
2024-10-13 10:49:55 +08:00
</div>
2024-10-12 16:29:46 +08:00
</div>
)
}
export default EndpointList