Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions apps/remix-ide/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,10 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
const mainview = new MainView(contextualListener, editor, appPanel, fileManager, appManager, terminal)
registry.put({ api: mainview, name: 'mainview' })

engine.register(appPanel)
engine.register([
appPanel,
mainview.tabProxy
])

// those views depend on app_manager
const menuicons = new VerticalIcons(appManager)
Expand Down Expand Up @@ -429,8 +432,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
}).catch(console.error)
} else {
// activate solidity plugin
appManager.ensureActivated('solidity')
appManager.ensureActivated('udapp')
appManager.activatePlugin(['solidity', 'udapp'])
}

// Load and start the service who manager layout and frame
Expand Down
5 changes: 3 additions & 2 deletions apps/remix-ide/src/app/components/vertical-icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,9 @@ export class VerticalIcons extends Plugin {
const home = yo`
<div
class="${css.homeIcon}"
onclick="${(e) => {
this.appManager.ensureActivated('home')
onclick="${async () => {
await this.appManager.activatePlugin('home')
this.call('tabs', 'focus', 'home')
}}"
plugin="home" title="Home"
data-id="verticalIconsHomeIcon"
Expand Down
1 change: 1 addition & 0 deletions apps/remix-ide/src/app/panels/main-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var css = csjs`
}
`

// @todo(#650) Extract this into two classes: MainPanel (TabsProxy + Iframe/Editor) & BottomPanel (Terminal)
export class MainView {
constructor (contextualListener, editor, mainPanel, fileManager, appManager, terminal) {
var self = this
Expand Down
35 changes: 19 additions & 16 deletions apps/remix-ide/src/app/panels/tab-proxy.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
var yo = require('yo-yo')
var $ = require('jquery')
import { Plugin } from '@remixproject/engine'
const yo = require('yo-yo')
const $ = require('jquery')
const EventEmitter = require('events')
const globalRegistry = require('../../global/registry')
const csjs = require('csjs-inject')

require('remix-tabs')

const css = csjs`
Expand All @@ -12,8 +12,15 @@ const css = csjs`
}
`

export class TabProxy {
const profile = {
name: 'tabs',
methods: ['focus']
}

// @todo(#650) Merge this with MainPanel into one plugin
export class TabProxy extends Plugin {
constructor (fileManager, editor, appManager) {
super(profile)
this.event = new EventEmitter()
this.fileManager = fileManager
this.appManager = appManager
Expand Down Expand Up @@ -84,23 +91,18 @@ export class TabProxy {
appManager.event.on('deactivate', (profile) => {
this.removeTab(profile.name)
})
}

appManager.event.on('ensureActivated', (name) => {
if (name === 'home') {
// if someone force activation of home, we switch to it
this.event.emit('switchApp', name)
this._view.filetabs.activateTab(name)
}
})
focus (name) {
this.event.emit('switchApp', name)
this._view.filetabs.activateTab(name)
}

updateImgStyles () {
const images = this._view.filetabs.getElementsByClassName('iconImage')
if (images.length !== 0) {
for (const element of images) {
globalRegistry.get('themeModule').api.fixInvert(element)
};
}
for (const element of images) {
globalRegistry.get('themeModule').api.fixInvert(element)
};
}

switchTab (tabName) {
Expand Down Expand Up @@ -205,6 +207,7 @@ export class TabProxy {
delete this._handlers[name]
this.switchToActiveTab()
this.loadedTabs = this.loadedTabs.filter(tab => tab.name !== name)
this.updateImgStyles()
}

addHandler (type, fn) {
Expand Down
41 changes: 12 additions & 29 deletions apps/remix-ide/src/app/ui/landing-page/landing-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,44 +240,27 @@ export class LandingPage extends ViewPlugin {
})
}

const startSolidity = () => {
this.appManager.ensureActivated('solidity')
this.appManager.ensureActivated('udapp')
this.appManager.ensureActivated('solidityStaticAnalysis')
this.appManager.ensureActivated('solidityUnitTesting')
const startSolidity = async () => {
await this.appManager.activatePlugin(['solidity', 'udapp', 'solidityStaticAnalysis', 'solidityUnitTesting'])
this.verticalIcons.select('solidity')
}
/*
const startWorkshop = () => {
this.appManager.ensureActivated('box')
this.appManager.ensureActivated('solidity')
this.appManager.ensureActivated('solidityUnitTesting')
this.appManager.ensureActivated('workshops')
this.verticalIcons.select('workshops')
}
*/

const startPipeline = () => {
this.appManager.ensureActivated('solidity')
this.appManager.ensureActivated('pipeline')
this.appManager.ensureActivated('udapp')
this.appManager.activatePlugin(['solidity', 'pipeline', 'udapp'])
}
const startDebugger = () => {
this.appManager.ensureActivated('debugger')
const startDebugger = async () => {
await this.appManager.activatePlugin('debugger')
this.verticalIcons.select('debugger')
}
const startMythX = () => {
this.appManager.ensureActivated('solidity')
this.appManager.ensureActivated('mythx')
const startMythX = async () => {
await this.appManager.activatePlugin(['solidity', 'mythx'])
this.verticalIcons.select('mythx')
}
const startSourceVerify = () => {
this.appManager.ensureActivated('solidity')
this.appManager.ensureActivated('source-verification')
const startSourceVerify = async () => {
await this.appManager.activatePlugin(['solidity', 'source-verification'])
this.verticalIcons.select('source-verification')
}
const startPluginManager = () => {
this.appManager.ensureActivated('pluginManager')
const startPluginManager = async () => {
await this.appManager.activatePlugin('pluginManager')
this.verticalIcons.select('pluginManager')
}

Expand All @@ -286,7 +269,7 @@ export class LandingPage extends ViewPlugin {
fileExplorer.createNewFile()
}
const connectToLocalhost = () => {
this.appManager.ensureActivated('remixd')
this.appManager.activatePlugin('remixd')
}
const importFromGist = () => {
this.gistHandler.loadFromGist({ gist: '' }, globalRegistry.get('filemanager').api)
Expand Down
48 changes: 0 additions & 48 deletions apps/remix-ide/src/app/ui/landing-page/workspace.js

This file was deleted.

7 changes: 0 additions & 7 deletions apps/remix-ide/src/remixAppManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,6 @@ export class RemixAppManager extends PluginManager {
this.event.emit('deactivate', plugin)
}

onRegistration () {}

async ensureActivated (apiName) {
await this.activatePlugin(apiName)
this.event.emit('ensureActivated', apiName)
}

async ensureDeactivated (apiName) {
await this.deactivatePlugin(apiName)
this.event.emit('ensureDeactivated', apiName)
Expand Down
Loading