From 576acde1e08bfaf3bec88567a79ebf579a8b24cc Mon Sep 17 00:00:00 2001 From: joseph izang Date: Tue, 13 Jul 2021 14:56:53 +0100 Subject: [PATCH] implement isActive logic for plugins --- .../src/app/components/plugin-manager-component.js | 3 ++- .../plugin-manager/src/lib/components/pluginCard.tsx | 4 ++-- libs/remix-ui/plugin-manager/src/types.d.ts | 6 ++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/apps/remix-ide/src/app/components/plugin-manager-component.js b/apps/remix-ide/src/app/components/plugin-manager-component.js index 2eb7382c43..b7055a1f55 100644 --- a/apps/remix-ide/src/app/components/plugin-manager-component.js +++ b/apps/remix-ide/src/app/components/plugin-manager-component.js @@ -106,6 +106,7 @@ class PluginManagerComponent extends ViewPlugin { this.filter = '' this.activePlugins = [] this.inactivePlugins = [] + this.activePlugins = this.appManager.actives // this.appManager.event.on('activate', () => { this.reRender() }) // this.appManager.event.on('deactivate', () => { this.reRender() }) // this.engine.event.on('onRegistration', () => { this.reRender() }) @@ -123,7 +124,7 @@ class PluginManagerComponent extends ViewPlugin { appManager={this.appManager} engine={this.engine} localPlugin={this.localPlugin} - isActive={() => false} + activePlugins={this.activePlugins} actives={this.activePlugins} inactives={this.inactivePlugins} />, diff --git a/libs/remix-ui/plugin-manager/src/lib/components/pluginCard.tsx b/libs/remix-ui/plugin-manager/src/lib/components/pluginCard.tsx index a9a2f2b859..33aa825220 100644 --- a/libs/remix-ui/plugin-manager/src/lib/components/pluginCard.tsx +++ b/libs/remix-ui/plugin-manager/src/lib/components/pluginCard.tsx @@ -9,7 +9,7 @@ interface PluginCardProps { // eslint-disable-next-line no-empty-pattern function PluginCard ({ profile }: PluginCardProps) { - const { isActive } = useContext(PluginManagerContext) + const { activePlugins } = useContext(PluginManagerContext) const [displayName] = useState((profile.displayName) ? profile.displayName : profile.name) const [docLink] = useState((profile.documentation) ? ( @@ -31,7 +31,7 @@ function PluginCard ({ profile }: PluginCardProps) { {docLink} {versionWarning} - { isActive(profile.name) ? ( + { activePlugins.includes(profile.name) ? (