dify/web/app/components/plugins/plugin-page/plugin-info.tsx

42 lines
1.3 KiB
TypeScript
Raw Normal View History

2024-10-16 11:30:04 +08:00
'use client'
import type { FC } from 'react'
import React from 'react'
import { useTranslation } from 'react-i18next'
import KeyValueItem from '../base/key-value-item'
import Modal from '../../base/modal'
2024-11-06 18:13:06 +08:00
import { convertRepoToUrl } from '../install-plugin/utils'
2024-10-16 11:30:04 +08:00
const i18nPrefix = 'plugin.pluginInfoModal'
type Props = {
2024-11-06 16:42:04 +08:00
repository?: string
release?: string
packageName?: string
2024-10-16 11:30:04 +08:00
onHide: () => void
}
const PlugInfo: FC<Props> = ({
repository,
release,
packageName,
onHide,
}) => {
const { t } = useTranslation()
const labelWidthClassName = 'w-[96px]'
return (
<Modal
title={t(`${i18nPrefix}.title`)}
className='w-[480px]'
isShow
onClose={onHide}
closable
>
<div className='mt-5 space-y-3'>
2024-11-06 18:13:06 +08:00
{repository && <KeyValueItem label={t(`${i18nPrefix}.repository`)} labelWidthClassName={labelWidthClassName} value={`${convertRepoToUrl(repository)}`} valueMaxWidthClassName='max-w-[190px]' />}
2024-11-06 16:42:04 +08:00
{release && <KeyValueItem label={t(`${i18nPrefix}.release`)} labelWidthClassName={labelWidthClassName} value={release} />}
{packageName && <KeyValueItem label={t(`${i18nPrefix}.packageName`)} labelWidthClassName={labelWidthClassName} value={packageName} />}
2024-10-16 11:30:04 +08:00
</div>
</Modal>
)
}
export default React.memo(PlugInfo)