swap_it_workspaces

pull/1/head
yann300 6 years ago
parent d4b37116d1
commit 2ccc0beffb
  1. 2
      src/app.js
  2. 3
      src/app/tabs/analysis-tab.js
  3. 3
      src/app/tabs/run-tab.js
  4. 3
      src/app/tabs/test-tab.js
  5. 14
      src/app/ui/landing-page/generate.js
  6. 50
      src/app/ui/landing-page/workspace.js
  7. 4
      src/remixAppManager.js

@ -459,7 +459,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
let configProvider = self._components.filesProviders['config']
appManager.init([
{ profile: homepageProfile(), api: generateHomePage() },
{ profile: homepageProfile(), api: generateHomePage(appManager, appStore) },
{ profile: this.profile(), api: this },
{ profile: udapp.profile(), api: udapp },
{ profile: fileManager.profile(), api: fileManager },

@ -11,7 +11,8 @@ class AnalysisTab {
}
profile () {
return {
name: 'solidity static analysis',
name: 'solidityStaticAnalysis',
displayName: 'solidity static analysis',
methods: [],
events: [],
icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMjA0OCIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMjA0OCAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0yMDQ4IDE1MzZ2MTI4aC0yMDQ4di0xNTM2aDEyOHYxNDA4aDE5MjB6bS0xMjgtMTI0OHY0MzVxMCAyMS0xOS41IDI5LjV0LTM1LjUtNy41bC0xMjEtMTIxLTYzMyA2MzNxLTEwIDEwLTIzIDEwdC0yMy0xMGwtMjMzLTIzMy00MTYgNDE2LTE5Mi0xOTIgNTg1LTU4NXExMC0xMCAyMy0xMHQyMyAxMGwyMzMgMjMzIDQ2NC00NjQtMTIxLTEyMXEtMTYtMTYtNy41LTM1LjV0MjkuNS0xOS41aDQzNXExNCAwIDIzIDl0OSAyM3oiLz48L3N2Zz4=',

@ -149,7 +149,8 @@ class RunTab {
profile () {
return {
name: 'run transactions',
name: 'run',
displayName: 'run transactions',
methods: [],
events: [],
icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNTc2IDkyN2wtMTMyOCA3MzhxLTIzIDEzLTM5LjUgM3QtMTYuNS0zNnYtMTQ3MnEwLTI2IDE2LjUtMzZ0MzkuNSAzbDEzMjggNzM4cTIzIDEzIDIzIDMxdC0yMyAzMXoiLz48L3N2Zz4=',

@ -25,7 +25,8 @@ module.exports = class TestTab {
}
profile () {
return {
name: 'solidity unit testing',
name: 'solidityUnitTesting',
displayName: 'solidity unit testing',
methods: [],
events: [],
icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMjMwNCIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMjMwNCAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNzI4IDQ0OGwtMzg0IDcwNGg3Njh6bS0xMjgwIDBsLTM4NCA3MDRoNzY4em04MjEtMTkycS0xNCA0MC00NS41IDcxLjV0LTcxLjUgNDUuNXYxMjkxaDYwOHExNCAwIDIzIDl0OSAyM3Y2NHEwIDE0LTkgMjN0LTIzIDloLTEzNDRxLTE0IDAtMjMtOXQtOS0yM3YtNjRxMC0xNCA5LTIzdDIzLTloNjA4di0xMjkxcS00MC0xNC03MS41LTQ1LjV0LTQ1LjUtNzEuNWgtNDkxcS0xNCAwLTIzLTl0LTktMjN2LTY0cTAtMTQgOS0yM3QyMy05aDQ5MXEyMS01NyA3MC05Mi41dDExMS0zNS41IDExMSAzNS41IDcwIDkyLjVoNDkxcTE0IDAgMjMgOXQ5IDIzdjY0cTAgMTQtOSAyM3QtMjMgOWgtNDkxem0tMTgxIDE2cTMzIDAgNTYuNS0yMy41dDIzLjUtNTYuNS0yMy41LTU2LjUtNTYuNS0yMy41LTU2LjUgMjMuNS0yMy41IDU2LjUgMjMuNSA1Ni41IDU2LjUgMjMuNXptMTA4OCA4ODBxMCA3My00Ni41IDEzMXQtMTE3LjUgOTEtMTQ0LjUgNDkuNS0xMzkuNSAxNi41LTEzOS41LTE2LjUtMTQ0LjUtNDkuNS0xMTcuNS05MS00Ni41LTEzMXEwLTExIDM1LTgxdDkyLTE3NC41IDEwNy0xOTUuNSAxMDItMTg0IDU2LTEwMHExOC0zMyA1Ni0zM3Q1NiAzM3E0IDcgNTYgMTAwdDEwMiAxODQgMTA3IDE5NS41IDkyIDE3NC41IDM1IDgxem0tMTI4MCAwcTAgNzMtNDYuNSAxMzF0LTExNy41IDkxLTE0NC41IDQ5LjUtMTM5LjUgMTYuNS0xMzkuNS0xNi41LTE0NC41LTQ5LjUtMTE3LjUtOTEtNDYuNS0xMzFxMC0xMSAzNS04MXQ5Mi0xNzQuNSAxMDctMTk1LjUgMTAyLTE4NCA1Ni0xMDBxMTgtMzMgNTYtMzN0NTYgMzNxNCA3IDU2IDEwMHQxMDIgMTg0IDEwNyAxOTUuNSA5MiAxNzQuNSAzNSA4MXoiLz48L3N2Zz4=',

@ -1,6 +1,7 @@
/* global alert */
/* global */
import LandingPage from './landing-page'
import Section from './section'
import { defaultWorkspaces } from './workspace'
export function homepageProfile () {
return {
@ -13,7 +14,8 @@ export function homepageProfile () {
}
}
export function generateHomePage () {
export function generateHomePage (appManager) {
/*
var actions1 = [
{label: 'new file', type: `callback`, payload: () => { alert(`-new file created-`) }},
{label: 'import from GitHub', type: `callback`, payload: () => { alert(`-imported from GitHub-`) }},
@ -51,6 +53,12 @@ export function generateHomePage () {
var section3 = new Section('Learn', actions3)
var section4 = new Section('Plugins', actions4)
var section5 = new Section('Help', actions5)
*/
return new LandingPage([section1, section2, section3, section4, section5])
var sectionsWorkspaces = []
defaultWorkspaces(appManager).forEach((workspace) => {
sectionsWorkspaces.push({label: workspace.title, type: 'callback', payload: () => { workspace.activate() }})
})
var sectionWorkspace = new Section('Workspaces', sectionsWorkspaces)
return new LandingPage([sectionWorkspace])
}

@ -0,0 +1,50 @@
export class Workspace {
constructor (title, description, activate, deactivate) {
this.title = title
this.description = description
this.activate = activate
this.deactivate = deactivate
}
}
export const defaultWorkspaces = (appManager, appStore) => {
return [
new Workspace('Close All Modules', '', () => {
appStore.getActives()
.filter(({profile}) => !profile.required)
.forEach((profile) => { appManager.deactivateOne(profile.name) })
}, () => {}),
new Workspace('Solidity Basic', '', () => {
appManager.ensureActivated('solidity')
}, () => {}),
new Workspace('Solidity Unit testing', '', () => {
appManager.ensureActivated('solidity')
appManager.ensureActivated('solidityUnitTesting')
}, () => {}),
new Workspace('Solidity Full Environement', '', () => {
appManager.ensureActivated('solidity')
appManager.ensureActivated('run')
appManager.ensureActivated('solidityStaticAnalysis')
appManager.ensureActivated('solidityUnitTesting')
}, () => {}),
new Workspace('Vyper Basic', '', () => {
appManager.ensureActivated('vyper')
}, () => {}),
new Workspace('Pipeline', '', () => {
appManager.ensureActivated('solidity')
appManager.ensureActivated('run')
appManager.ensureActivated('pipeline')
}, () => {}),
new Workspace('Deploy and Run Solidity', '', () => {
appManager.ensureActivated('solidity')
appManager.ensureActivated('run')
}, () => {}),
new Workspace('Deploy and Run Vyper', '', () => {
appManager.ensureActivated('vyper')
appManager.ensureActivated('run')
}, () => {}),
new Workspace('Debugger', '', () => {
appManager.ensureActivated('debugger')
}, () => {})
]
}

@ -14,6 +14,10 @@ export class RemixAppManager extends AppManagerApi {
}
}
ensureActivated (module) {
if (!this.store.isActive(module)) this.activateOne(module)
}
proxy () {
// that's temporary. should be removed when we can have proper notification registration
return this.data.proxy

Loading…
Cancel
Save