refactor: remove version prop from plugin item components and update version comparison logic

This commit is contained in:
twwu 2024-11-13 18:34:04 +08:00
parent 61eb655823
commit fa6858090b
2 changed files with 1 additions and 5 deletions

View File

@ -23,7 +23,6 @@ type Props = {
installationId: string
pluginUniqueIdentifier: string
pluginName: string
version: string
usedInApps: number
isShowFetchNewVersion: boolean
isShowInfo: boolean
@ -36,7 +35,6 @@ const Action: FC<Props> = ({
installationId,
pluginUniqueIdentifier,
pluginName,
version,
isShowFetchNewVersion,
isShowInfo,
isShowDelete,
@ -63,7 +61,7 @@ const Action: FC<Props> = ({
return
const versions = fetchedReleases.map(release => release.tag_name)
const latestVersion = getLatestVersion(versions)
if (compareVersion(latestVersion, version) === 1) {
if (compareVersion(latestVersion, meta!.version) === 1) {
setShowUpdatePluginModal({
onSaveCallback: () => {
invalidateInstalledPluginList()

View File

@ -48,7 +48,6 @@ const PluginItem: FC<Props> = ({
endpoints_active,
meta,
plugin_id,
version,
} = plugin
const { category, author, name, label, description, icon, verified } = plugin.declaration
@ -93,7 +92,6 @@ const PluginItem: FC<Props> = ({
installationId={installation_id}
author={author}
pluginName={name}
version={version}
usedInApps={5}
isShowFetchNewVersion={source === PluginSource.github}
isShowInfo={source === PluginSource.github}