From 8203b23df2022c78b33b95bfd9f43e301343a7ed Mon Sep 17 00:00:00 2001 From: Joel Date: Tue, 12 Nov 2024 15:48:00 +0800 Subject: [PATCH] feat: install bundle struct --- .../install-plugin/install-bundle/index.tsx | 38 +++++++++++++++++++ .../install-bundle/steps/select-package.tsx | 20 ++++++++++ .../steps/uploading.tsx | 1 + 3 files changed, 59 insertions(+) create mode 100644 web/app/components/plugins/install-plugin/install-bundle/index.tsx create mode 100644 web/app/components/plugins/install-plugin/install-bundle/steps/select-package.tsx diff --git a/web/app/components/plugins/install-plugin/install-bundle/index.tsx b/web/app/components/plugins/install-plugin/install-bundle/index.tsx new file mode 100644 index 0000000000..6086f0cbc3 --- /dev/null +++ b/web/app/components/plugins/install-plugin/install-bundle/index.tsx @@ -0,0 +1,38 @@ +'use client' +import type { FC } from 'react' +import React, { useState } from 'react' +import { InstallStep } from '../../types' +import type { PluginDeclaration } from '../../types' +import SelectPackage from './steps/select-package' + +export enum InstallType { + fromLocal = 'fromLocal', + fromMarketplace = 'fromMarketplace', + fromDSL = 'fromDSL', +} + +type Props = { + installType?: InstallType + plugins?: PluginDeclaration[] +} + +const InstallBundle: FC = ({ + installType = InstallType.fromMarketplace, + plugins = [], +}) => { + const [step, setStep] = useState(installType === InstallType.fromMarketplace ? InstallStep.readyToInstall : InstallStep.uploading) + const [selectedPlugins, setSelectedPlugins] = useState([]) + + const handleSelectedPluginsChange = (plugins: PluginDeclaration[]) => { + setSelectedPlugins(plugins) + } + return ( +
+ {step === InstallStep.readyToInstall && ( + + )} +
+ ) +} + +export default React.memo(InstallBundle) diff --git a/web/app/components/plugins/install-plugin/install-bundle/steps/select-package.tsx b/web/app/components/plugins/install-plugin/install-bundle/steps/select-package.tsx new file mode 100644 index 0000000000..70a51c265c --- /dev/null +++ b/web/app/components/plugins/install-plugin/install-bundle/steps/select-package.tsx @@ -0,0 +1,20 @@ +'use client' +import type { FC } from 'react' +import React from 'react' +import type { PluginDeclaration } from '../../../types' + +type Props = { + plugins: PluginDeclaration[], + onChange: (plugins: PluginDeclaration[]) => void +} + +const SelectPackage: FC = ({ + plugins, + onChange, +}) => { + return ( +
+
+ ) +} +export default React.memo(SelectPackage) diff --git a/web/app/components/plugins/install-plugin/install-from-local-package/steps/uploading.tsx b/web/app/components/plugins/install-plugin/install-from-local-package/steps/uploading.tsx index 793977519d..499326c63e 100644 --- a/web/app/components/plugins/install-plugin/install-from-local-package/steps/uploading.tsx +++ b/web/app/components/plugins/install-plugin/install-from-local-package/steps/uploading.tsx @@ -48,6 +48,7 @@ const Uploading: FC = ({ React.useEffect(() => { handleUpload() + // eslint-disable-next-line react-hooks/exhaustive-deps }, []) return ( <>