pull/1344/head
parent
3c9448735e
commit
77cd0472dd
@ -1,33 +0,0 @@ |
||||
export type PluginManagerSettings = { |
||||
openDialog: () => void |
||||
onValidation: () => void |
||||
clearPermission: (from: any, to: any, method: any) => void |
||||
settings: () => HTMLElement |
||||
render: () => HTMLElement |
||||
} |
||||
|
||||
export type Profile = { |
||||
name: 'pluginManager', |
||||
displayName: 'Plugin manager', |
||||
methods: [], |
||||
events: [], |
||||
icon: 'assets/img/pluginManager.webp', |
||||
description: 'Start/stop services, modules and plugins', |
||||
kind: 'settings', |
||||
location: 'sidePanel', |
||||
documentation: 'https://remix-ide.readthedocs.io/en/latest/plugin_manager.html', |
||||
version: any |
||||
} |
||||
|
||||
export type TileLabel = { |
||||
label: 'Active Module' | 'Inactive Modules' |
||||
} |
||||
|
||||
export type LocalPlugin = { |
||||
create: () => Profile |
||||
updateName: (target: string) => void |
||||
updateDisplayName: (displayName: string) => void |
||||
updateProfile: (key: string, e: Event) => void |
||||
updateMethods: (target: any) => void |
||||
form: () => HTMLElement |
||||
} |
@ -0,0 +1,29 @@ |
||||
import React from 'react' |
||||
import { PluginManagerComponent } from '../../types' |
||||
|
||||
interface ActivateButtonProps { |
||||
buttonText: string |
||||
pluginName: string |
||||
pluginComponent: PluginManagerComponent |
||||
} |
||||
|
||||
function ActivateButton ({ |
||||
buttonText, |
||||
pluginName, |
||||
pluginComponent |
||||
}: ActivateButtonProps) { |
||||
const dataId = `pluginManagerComponent${buttonText}Button${pluginName}` |
||||
|
||||
return ( |
||||
<button |
||||
onClick={() => { |
||||
pluginComponent.activateP(pluginName) |
||||
}} |
||||
className={buttonText === 'Activate' ? 'btn btn-success btn-sm' : 'btn btn-secondary btn-sm'} |
||||
data-id={dataId} |
||||
> |
||||
{buttonText} |
||||
</button> |
||||
) |
||||
} |
||||
export default ActivateButton |
@ -1,34 +0,0 @@ |
||||
import React, { useState } from 'react' |
||||
import { PluginManagerComponent } from '../../types' |
||||
|
||||
interface ButtonProps { |
||||
buttonText: 'Activate' | 'Deactivate' |
||||
pluginName: string |
||||
pluginComponent: PluginManagerComponent |
||||
} |
||||
|
||||
function Button ({ |
||||
buttonText, |
||||
pluginName, |
||||
pluginComponent |
||||
}: ButtonProps) { |
||||
const dataId = `pluginManagerComponentDeactivateButton${pluginName}` |
||||
const [needToDeactivate] = useState('btn btn-secondary btn-sm') |
||||
const [needToActivate] = useState('btn btn-success btn-sm') |
||||
return ( |
||||
<button |
||||
onClick={buttonText === 'Activate' ? () => { |
||||
pluginComponent.activateP(pluginName) |
||||
buttonText = 'Deactivate' |
||||
} : () => { |
||||
pluginComponent.deactivateP(pluginName) |
||||
buttonText = 'Activate' |
||||
}} |
||||
className={buttonText === 'Activate' ? needToActivate : needToDeactivate} |
||||
data-id={dataId} |
||||
> |
||||
{buttonText} |
||||
</button> |
||||
) |
||||
} |
||||
export default Button |
@ -0,0 +1,28 @@ |
||||
import React from 'react' |
||||
import { PluginManagerComponent } from '../../types' |
||||
|
||||
interface DeactivateButtonProps { |
||||
buttonText: string |
||||
pluginName: string |
||||
pluginComponent: PluginManagerComponent |
||||
} |
||||
|
||||
function DeactivateButton ({ |
||||
buttonText, |
||||
pluginName, |
||||
pluginComponent |
||||
}: DeactivateButtonProps) { |
||||
const dataId = `pluginManagerComponent${buttonText}Button${pluginName}` |
||||
return ( |
||||
<button |
||||
onClick={() => { |
||||
pluginComponent.deactivateP(pluginName) |
||||
}} |
||||
className={buttonText === 'Deactivate' ? 'btn btn-secondary btn-sm' : ''} |
||||
data-id={dataId} |
||||
> |
||||
{buttonText} |
||||
</button> |
||||
) |
||||
} |
||||
export default DeactivateButton |
Loading…
Reference in new issue