Skip to content

Commit a44d1f7

Browse files
committed
add topbar provider and inject filePanel into topbar
1 parent f7d81bd commit a44d1f7

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

apps/remix-ide/src/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ class AppComponent {
522522
const pluginManagerComponent = new PluginManagerComponent(appManager, this.engine)
523523
const filePanel = new Filepanel(appManager, contentImport)
524524
this.statusBar = new StatusBar(filePanel, this.menuicons)
525-
this.topBar = new Topbar()
525+
this.topBar = new Topbar(filePanel)
526526
const landingPage = new LandingPage(appManager, this.menuicons, fileManager, filePanel, contentImport)
527527
this.settings = new SettingsTab(Registry.getInstance().get('config').api, editor)//, appManager)
528528

apps/remix-ide/src/app/components/top-bar.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { CustomRemixApi, ICustomRemixApi } from '@remix-api'
77
import { Plugin } from '@remixproject/engine'
88
import { PluginViewWrapper } from '@remix-ui/helper'
99
import { AppAction } from 'libs/remix-ui/app/src/lib/remix-app/actions/app'
10-
import { PluginNames } from '../../types'
10+
import FilePanel from '../panels/file-panel'
1111

1212
const TopBarProfile = {
1313
name: 'topbar',
@@ -24,9 +24,11 @@ export class Topbar extends Plugin<any, CustomRemixApi> {
2424
appStateDispatch: React.Dispatch<AppAction> = () => { }
2525
htmlElement: HTMLDivElement
2626
events: EventEmitter
27+
filePanel: FilePanel
2728

28-
constructor() {
29+
constructor(filePanel: FilePanel) {
2930
super(TopBarProfile)
31+
this.filePanel = filePanel
3032
}
3133

3234
onActivation(): void {

libs/remix-ui/top-bar/src/context/topbarContext.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
import { Topbar } from 'apps/remix-ide/src/app/components/top-bar'
12
import { createContext, SyntheticEvent } from 'react'
23

3-
export const FileSystemContext = createContext<{
4+
export const TopbarContext = createContext<{
45
fs: any,
5-
plugin: any,
6+
plugin: Topbar,
67
modal:(title: string | JSX.Element, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => void,
78
dispatchInitWorkspace:() => Promise<void>,
89
dispatchFetchDirectory:(path: string) => Promise<void>,

0 commit comments

Comments
 (0)