plugin-info.tsx 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. 'use client'
  2. import type { FC } from 'react'
  3. import React from 'react'
  4. import { useTranslation } from 'react-i18next'
  5. import KeyValueItem from '../base/key-value-item'
  6. import Modal from '../../base/modal'
  7. import { convertRepoToUrl } from '../install-plugin/utils'
  8. const i18nPrefix = 'plugin.pluginInfoModal'
  9. type Props = {
  10. repository?: string
  11. release?: string
  12. packageName?: string
  13. onHide: () => void
  14. }
  15. const PlugInfo: FC<Props> = ({
  16. repository,
  17. release,
  18. packageName,
  19. onHide,
  20. }) => {
  21. const { t } = useTranslation()
  22. const labelWidthClassName = 'w-[96px]'
  23. return (
  24. <Modal
  25. title={t(`${i18nPrefix}.title`)}
  26. className='w-[480px]'
  27. isShow
  28. onClose={onHide}
  29. closable
  30. >
  31. <div className='mt-5 space-y-3'>
  32. {repository && <KeyValueItem label={t(`${i18nPrefix}.repository`)} labelWidthClassName={labelWidthClassName} value={`${convertRepoToUrl(repository)}`} valueMaxWidthClassName='max-w-[190px]' />}
  33. {release && <KeyValueItem label={t(`${i18nPrefix}.release`)} labelWidthClassName={labelWidthClassName} value={release} />}
  34. {packageName && <KeyValueItem label={t(`${i18nPrefix}.packageName`)} labelWidthClassName={labelWidthClassName} value={packageName} />}
  35. </div>
  36. </Modal>
  37. )
  38. }
  39. export default React.memo(PlugInfo)