chore: plugin info

This commit is contained in:
Joel 2024-11-06 16:42:04 +08:00
parent b6a4af4041
commit 306843fe6a
2 changed files with 9 additions and 8 deletions

View File

@ -52,13 +52,14 @@ const DetailHeader = ({
meta,
} = detail
const { author, name, label, description, icon, verified } = detail.declaration
const isFromGitHub = source === PluginSource.github
// Only plugin installed from GitHub need to check if it's the new version
const hasNewVersion = useMemo(() => {
return source === PluginSource.github && latest_version !== version
}, [source, latest_version, version])
// #plugin TODO# update plugin
const handleUpdate = () => {}
const handleUpdate = () => { }
const [isShowPluginInfo, {
setTrue: showPluginInfo,
@ -151,7 +152,7 @@ const DetailHeader = ({
<Description className='mt-3' text={description[locale]} descriptionLineRows={2}></Description>
{isShowPluginInfo && (
<PluginInfo
repository={meta?.repo}
repository={isFromGitHub ? meta?.repo : ''}
release={version}
packageName={meta?.package}
onHide={hidePluginInfo}

View File

@ -7,9 +7,9 @@ import Modal from '../../base/modal'
const i18nPrefix = 'plugin.pluginInfoModal'
type Props = {
repository: string
release: string
packageName: string
repository?: string
release?: string
packageName?: string
onHide: () => void
}
@ -30,9 +30,9 @@ const PlugInfo: FC<Props> = ({
closable
>
<div className='mt-5 space-y-3'>
<KeyValueItem label={t(`${i18nPrefix}.repository`)} labelWidthClassName={labelWidthClassName} value={repository} />
<KeyValueItem label={t(`${i18nPrefix}.release`)} labelWidthClassName={labelWidthClassName} value={release} />
<KeyValueItem label={t(`${i18nPrefix}.packageName`)} labelWidthClassName={labelWidthClassName} value={packageName} />
{repository && <KeyValueItem label={t(`${i18nPrefix}.repository`)} labelWidthClassName={labelWidthClassName} value={repository} />}
{release && <KeyValueItem label={t(`${i18nPrefix}.release`)} labelWidthClassName={labelWidthClassName} value={release} />}
{packageName && <KeyValueItem label={t(`${i18nPrefix}.packageName`)} labelWidthClassName={labelWidthClassName} value={packageName} />}
</div>
</Modal>
)