diff --git a/web/app/components/plugins/install-plugin/base/installed.tsx b/web/app/components/plugins/install-plugin/base/installed.tsx index 8322c3e5eb..442a61e372 100644 --- a/web/app/components/plugins/install-plugin/base/installed.tsx +++ b/web/app/components/plugins/install-plugin/base/installed.tsx @@ -1,7 +1,7 @@ 'use client' import type { FC } from 'react' import React from 'react' -import type { PluginDeclaration, PluginManifestInMarket } from '../../types' +import type { Plugin, PluginDeclaration, PluginManifestInMarket } from '../../types' import Card from '../../card' import Button from '@/app/components/base/button' import { pluginManifestInMarketToPluginProps, pluginManifestToCardPluginProps } from '../utils' @@ -9,7 +9,7 @@ import { useTranslation } from 'react-i18next' import Badge, { BadgeState } from '@/app/components/base/badge/index' type Props = { - payload?: PluginDeclaration | PluginManifestInMarket | null + payload?: Plugin | PluginDeclaration | PluginManifestInMarket | null isMarketPayload?: boolean isFailed: boolean errMsg?: string | null diff --git a/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx b/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx index 17eca59dc3..b721a84454 100644 --- a/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx +++ b/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx @@ -2,7 +2,7 @@ import React, { useCallback, useState } from 'react' import Modal from '@/app/components/base/modal' -import type { PluginManifestInMarket } from '../../types' +import type { Plugin, PluginManifestInMarket } from '../../types' import { InstallStep } from '../../types' import Install from './steps/install' import Installed from '../base/installed' @@ -12,7 +12,7 @@ const i18nPrefix = 'plugin.installModal' type InstallFromMarketplaceProps = { uniqueIdentifier: string - manifest: PluginManifestInMarket + manifest: PluginManifestInMarket | Plugin onSuccess: () => void onClose: () => void } @@ -36,7 +36,7 @@ const InstallFromMarketplace: React.FC = ({ if (step === InstallStep.installFailed) return t(`${i18nPrefix}.installFailed`) return t(`${i18nPrefix}.installPlugin`) - }, [step]) + }, [step, t]) const handleInstalled = useCallback(() => { setStep(InstallStep.installed) diff --git a/web/app/components/plugins/install-plugin/install-from-marketplace/steps/install.tsx b/web/app/components/plugins/install-plugin/install-from-marketplace/steps/install.tsx index f1f5fecf93..bc32e642a5 100644 --- a/web/app/components/plugins/install-plugin/install-from-marketplace/steps/install.tsx +++ b/web/app/components/plugins/install-plugin/install-from-marketplace/steps/install.tsx @@ -2,7 +2,7 @@ import type { FC } from 'react' import React, { useMemo } from 'react' import { RiInformation2Line } from '@remixicon/react' -import type { PluginManifestInMarket } from '../../../types' +import type { Plugin, PluginManifestInMarket } from '../../../types' import Card from '../../../card' import { pluginManifestInMarketToPluginProps } from '../../utils' import Button from '@/app/components/base/button' @@ -16,7 +16,7 @@ const i18nPrefix = 'plugin.installModal' type Props = { uniqueIdentifier: string - payload: PluginManifestInMarket + payload: PluginManifestInMarket | Plugin onCancel: () => void onStartToInstall?: () => void onInstalled: () => void @@ -104,7 +104,7 @@ const Installed: FC = ({
diff --git a/web/app/components/plugins/provider-card.tsx b/web/app/components/plugins/provider-card.tsx index 2a6ab0f132..5c8ab1891e 100644 --- a/web/app/components/plugins/provider-card.tsx +++ b/web/app/components/plugins/provider-card.tsx @@ -12,7 +12,9 @@ import DownloadCount from './card/base/download-count' import Button from '@/app/components/base/button' import { useGetLanguage } from '@/context/i18n' import { MARKETPLACE_URL_PREFIX } from '@/config' +import InstallFromMarketplace from '@/app/components/plugins/install-plugin/install-from-marketplace' import cn from '@/utils/classnames' +import { useBoolean } from 'ahooks' type Props = { className?: string @@ -24,6 +26,10 @@ const ProviderCard: FC = ({ payload, }) => { const { t } = useTranslation() + const [isShowInstallFromMarketplace, { + setTrue: showInstallFromMarketplace, + setFalse: hideInstallFromMarketplace, + }] = useBoolean(false) const language = useGetLanguage() const { org, label } = payload @@ -58,6 +64,7 @@ const ProviderCard: FC = ({ @@ -71,6 +78,16 @@ const ProviderCard: FC = ({ + { + isShowInstallFromMarketplace && ( + + ) + } ) }