git status in decent state

pull/4774/head
Joseph Izang 6 months ago
parent 1b43ec03ed
commit ac2146da36
  1. 2
      apps/remix-ide/src/app.js
  2. 2
      apps/remix-ide/src/app/components/side-panel.tsx
  3. 18
      apps/remix-ide/src/app/components/status-bar.tsx
  4. 4
      apps/remix-ide/src/remixAppManager.js
  5. 1
      apps/remix-ide/src/types/index.d.ts
  6. 7
      libs/remix-ui/statusbar/src/css/statusbar.css
  7. 14
      libs/remix-ui/statusbar/src/lib/components/gitStatus.tsx
  8. 6
      libs/remix-ui/statusbar/src/lib/remixui-statusbar-panel.tsx
  9. 5
      libs/remix-ui/statusbar/src/lib/types/index.ts

@ -387,7 +387,7 @@ class AppComponent {
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) this.statusBar = new StatusBar(filePanel, this.menuicons)
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)

@ -12,7 +12,7 @@ const sidePanel = {
displayName: 'Side Panel', displayName: 'Side Panel',
description: 'Remix IDE side panel', description: 'Remix IDE side panel',
version: packageJson.version, version: packageJson.version,
methods: ['addView', 'removeView', 'currentFocus', 'pinView', 'unPinView'] methods: ['addView', 'removeView', 'currentFocus', 'pinView', 'unPinView', 'focus']
} }
export class SidePanel extends AbstractPanel { export class SidePanel extends AbstractPanel {

@ -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
} }

@ -70,6 +70,7 @@ let requiredModules = [ // services + layout views + system views
'compilationDetails', 'compilationDetails',
'vyperCompilationDetails', 'vyperCompilationDetails',
'contractflattener', 'contractflattener',
'statusBar',
'solidity-script', 'solidity-script',
'solcoder', 'solcoder',
'home', 'home',
@ -103,7 +104,7 @@ const isVM = (name) => {
} }
export function isNative(name) { export function isNative(name) {
// nativePlugin allows to bypass the permission request // nativePlugin allows to bypass the permission request
const nativePlugins = [ const nativePlugins = [
'vyper', 'vyper',
@ -117,6 +118,7 @@ export function isNative(name) {
'solhint', 'solhint',
'solidityUnitTesting', 'solidityUnitTesting',
'layout', 'layout',
'statusBar',
'notification', 'notification',
'hardhat-provider', 'hardhat-provider',
'ganache-provider', 'ganache-provider',

@ -16,5 +16,4 @@ export interface StatusBarInterface {
filePanelPlugin: FilePanelType 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>
} }

@ -1,4 +1,9 @@
remixui_statusbar :hover { remixui_statusbar:hover {
cursor: pointer;
}
.remixui_statusbar_gitstatus
.remixui_statusbar_gitstatus:hover {
cursor: pointer; cursor: pointer;
} }

@ -1,8 +1,11 @@
import React, { useEffect, useState } from 'react' import React, { useEffect, useState } from 'react'
import { StatusBarInterface } from '../types' import { StatusBarInterface } from '../types'
// eslint-disable-next-line @nrwl/nx/enforce-module-boundaries
import { StatusBar } from 'apps/remix-ide/src/app/components/status-bar'
import '../../css/statusbar.css'
export interface GitStatusProps { export interface GitStatusProps {
plugin: StatusBarInterface plugin: StatusBar
} }
export default function GitStatus({ plugin }: GitStatusProps) { export default function GitStatus({ plugin }: GitStatusProps) {
@ -20,9 +23,16 @@ export default function GitStatus({ plugin }: GitStatusProps) {
// console.log('testing', plugin) // console.log('testing', plugin)
}, []) }, [])
const lightDgitUp = async () => {
const isActive = await plugin.call('manager', 'isActive', 'dgit')
if (!isActive) await plugin.call('manager', 'activatePlugin', 'dgit')
plugin.verticalIcons.select('dgit')
}
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 remixui_statusbar_gitstatus"
onClick={async () => await lightDgitUp()}
> >
<span className="fa-regular fa-code-branch ml-1"></span> <span className="fa-regular fa-code-branch ml-1"></span>
<span className="small mx-1">{`${gitBranchName}`}</span> <span className="small mx-1">{`${gitBranchName}`}</span>

@ -6,9 +6,11 @@ import ScamAlertStatus from './components/scamAlertStatus'
import ScamDetails from './components/scamDetails' import ScamDetails from './components/scamDetails'
import { FloatingFocusManager, autoUpdate, flip, offset, shift, useClick, useDismiss, useFloating, useInteractions, useRole } from '@floating-ui/react' import { FloatingFocusManager, autoUpdate, flip, offset, shift, useClick, useDismiss, useFloating, useInteractions, useRole } from '@floating-ui/react'
import axios from 'axios' import axios from 'axios'
// eslint-disable-next-line @nrwl/nx/enforce-module-boundaries
import { StatusBar } from 'apps/remix-ide/src/app/components/status-bar'
export interface RemixUIStatusBarProps { export interface RemixUIStatusBarProps {
statusBarPlugin: StatusBarInterface statusBarPlugin: StatusBar
} }
export type ScamAlert = { export type ScamAlert = {
@ -67,7 +69,7 @@ export function RemixUIStatusBar({ statusBarPlugin }: RemixUIStatusBarProps) {
</FloatingFocusManager> </FloatingFocusManager>
)} )}
<div className="d-flex flex-row bg-primary justify-content-between align-items-center"> <div className="d-flex flex-row bg-primary justify-content-between align-items-center">
<div className="remixui_statusbar"> <div className="remixui_statusbar remixui_statusbar_gitstatus">
<GitStatus plugin={statusBarPlugin} /> <GitStatus plugin={statusBarPlugin} />
</div> </div>
<div className="remixui_statusbar"></div> <div className="remixui_statusbar"></div>

@ -1,5 +1,8 @@
import EventEmitter from 'events' import EventEmitter from 'events'
import { Plugin } from '@remixproject/engine' import { Plugin } from '@remixproject/engine'
import { FilePanelType } from '@remix-ui/workspace'
// eslint-disable-next-line @nrwl/nx/enforce-module-boundaries
import { VerticalIcons } from 'apps/remix-ide/src/app/components/vertical-icons'
export interface PluginProfile { export interface PluginProfile {
name: string name: string
displayName: string displayName: string
@ -16,6 +19,8 @@ export interface StatusBarInterface extends Plugin {
htmlElement: HTMLDivElement htmlElement: HTMLDivElement
events: EventEmitter events: EventEmitter
dispatch: React.Dispatch<any> dispatch: React.Dispatch<any>
filePanel: FilePanelType
verticalIcons: VerticalIcons
setDispatch(dispatch: React.Dispatch<any>): void setDispatch(dispatch: React.Dispatch<any>): void
getGitBranchName: () => Promise<any> getGitBranchName: () => Promise<any>
currentWorkspaceName: string currentWorkspaceName: string

Loading…
Cancel
Save