parent
f13f775c7a
commit
4b73ad2399
@ -0,0 +1,51 @@ |
||||
import React from 'react' |
||||
import { EventEmitter } from 'events' |
||||
import { Plugin } from '@remixproject/engine' |
||||
import packageJson from '../../../../../package.json' |
||||
import { PluginViewWrapper } from '@remix-ui/helper' |
||||
import { PluginProfile } from '../../types' |
||||
import { RemixUIStatusBar } from '@remix-ui/panel' |
||||
|
||||
const statusBarProfile: PluginProfile = { |
||||
name: 'statusBar', |
||||
displayName: 'Status Bar', |
||||
description: 'Remix IDE status bar panel', |
||||
version: packageJson.version |
||||
} |
||||
|
||||
export class StatusBar extends Plugin { |
||||
htmlElement: HTMLDivElement |
||||
events: EventEmitter |
||||
dispatch: React.Dispatch<any> = () => {} |
||||
constructor() { |
||||
super(statusBarProfile) |
||||
this.events = new EventEmitter() |
||||
this.htmlElement = document.createElement('div') |
||||
this.htmlElement.setAttribute('id', 'status-bar') |
||||
} |
||||
|
||||
onActivation(): void { |
||||
this.renderComponent() |
||||
} |
||||
setDispatch(dispatch: React.Dispatch<any>) { |
||||
this.dispatch = dispatch |
||||
} |
||||
|
||||
renderComponent() { |
||||
this.dispatch({ |
||||
plugins: this |
||||
}) |
||||
} |
||||
|
||||
updateComponent(state: any) { |
||||
return <RemixUIStatusBar statusBarPlugin={state.plugins} /> |
||||
} |
||||
|
||||
render() { |
||||
<div data-id="status-bar-container"> |
||||
test |
||||
<PluginViewWrapper plugin={this} /> |
||||
</div> |
||||
} |
||||
|
||||
} |
@ -0,0 +1,19 @@ |
||||
|
||||
export interface PluginProfile { |
||||
name: string |
||||
displayName: string |
||||
description: string |
||||
keywords?: string[] |
||||
icon?: string |
||||
url?: string |
||||
methods?: string[] |
||||
events?: string[] |
||||
version?: string |
||||
} |
||||
|
||||
export interface StatusBarInterface extends Plugin { |
||||
htmlElement: HTMLDivElement |
||||
events: EventEmitter |
||||
dispatch: React.Dispatch<any> |
||||
setDispatch(dispatch: React.Dispatch<any>): void |
||||
} |
@ -0,0 +1,14 @@ |
||||
import React from 'react' |
||||
import { StatusBarInterface } from '../types' |
||||
|
||||
export interface RemixUIStatusBarProps { |
||||
statusBarPlugin: StatusBarInterface |
||||
} |
||||
|
||||
export default function RemixUIStatusBar({ statusBarPlugin }: RemixUIStatusBarProps) { |
||||
return ( |
||||
<div className="d-flex flex-row bg-primary"> |
||||
<h6>Statusbar</h6> |
||||
</div> |
||||
) |
||||
} |
Loading…
Reference in new issue