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

View File

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