From 7daa365564f032994a9b43d2d2c31b05e709d205 Mon Sep 17 00:00:00 2001 From: Joel Date: Thu, 24 Oct 2024 11:10:44 +0800 Subject: [PATCH] chore: to common install comp --- .../steps => base}/installed.tsx | 6 +-- .../install-from-local-package/index.tsx | 2 +- .../install-from-marketplace/index.tsx | 2 +- .../steps/installed.tsx | 48 ------------------- 4 files changed, 5 insertions(+), 53 deletions(-) rename web/app/components/plugins/install-plugin/{install-from-local-package/steps => base}/installed.tsx (89%) delete mode 100644 web/app/components/plugins/install-plugin/install-from-marketplace/steps/installed.tsx diff --git a/web/app/components/plugins/install-plugin/install-from-local-package/steps/installed.tsx b/web/app/components/plugins/install-plugin/base/installed.tsx similarity index 89% rename from web/app/components/plugins/install-plugin/install-from-local-package/steps/installed.tsx rename to web/app/components/plugins/install-plugin/base/installed.tsx index 2288371b7d..03f392447c 100644 --- a/web/app/components/plugins/install-plugin/install-from-local-package/steps/installed.tsx +++ b/web/app/components/plugins/install-plugin/base/installed.tsx @@ -1,10 +1,10 @@ 'use client' import type { FC } from 'react' import React from 'react' -import type { PluginDeclaration } from '../../../types' -import Card from '../../../card' +import type { PluginDeclaration } from '../../types' +import Card from '../../card' import Button from '@/app/components/base/button' -import { pluginManifestToCardPluginProps } from '../../utils' +import { pluginManifestToCardPluginProps } from '../utils' import { useTranslation } from 'react-i18next' type Props = { diff --git a/web/app/components/plugins/install-plugin/install-from-local-package/index.tsx b/web/app/components/plugins/install-plugin/install-from-local-package/index.tsx index 92b5c6f61f..0f75d7cf5b 100644 --- a/web/app/components/plugins/install-plugin/install-from-local-package/index.tsx +++ b/web/app/components/plugins/install-plugin/install-from-local-package/index.tsx @@ -6,7 +6,7 @@ import type { PluginDeclaration } from '../../types' import { InstallStep } from '../../types' import Uploading from './steps/uploading' import Install from './steps/install' -import Installed from './steps/installed' +import Installed from '../base/installed' import { useTranslation } from 'react-i18next' import { toolNotionManifest } from '../../card/card-mock' 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 f555f31c02..26b0d117e8 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 @@ -5,7 +5,7 @@ import Modal from '@/app/components/base/modal' import type { PluginDeclaration } from '../../types' import { InstallStep } from '../../types' import Install from './steps/install' -import Installed from './steps/installed' +import Installed from '../base/installed' import { useTranslation } from 'react-i18next' const i18nPrefix = 'plugin.installModal' diff --git a/web/app/components/plugins/install-plugin/install-from-marketplace/steps/installed.tsx b/web/app/components/plugins/install-plugin/install-from-marketplace/steps/installed.tsx deleted file mode 100644 index 2288371b7d..0000000000 --- a/web/app/components/plugins/install-plugin/install-from-marketplace/steps/installed.tsx +++ /dev/null @@ -1,48 +0,0 @@ -'use client' -import type { FC } from 'react' -import React from 'react' -import type { PluginDeclaration } from '../../../types' -import Card from '../../../card' -import Button from '@/app/components/base/button' -import { pluginManifestToCardPluginProps } from '../../utils' -import { useTranslation } from 'react-i18next' - -type Props = { - payload: PluginDeclaration - isFailed: boolean - onCancel: () => void -} - -const Installed: FC = ({ - payload, - isFailed, - onCancel, -}) => { - const { t } = useTranslation() - return ( - <> -
-

{t(`plugin.installModal.${isFailed ? 'installFailedDesc' : 'installedSuccessfullyDesc'}`)}

-
- -
-
- {/* Action Buttons */} -
- -
- - ) -} -export default React.memo(Installed)