|
|
@ -6,12 +6,13 @@ import { PluginViewWrapper } from '@remix-ui/helper' |
|
|
|
import { PluginProfile, StatusBarInterface } from '../../types' |
|
|
|
import { PluginProfile, StatusBarInterface } from '../../types' |
|
|
|
import { RemixUIStatusBar } from '@remix-ui/statusbar' |
|
|
|
import { RemixUIStatusBar } from '@remix-ui/statusbar' |
|
|
|
import { FilePanelType } from '@remix-ui/workspace' |
|
|
|
import { FilePanelType } from '@remix-ui/workspace' |
|
|
|
|
|
|
|
import { VerticalIcons } from './vertical-icons' |
|
|
|
|
|
|
|
|
|
|
|
const statusBarProfile: PluginProfile = { |
|
|
|
const statusBarProfile: PluginProfile = { |
|
|
|
name: 'statusBar', |
|
|
|
name: 'statusBar', |
|
|
|
displayName: 'Status Bar', |
|
|
|
displayName: 'Status Bar', |
|
|
|
description: 'Remix IDE status bar panel', |
|
|
|
description: 'Remix IDE status bar panel', |
|
|
|
methods: ['getGitBranchName'], |
|
|
|
methods: [], |
|
|
|
version: packageJson.version, |
|
|
|
version: packageJson.version, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -19,31 +20,22 @@ export class StatusBar extends Plugin implements StatusBarInterface { |
|
|
|
htmlElement: HTMLDivElement |
|
|
|
htmlElement: HTMLDivElement |
|
|
|
events: EventEmitter |
|
|
|
events: EventEmitter |
|
|
|
filePanelPlugin: FilePanelType |
|
|
|
filePanelPlugin: FilePanelType |
|
|
|
|
|
|
|
verticalIcons: VerticalIcons |
|
|
|
dispatch: React.Dispatch<any> = () => {} |
|
|
|
dispatch: React.Dispatch<any> = () => {} |
|
|
|
currentWorkspaceName: string = '' |
|
|
|
currentWorkspaceName: string = '' |
|
|
|
constructor(filePanel: FilePanelType) { |
|
|
|
constructor(filePanel: FilePanelType, veritcalIcons: VerticalIcons) { |
|
|
|
super(statusBarProfile) |
|
|
|
super(statusBarProfile) |
|
|
|
this.filePanelPlugin = filePanel |
|
|
|
this.filePanelPlugin = filePanel |
|
|
|
|
|
|
|
this.verticalIcons = veritcalIcons |
|
|
|
this.events = new EventEmitter() |
|
|
|
this.events = new EventEmitter() |
|
|
|
this.htmlElement = document.createElement('div') |
|
|
|
this.htmlElement = document.createElement('div') |
|
|
|
this.htmlElement.setAttribute('id', 'status-bar') |
|
|
|
this.htmlElement.setAttribute('id', 'status-bar') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
onActivation(): void { |
|
|
|
onActivation(): void { |
|
|
|
this.on('filePanel', 'setWorkspace', async () => { |
|
|
|
|
|
|
|
await this.getGitBranchName() |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
this.renderComponent() |
|
|
|
this.renderComponent() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async getGitBranchName() { |
|
|
|
|
|
|
|
const isGitRepo = await this.call('fileManager', 'isGitRepo') |
|
|
|
|
|
|
|
if (!isGitRepo) return |
|
|
|
|
|
|
|
const repoName = await this.call('filePanel', 'getCurrentWorkspace') |
|
|
|
|
|
|
|
repoName && repoName?.name.length > 0 ? this.currentWorkspaceName = repoName.name : this.currentWorkspaceName = '' |
|
|
|
|
|
|
|
return { repoWorkspaceName: repoName } |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setDispatch(dispatch: React.Dispatch<any>) { |
|
|
|
setDispatch(dispatch: React.Dispatch<any>) { |
|
|
|
this.dispatch = dispatch |
|
|
|
this.dispatch = dispatch |
|
|
|
} |
|
|
|
} |
|
|
|