|
|
|
@ -1,5 +1,5 @@ |
|
|
|
|
import { Profile } from '@remixproject/plugin-utils' |
|
|
|
|
import React, { Fragment, useEffect } from 'react' |
|
|
|
|
import React, { Fragment } from 'react' |
|
|
|
|
import { PluginManagerComponent, PluginManagerProfile } from '../../types' |
|
|
|
|
import InactivePluginCard from './InactivePluginCard' |
|
|
|
|
import ModuleHeading from './moduleHeading' |
|
|
|
@ -11,7 +11,7 @@ interface InactivePluginCardContainerProps { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
interface LocalPluginInterface { |
|
|
|
|
profile: Partial<PluginManagerProfile> // { name: string, displayName: string, url: string, type: 'iframe' | 'ws', hash: string, methods: string, location: 'sidePanel' | 'mainPanel' | 'none'}
|
|
|
|
|
profile: Partial<PluginManagerProfile> |
|
|
|
|
activateService: {} |
|
|
|
|
requestQueue: [] |
|
|
|
|
options: { queueTimeout: number } |
|
|
|
@ -20,34 +20,15 @@ interface LocalPluginInterface { |
|
|
|
|
listener: [] |
|
|
|
|
iframe: {} |
|
|
|
|
} |
|
|
|
|
function InactivePluginCardContainer ({ pluginComponent, setInactiveProfiles, inactiveProfiles }: InactivePluginCardContainerProps) { |
|
|
|
|
function InactivePluginCardContainer ({ pluginComponent }: InactivePluginCardContainerProps) { |
|
|
|
|
const activatePlugin = (pluginName: string) => { |
|
|
|
|
pluginComponent.activateP(pluginName) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// useEffect(() => {
|
|
|
|
|
// const savedLocalPlugins: LocalPluginInterface = JSON.parse(localStorage.getItem('plugins/local'))
|
|
|
|
|
// const savedActiveProfiles: Profile[] = JSON.parse(localStorage.getItem('newActivePlugins'))
|
|
|
|
|
// if (pluginComponent.inactivePlugins && pluginComponent.inactivePlugins.length) {
|
|
|
|
|
// let temp: Profile[] = []
|
|
|
|
|
// if (Object.keys(savedLocalPlugins).length) {
|
|
|
|
|
// temp = [...pluginComponent.inactivePlugins, savedLocalPlugins.profile as Profile]
|
|
|
|
|
// } else {
|
|
|
|
|
// temp = [...pluginComponent.inactivePlugins]
|
|
|
|
|
// }
|
|
|
|
|
// const filtered = temp.filter(t => {
|
|
|
|
|
// return !savedActiveProfiles.find(active => {
|
|
|
|
|
// return active.name === t.name
|
|
|
|
|
// })
|
|
|
|
|
// })
|
|
|
|
|
// setInactiveProfiles(filtered)
|
|
|
|
|
// }
|
|
|
|
|
// }, [pluginComponent, pluginComponent.inactivePlugins, setInactiveProfiles])
|
|
|
|
|
return ( |
|
|
|
|
<Fragment> |
|
|
|
|
{(pluginComponent.inactivePlugins && pluginComponent.inactivePlugins.length) ? <ModuleHeading headingLabel="Inactive Modules" count={pluginComponent.inactivePlugins.length} /> : null} |
|
|
|
|
{pluginComponent.inactivePlugins && pluginComponent.inactivePlugins.map((profile, idx) => { |
|
|
|
|
// console.log('profile: ', profile)
|
|
|
|
|
return ( |
|
|
|
|
<InactivePluginCard |
|
|
|
|
buttonText="Activate" |
|
|
|
|