update to statusbar plugin

pull/4774/head
Joseph Izang 6 months ago
parent e453aafad4
commit d93a182198
  1. 2
      apps/remix-ide/src/app.js
  2. 5
      apps/remix-ide/src/app/components/status-bar.tsx
  3. 1
      apps/remix-ide/src/types/index.d.ts
  4. 10
      libs/remix-ui/statusbar/src/lib/components/gitStatus.tsx
  5. 2
      libs/remix-ui/workspace/src/index.ts

@ -382,12 +382,12 @@ class AppComponent {
// those views depend on app_manager // those views depend on app_manager
this.menuicons = new VerticalIcons() this.menuicons = new VerticalIcons()
this.sidePanel = new SidePanel() this.sidePanel = new SidePanel()
this.statusBar = new StatusBar()
this.hiddenPanel = new HiddenPanel() this.hiddenPanel = new HiddenPanel()
this.pinnedPanel = new PinnedPanel() this.pinnedPanel = new PinnedPanel()
const pluginManagerComponent = new PluginManagerComponent(appManager, this.engine) const pluginManagerComponent = new PluginManagerComponent(appManager, this.engine)
const filePanel = new FilePanel(appManager) const filePanel = new FilePanel(appManager)
this.statusBar = new StatusBar(filePanel)
const landingPage = new LandingPage(appManager, this.menuicons, fileManager, filePanel, contentImport) const landingPage = new LandingPage(appManager, this.menuicons, fileManager, filePanel, contentImport)
this.settings = new SettingsTab(Registry.getInstance().get('config').api, editor, appManager) this.settings = new SettingsTab(Registry.getInstance().get('config').api, editor, appManager)

@ -5,6 +5,7 @@ import packageJson from '../../../../../package.json'
import { PluginViewWrapper } from '@remix-ui/helper' 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'
const statusBarProfile: PluginProfile = { const statusBarProfile: PluginProfile = {
name: 'statusBar', name: 'statusBar',
@ -17,10 +18,12 @@ const statusBarProfile: PluginProfile = {
export class StatusBar extends Plugin implements StatusBarInterface { export class StatusBar extends Plugin implements StatusBarInterface {
htmlElement: HTMLDivElement htmlElement: HTMLDivElement
events: EventEmitter events: EventEmitter
filePanelPlugin: FilePanelType
dispatch: React.Dispatch<any> = () => {} dispatch: React.Dispatch<any> = () => {}
currentWorkspaceName: string = '' currentWorkspaceName: string = ''
constructor() { constructor(filePanel: FilePanelType) {
super(statusBarProfile) super(statusBarProfile)
this.filePanelPlugin = filePanel
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')

@ -13,6 +13,7 @@ export interface PluginProfile {
export interface StatusBarInterface { export interface StatusBarInterface {
htmlElement: HTMLDivElement htmlElement: HTMLDivElement
events: EventEmitter events: EventEmitter
filePanelPlugin: FilePanelType
dispatch: React.Dispatch<any> dispatch: React.Dispatch<any>
setDispatch(dispatch: React.Dispatch<any>): void setDispatch(dispatch: React.Dispatch<any>): void
getGitBranchName: () => Promise<any> getGitBranchName: () => Promise<any>

@ -9,6 +9,16 @@ export default function GitStatus({ plugin }: GitStatusProps) {
const [gitBranchName, setGitBranchName] = useState('') const [gitBranchName, setGitBranchName] = useState('')
useEffect(() => {
plugin.on('filePanel', 'setWorkspace', async (workspace) => {
const isGit = await plugin.call('fileManager', 'isGitRepo')
console.log('workspacenow', workspace)
if (!isGit) return
workspace && workspace?.name.length > 0 ? setGitBranchName(workspace.name) : setGitBranchName('')
})
// console.log('testing', plugin)
}, [])
return ( return (
<div <div
className="d-flex flex-row p-1 text-white justify-content-center align-items-center" className="d-flex flex-row p-1 text-white justify-content-center align-items-center"

@ -1,4 +1,4 @@
export * from './lib/providers/FileSystemProvider' export * from './lib/providers/FileSystemProvider'
export * from './lib/contexts' export * from './lib/contexts'
export * from './lib/utils/constants' export * from './lib/utils/constants'
export { FileType } from './lib/types/index' export { FileType, FilePanelType } from './lib/types/index'

Loading…
Cancel
Save