Merge pull request #1786 from ethereum/swap_it_style_fixes_l

Style fixes
pull/1/head
yann300 6 years ago committed by GitHub
commit 94f0ec55ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 21
      src/app/files/file-explorer.js
  2. 8
      src/app/files/styles/file-explorer-styles.js
  3. 14
      src/app/panels/editor-panel.js
  4. 49
      src/app/panels/styles/terminal-styles.js
  5. 2
      src/app/panels/tab-proxy.js
  6. 14
      src/app/panels/terminal.js
  7. 8
      src/app/tabs/compile-tab.js
  8. 16
      src/app/ui/dropdown.js
  9. 201
      src/app/ui/landing-page/landing-page.js
  10. 11
      src/app/ui/landing-page/section.js
  11. 27
      src/app/ui/landing-page/workspace.js
  12. 18
      src/app/ui/styles/dropdown-styles.js
  13. 1
      src/remixAppManager.js

@ -10,7 +10,6 @@ var Treeview = require('../ui/TreeView')
var modalDialog = require('../ui/modaldialog') var modalDialog = require('../ui/modaldialog')
var EventManager = require('../../lib/events') var EventManager = require('../../lib/events')
var contextMenu = require('../ui/contextMenu') var contextMenu = require('../ui/contextMenu')
var addTooltip = require('../ui/tooltip')
var css = require('./styles/file-explorer-styles') var css = require('./styles/file-explorer-styles')
var globalRegistry = require('../../global/registry') var globalRegistry = require('../../global/registry')
var queryParams = new QueryParams() var queryParams = new QueryParams()
@ -63,6 +62,8 @@ function fileExplorer (localRegistry, files, menuItems) {
fileManager: self._components.registry.get('filemanager').api fileManager: self._components.registry.get('filemanager').api
} }
self._components.registry.put({ api: self, name: `fileexplorer/${self.files.type}` })
// warn if file changed outside of Remix // warn if file changed outside of Remix
function remixdDialog () { function remixdDialog () {
return yo`<div>This file has been changed outside of Remix IDE.</div>` return yo`<div>This file has been changed outside of Remix IDE.</div>`
@ -175,12 +176,12 @@ function fileExplorer (localRegistry, files, menuItems) {
MENU_HANDLE && MENU_HANDLE.hide(null, true) MENU_HANDLE && MENU_HANDLE.hide(null, true)
MENU_HANDLE = contextMenu(event, { MENU_HANDLE = contextMenu(event, {
'Rename': () => { 'Rename': () => {
if (self.files.readonly) { return addTooltip('cannot rename folder. ' + self.files.type + ' is a read only explorer') } if (self.files.readonly) { return tooltip('cannot rename folder. ' + self.files.type + ' is a read only explorer') }
var name = label.querySelector('label[data-path="' + key + '"]') var name = label.querySelector('label[data-path="' + key + '"]')
if (name) editModeOn(name) if (name) editModeOn(name)
}, },
'Delete': () => { 'Delete': () => {
if (self.files.readonly) { return addTooltip('cannot delete folder. ' + self.files.type + ' is a read only explorer') } if (self.files.readonly) { return tooltip('cannot delete folder. ' + self.files.type + ' is a read only explorer') }
modalDialogCustom.confirm(null, 'Do you want to delete this folder?', () => { files.remove(key) }, () => {}) modalDialogCustom.confirm(null, 'Do you want to delete this folder?', () => { files.remove(key) }, () => {})
} }
}) })
@ -191,12 +192,12 @@ function fileExplorer (localRegistry, files, menuItems) {
MENU_HANDLE && MENU_HANDLE.hide(null, true) MENU_HANDLE && MENU_HANDLE.hide(null, true)
MENU_HANDLE = contextMenu(event, { MENU_HANDLE = contextMenu(event, {
'Rename': () => { 'Rename': () => {
if (self.files.readonly) { return addTooltip('cannot rename file. ' + self.files.type + ' is a read only explorer') } if (self.files.readonly) { return tooltip('cannot rename file. ' + self.files.type + ' is a read only explorer') }
var name = label.querySelector('label[data-path="' + key + '"]') var name = label.querySelector('label[data-path="' + key + '"]')
if (name) editModeOn(name) if (name) editModeOn(name)
}, },
'Delete': () => { 'Delete': () => {
if (self.files.readonly) { return addTooltip('cannot delete file. ' + self.files.type + ' is a read only explorer') } if (self.files.readonly) { return tooltip('cannot delete file. ' + self.files.type + ' is a read only explorer') }
modalDialogCustom.confirm(null, 'Do you want to delete this file?', () => { files.remove(key) }, () => {}) modalDialogCustom.confirm(null, 'Do you want to delete this file?', () => { files.remove(key) }, () => {})
} }
}) })
@ -427,7 +428,7 @@ fileExplorer.prototype.packageFiles = function (filesProvider, callback) {
else { else {
async.eachSeries(Object.keys(files), (path, cb) => { async.eachSeries(Object.keys(files), (path, cb) => {
filesProvider.get(path, (error, content) => { filesProvider.get(path, (error, content) => {
if (/^\s+$/.test(content)) { if (/^\s+$/.test(content) || !content.length) {
content = '// this line is added to create a gist. Empty file is not allowed.' content = '// this line is added to create a gist. Empty file is not allowed.'
} }
if (error) cb(error) if (error) cb(error)
@ -507,7 +508,7 @@ fileExplorer.prototype.renderMenuItems = function () {
items = this.menuItems.map(({action, title, icon}) => { items = this.menuItems.map(({action, title, icon}) => {
if (action === 'uploadFile') { if (action === 'uploadFile') {
return yo` return yo`
<label class="${icon} ${css.newFile}"> <label class="${icon} ${css.newFile}" title="${title}">
<input type="file" onchange=${(event) => { <input type="file" onchange=${(event) => {
event.stopPropagation() event.stopPropagation()
this.uploadFile(event) this.uploadFile(event)
@ -516,14 +517,12 @@ fileExplorer.prototype.renderMenuItems = function () {
` `
} else { } else {
return yo` return yo`
<span onclick=${(event) => { event.stopPropagation(); this[ action ]() }} class="newFile ${css.newFile}" title=${title}> <span onclick=${(event) => { event.stopPropagation(); this[ action ]() }} class="newFile ${icon} ${css.newFile}" title=${title}></span>
<i class=${icon}></i>
</span>
` `
} }
}) })
} }
return yo`<span class=${css.menu}>${items}</span>` return yo`<span class=" ${css.menu}">${items}</span>`
} }
fileExplorer.prototype.ensureRoot = function (cb) { fileExplorer.prototype.ensureRoot = function (cb) {

@ -2,7 +2,7 @@ var csjs = require('csjs-inject')
var css = csjs` var css = csjs`
.label { .label {
margin-bottom : 0px; margin-top : 4px
} }
.fileexplorer { .fileexplorer {
box-sizing : border-box; box-sizing : border-box;
@ -19,13 +19,13 @@ var css = csjs`
padding : 4px; padding : 4px;
} }
.newFile { .newFile {
padding : 4px; padding-right : 5px;
} }
.newFile i { .newFile i {
cursor : pointer; cursor : pointer;
} }
.newFile i:hover { .newFile:hover {
color : var(--secondary) transform : scale(1.3);
} }
.menu { .menu {
margin-left : 20px; margin-left : 20px;

@ -50,6 +50,13 @@ class EditorPanel {
pluginManager: self._components.registry.get('pluginmanager').api pluginManager: self._components.registry.get('pluginmanager').api
} }
self.tabProxy = new TabProxy(self._deps.fileManager, self._components.editor, self.appStore, self.appManager) self.tabProxy = new TabProxy(self._deps.fileManager, self._components.editor, self.appStore, self.appManager)
let showApp = function (name) {
self.mainPanelComponent.showContent(name)
self._view.editor.style.display = 'none'
self._components.contextView.hide()
self._view.mainPanel.style.display = 'block'
}
self.appManager.event.on('ensureActivated', (name) => { if (name === 'home') { showApp(name) } })
/* /*
We listen here on event from the tab component to display / hide the editor and mainpanel We listen here on event from the tab component to display / hide the editor and mainpanel
depending on the content that should be displayed depending on the content that should be displayed
@ -65,12 +72,7 @@ class EditorPanel {
}) })
self.tabProxy.event.on('closeFile', (file) => { self.tabProxy.event.on('closeFile', (file) => {
}) })
self.tabProxy.event.on('switchApp', (name) => { self.tabProxy.event.on('switchApp', showApp)
self.mainPanelComponent.showContent(name)
self._view.editor.style.display = 'none'
self._components.contextView.hide()
self._view.mainPanel.style.display = 'block'
})
self.tabProxy.event.on('closeApp', (name) => { self.tabProxy.event.on('closeApp', (name) => {
self._view.editor.style.display = 'block' self._view.editor.style.display = 'block'
self._components.contextView.hide() self._components.contextView.hide()

@ -21,6 +21,8 @@ var css = csjs`
display : flex; display : flex;
align-items : center; align-items : center;
width : 100%; width : 100%;
border-bottom-style : ridge;
max-height : 35px;
} }
.clear { .clear {
margin-right : 20px; margin-right : 20px;
@ -54,10 +56,10 @@ var css = csjs`
background-size : auto calc(75% - 1.7em); background-size : auto calc(75% - 1.7em);
} }
.terminal { .terminal {
position: relative; position : relative;
display: flex; display : flex;
flex-direction: column; flex-direction : column;
height: 100%; height : 100%;
} }
.journal { .journal {
margin-top : auto; margin-top : auto;
@ -89,9 +91,11 @@ var css = csjs`
font-family : monospace; font-family : monospace;
} }
.search { .search {
display: flex; display : flex;
align-items: center; align-items : center;
margin-right: 10px; width : 200px;
padding-left : 20px;
height : 100%;
} }
.filter { .filter {
width : 200px; width : 200px;
@ -99,22 +103,24 @@ var css = csjs`
margin-right : 0px; margin-right : 0px;
border-top-left-radius : 0px; border-top-left-radius : 0px;
border-bottom-left-radius : 0px; border-bottom-left-radius : 0px;
height : 100%;
} }
.searchIcon { .searchIcon {
height : 25px; height : 100%;
width : 25px; width : 25px;
border-top-left-radius : 3px; border-top-left-radius : 3px;
border-bottom-left-radius : 3px; border-bottom-left-radius : 3px;
display : flex; display : flex;
align-items : center; align-items : center;
justify-content : center; justify-content : center;
margin-right : 5px;
} }
.listen { .listen {
margin-right: 30px; margin-right : 30px;
min-width: 40px; min-width : 40px;
height: 13px; height : 13px;
display: flex; display : flex;
align-items: center; align-items : center;
} }
.listenLabel { .listenLabel {
min-width: 50px; min-width: 50px;
@ -122,18 +128,17 @@ var css = csjs`
.verticalLine { .verticalLine {
border-left : 1px solid var(--secondary) border-left : 1px solid var(--secondary)
height : 65%; height : 65%;
margin-right : 30px;
} }
.pendingTx { .pendingTx {
border : 1px solid var(--secondary); border : 1px solid var(--secondary);
border-radius: 50%; border-radius : 50%;
margin-right: 30px; margin-right : 30px;
min-width: 13px; min-width : 13px;
height: 13px; height : 13px;
display: flex; display : flex;
justify-content: center; justify-content : center;
align-items: center; align-items : center;
font-size: 10px; font-size : 10px;
} }
.dragbarHorizontal { .dragbarHorizontal {
position : absolute; position : absolute;

@ -107,7 +107,7 @@ export class TabProxy {
</div> </div>
` `
let tabsbar = yo` let tabsbar = yo`
<div class="d-flex"> <div class="d-flex border-bottom">
<div class="m-1"> <div class="m-1">
<span class="p-1"> <span class="p-1">
<i class="m-1 fa fa-plus" style="color: var(--text-dark)" onclick=${increase} aria-hidden="true" title="increase editor font size"></i> <i class="m-1 fa fa-plus" style="color: var(--text-dark)" onclick=${increase} aria-hidden="true" title="increase editor font size"></i>

@ -128,7 +128,7 @@ class Terminal {
self._view.bar = yo` self._view.bar = yo`
<div class="${css.bar}"> <div class="${css.bar}">
${self._view.dragbar} ${self._view.dragbar}
<div class=${css.menu}> <div class="${css.menu} bg-light">
${self._view.icon} ${self._view.icon}
<div class=${css.clear} onclick=${clear}> <div class=${css.clear} onclick=${clear}>
<i class="fa fa-ban" aria-hidden="true" title="Clear console" <i class="fa fa-ban" aria-hidden="true" title="Clear console"
@ -136,15 +136,15 @@ class Terminal {
</div> </div>
${self._view.pendingTxCount} ${self._view.pendingTxCount}
<div class=${css.verticalLine}></div> <div class=${css.verticalLine}></div>
<div class=${css.listen}> <div class="form-check">
<input id="listenNetworkCheck" onchange=${listenOnNetwork} type="checkbox" class="form-check-input" <input id="listenNetworkCheck" onchange=${listenOnNetwork} type="checkbox" class="form-check-input "
title="If checked Remix will listen on all transactions mined in the current environment and not only transactions created by you"> title="If checked Remix will listen on all transactions mined in the current environment and not only transactions created by you">
<label class="${css.listenLabel} form-check-label" title="If checked Remix will listen on all transactions mined in the current environment and not only transactions created by you" for="listenNetworkCheck">listen on network</label> <label class="form-check-label" title="If checked Remix will listen on all transactions mined in the current environment and not only transactions created by you" for="listenNetworkCheck">listen on network</label>
</div> </div>
${self._view.dropdown} ${self._view.dropdown}
<div class=${css.search}> <div class=${css.search}>
<i class="fa fa-search ${css.searchIcon} bg-light btn" aria-hidden="true"></i> <i class="fa fa-search ${css.searchIcon} bg-light btn-light" aria-hidden="true"></i>
<input spellcheck="false" type="text" class=${css.filter} onkeydown=${filter} placeholder="Search transactions"> <input spellcheck="false" type="text" class="${css.filter} form-control" onkeydown=${filter} placeholder="Search transactions">
</div> </div>
</div> </div>
</div> </div>
@ -158,7 +158,7 @@ class Terminal {
</div> </div>
` `
self._view.el = yo` self._view.el = yo`
<div class="${css.panel}"> <div class="${css.panel}" style="height: 180px;">
${self._view.bar} ${self._view.bar}
${self._view.term} ${self._view.term}
</div> </div>

@ -111,7 +111,8 @@ class CompileTab extends ApiFactory {
if (data['error']) { if (data['error']) {
this.renderer.error(data['error'].formattedMessage, this._view.errorContainer, {type: data['error'].severity || 'error'}) this.renderer.error(data['error'].formattedMessage, this._view.errorContainer, {type: data['error'].severity || 'error'})
if (data['error'].mode === 'panic') { if (data['error'].mode === 'panic') {
return modalDialogCustom.alert(yo`<div><i class="fa fa-exclamation-circle ${css.panicError}" aria-hidden="true"></i> return modalDialogCustom.alert(yo`
<div><i class="fa fa-exclamation-circle ${css.panicError}" aria-hidden="true"></i>
The compiler returned with the following internal error: <br> <b>${data['error'].formattedMessage}.<br> The compiler returned with the following internal error: <br> <b>${data['error'].formattedMessage}.<br>
The compiler might be in a non-sane state, please be careful and do not use further compilation data to deploy to mainnet. The compiler might be in a non-sane state, please be careful and do not use further compilation data to deploy to mainnet.
It is heavily recommended to use another browser not affected by this issue (Firefox is known to not be affected).</b><br> It is heavily recommended to use another browser not affected by this issue (Firefox is known to not be affected).</b><br>
@ -289,7 +290,10 @@ class CompileTab extends ApiFactory {
}) })
if (details[propertyName] !== '') { if (details[propertyName] !== '') {
try { try {
node = yo`<div>${treeView.render(typeof details[propertyName] === 'object' ? details[propertyName] : JSON.parse(details[propertyName]))}</div>` // catch in case the parsing fails. node = yo`
<div>
${treeView.render(typeof details[propertyName] === 'object' ? details[propertyName] : JSON.parse(details[propertyName]))}
</div>` // catch in case the parsing fails.
} catch (e) { } catch (e) {
node = yo`<div>Unable to display "${propertyName}": ${e.message}</div>` node = yo`<div>Unable to display "${propertyName}": ${e.message}</div>`
} }

@ -45,11 +45,19 @@ class Dropdown {
</div> </div>
` `
self._view.el = yo` self._view.el = yo`
<div class=${css.dropdown} onclick=${show}> <div name="dropdown" class="${css.dropdown} form-control form-control-sm" onclick=${show}>
${self._view.selected} ${self._view.selected}
<div class=${css.options} style="display: none;"> <div class="${css.options} bg-light" style="display: none;}">
${self.data._options.map(label => { ${self.data._options.map(label => {
var input = yo`<input data-idx=${self.data._elements.length} onchange=${emit} type="checkbox" />` let index = self.data._elements.length
var input = yo`
<input
data-idx=${index}
onchange=${emit}
type="${index === 2 ? 'checkbox' : 'radio'}"
id="${label}"
/>
`
if (self.data.selected.indexOf(label) !== -1) { if (self.data.selected.indexOf(label) !== -1) {
input.checked = true input.checked = true
self.event.trigger('select', [label]) self.event.trigger('select', [label])
@ -58,7 +66,7 @@ class Dropdown {
return yo` return yo`
<div class=${css.option}> <div class=${css.option}>
${input} ${input}
<label>${label}</label> <label class="text-dark" for="${label}">${label}</label>
</div> </div>
` `
})} })}

@ -1,33 +1,38 @@
var yo = require('yo-yo') let yo = require('yo-yo')
var csjs = require('csjs-inject') let csjs = require('csjs-inject')
// var globalRegistry = require('../../../global/registry') let globalRegistry = require('../../../global/registry')
let CompilerImport = require('../../compiler/compiler-imports')
var modalDialogCustom = require('../modal-dialog-custom')
var tooltip = require('../tooltip')
var css = csjs` let css = csjs`
.sectionContainer { .sectionContainer {
display : table-cell; display : flex;
flex-direction : column; flex-direction : column;
flex-wrap : wrap; flex-wrap : wrap;
align-content : space-around; align-content : space-around;
padding : 20px; padding : 20px;
max-width : 300px; max-width : 340px;
min-height : 300px;
background-color: var(--light); background-color: var(--light);
font-family : "Lucida Console", Monaco, monospace; font-family : "Lucida Console", Monaco, monospace;
} }
.landingPage { .landingPage {
height : 100%; height : 100%;
width : 100%; width : 100%;
background-color: var(--light);
flex-wrap : wrap; flex-wrap : wrap;
justify-content : space-evenly; justify-content : space-evenly;
user-select : none;
} }
.im { .im {
display : grid; display : grid;
max-width : 150px; max-width : 200px;
max-height : 160px; max-height : 200px;
width : 100%; width : 100%;
height : 100%; height : 100%;
padding : 20px; padding : 20px;
background-color: var(--bg-light); background-color: var(--bg-light);
align-self : center;
} }
.im:hover { .im:hover {
} }
@ -43,73 +48,109 @@ export class LandingPage extends ApiFactory {
constructor (appManager, appStore) { constructor (appManager, appStore) {
super() super()
this.sections = [] this.sections = []
/* var actionsStart = [ let load = function (item) {
let compilerImport = new CompilerImport()
let fileProviders = globalRegistry.get('fileproviders').api
modalDialogCustom.prompt(null, 'Enter the ' + item + ' you would like to load.', null, (target) => {
if (target !== '') {
compilerImport.import(
target,
(loadingMsg) => { tooltip(loadingMsg) },
(error, content, cleanUrl, type, url) => {
if (error) {
modalDialogCustom.alert(error)
} else {
if (fileProviders[type]) {
fileProviders[type].addReadOnly(cleanUrl, content, url)
}
}
}
)
}
})
}
var actionsStart = [
{ label: 'New file', { label: 'New file',
type: 'callback', type: 'callback',
payload: () => { payload: () => {
let fileExplorer = globalRegistry.get('fileexplorer').api let fileExplorer = globalRegistry.get('fileexplorer/browser').api
fileExplorer.creatNewFile() fileExplorer.createNewFile()
} }
}, },
{label: 'Import from GitHub', type: `callback`, payload: () => { this.alert(`-imported from GitHub-`) }}, { label: 'Open file',
{label: 'Import from gist', type: `callback`, payload: () => { this.alert(`-imported from gist-`) }}, type: `callback`,
{label: 'Import from swarm', type: `callback`, payload: () => { this.alert(`-imported from swarm-`) }}, description: ``,
{label: 'Import from ipfs', type: `callback`, payload: () => { this.alert(`-imported from ipfs-`) }}, payload: () => { this.alert(`-imported from gist-`) }
{label: 'Import from gist', type: `callback`, payload: () => { this.alert(`-imported from gist-`) }}, },
{label: 'Open file', type: `callback`, payload: () => { this.alert(`-imported from gist-`) }} { label: 'Import from gist',
] */ type: `callback`,
description: ``,
var actionsLearn = [ payload: () => {
{ label: 'Remix documentation', type: `link`, payload: `https://remix.readthedocs.io/en/latest/#` }, let app = globalRegistry.get('app').api
{ label: 'GitHub repository', type: `link`, payload: `https://github.com/ethereum/remix-ide` }, app.loadFromGist({gist: ''})
{ label: 'Access local file system. remixd', type: `link`, payload: `https://remix.readthedocs.io/en/latest/tutorial_remixd_filesystem.html` }, }
{ label: 'npm module for remixd', type: `link`, payload: `https://www.npmjs.com/package/remixd` }, },
{ label: 'Medium posts', type: `link`, payload: `https://medium.com/remix-ide` }, { label: 'Import from GitHub',
{ label: 'Tutorials', type: `link`, payload: `https://github.com/ethereum/remix-workshops` } type: `callback`,
] description: ``,
payload: () => {
var actionsPlugins = [ load('URL')
{ label: 'Remix plugins & modules', type: `link`, payload: `https://github.com/ethereum/remix-plugin/blob/master/readme.md` }, }
{ label: 'Repository on GitHub', type: `link`, payload: `https://github.com/ethereum/remix-plugin` }, },
{ label: 'Examples', type: `link`, payload: `https://github.com/ethereum/remix-plugin/tree/master/examples` }, { label: 'Import from Swarm',
{ label: 'Build a plugin for Remix', type: `link`, payload: `https://medium.com/remix-ide/build-a-plugin-for-remix-90d43b209c5a` } type: `callback`,
description: ``,
payload: () => { load('bzz-raw URL') }
},
{ label: 'Import from IPFS',
type: `callback`,
description: ``,
payload: () => { load('IPFS URL') }
},
{ label: 'Connect to localhost',
type: `callback`,
description: ``,
payload: () => {
appManager.ensureActivated('remixd')
}
}
] ]
var actionsHelp = [ var actionsHelp = [
{ label: 'Gitter channel', type: `link`, payload: `https://gitter.im/ethereum/remix` }, { label: 'Remix documentation', type: `link`, description: ``, payload: `https://remix.readthedocs.io/en/latest/#` },
{ label: 'Stack Overflow', type: `link`, payload: `https://stackoverflow.com/questions/tagged/remix` }, { label: 'Access local file system. remixd', description: ``, type: `link`, payload: `https://remix.readthedocs.io/en/latest/tutorial_remixd_filesystem.html` },
{ label: 'Reddit', type: `link`, payload: `https://www.reddit.com/r/ethdev/search?q=remix&restrict_sr=1` } { label: 'Medium posts', type: `link`, description: ``, payload: `https://medium.com/remix-ide` },
{ label: 'Plugins & modules', type: `link`, description: ``, payload: `https://github.com/ethereum/remix-plugin/blob/master/readme.md` },
{ label: 'GitHub repo', type: `link`, description: ``, payload: `https://github.com/ethereum/remix-ide` },
{ label: 'Gitter channel', type: `link`, description: ``, payload: `https://gitter.im/ethereum/remix` },
{ label: 'Stack Overflow', type: `link`, description: ``, payload: `https://stackoverflow.com/questions/tagged/remix` },
{ label: 'Reddit', type: `link`, description: ``, payload: `https://www.reddit.com/r/ethdev/search?q=remix&restrict_sr=1` }
] ]
// var sectionStart = new Section('Start', actionsStart) var sectionStart = new Section('Start', actionsStart)
var sectionLearn = new Section('Learn', actionsLearn) let sectionHelp = new Section('Help', actionsHelp)
var sectionPlugins = new Section('Plugins', actionsPlugins)
var sectionHelp = new Section('Help', actionsHelp)
var sectionsWorkspaces = [] this.sectionWorkspaceMain = []
this.sectionWorkspaceOthers = []
defaultWorkspaces(appManager).forEach((workspace) => { defaultWorkspaces(appManager).forEach((workspace) => {
sectionsWorkspaces.push({ if (workspace.isMain) {
this.sectionWorkspaceMain.push({
label: workspace.title, label: workspace.title,
type: 'callback', type: 'callback',
description: workspace.description,
payload: () => { workspace.activate() } payload: () => { workspace.activate() }
}) })
}) } else {
sectionsWorkspaces.push({ this.sectionWorkspaceOthers.push({
label: 'Close All Modules', label: workspace.title,
type: 'callback', type: 'callback',
payload: () => { description: workspace.description,
appStore.getActives() payload: () => { workspace.activate() }
.filter(({ profile }) => !profile.required) })
.forEach((profile) => { appManager.deactivateOne(profile.name) })
} }
}) })
var sectionWorkspace = new Section('Workspaces', sectionsWorkspaces) this.sections.push(sectionStart)
this.sections.push(sectionWorkspace)
// this.sections.push(sectionStart)
this.sections.push(sectionLearn)
this.sections.push(sectionPlugins)
this.sections.push(sectionHelp) this.sections.push(sectionHelp)
} }
@ -131,20 +172,54 @@ export class LandingPage extends ApiFactory {
<div class="${css.landingPage}"> <div class="${css.landingPage}">
</div> </div>
` `
totalLook.appendChild(yo`
<div class="${css.sectionContainer} p-2"> let main = yo`<div class="container m-4"></div>`
<img class="${css.im}" src="${logo}" /> for (let i = 0; i < this.sectionWorkspaceMain.length; i++) {
${this.sections[0].render()} main.appendChild(yo`
</div> <span class="btn btn-secondary btn-lg m-2" onclick="${this.sectionWorkspaceMain[i].payload}">
${this.sectionWorkspaceMain[i].label}
</span>
`) `)
}
for (let i = 1; i < this.sections.length; i++) { let others = yo`<div class="container m-4"></div>`
totalLook.appendChild(yo` for (let i = 0; i < this.sectionWorkspaceOthers.length; i++) {
others.appendChild(yo`
<span class="btn btn-secondary btn-sm m-2" onclick="${this.sectionWorkspaceOthers[i].payload}">
${this.sectionWorkspaceOthers[i].label}
</span>
`)
}
let docs = yo`<div class="container m-4"></div>`
for (let i = 0; i < this.sections.length; i++) {
docs.appendChild(yo`
<div class="${css.sectionContainer} p-2"> <div class="${css.sectionContainer} p-2">
${this.sections[i].render()} ${this.sections[i].render()}
</div> </div>
`) `)
} }
totalLook.appendChild(yo`
<div class="container-fluid">
<div class="row">
<div class="card m-4 p-4" style="min-width: 50%;">
<img class="card-img-top ${css.im}" src="${logo}" />
<div class="card-body-fluid m-4">
<h5 class="card-header m-4">Workspaces</h5>
<h6>Create, compile and execute smart contracts</h6>
<p>${main}</p>
<h6> Most used plugins</h6>
<p>${others}</p>
</div>
</div>
<div>
${docs}
</div>
</div>
</div>
`)
return totalLook return totalLook
} }
} }

@ -6,6 +6,7 @@ var css = csjs`
cursor: pointer; cursor: pointer;
font-weight: normal; font-weight: normal;
max-width: 300px; max-width: 300px;
user-select: none;
} }
.text:hover { .text:hover {
font-weight: bold; font-weight: bold;
@ -14,6 +15,7 @@ var css = csjs`
cursor: pointer; cursor: pointer;
font-weight: normal; font-weight: normal;
text-decoration : none; text-decoration : none;
user-select: none;
} }
.link:hover { .link:hover {
font-weight: bold; font-weight: bold;
@ -25,13 +27,12 @@ class Section {
constructor (title, actions) { constructor (title, actions) {
this.title = title this.title = title
this.actions = actions this.actions = actions
this.cardStyle = (this.title === 'Workspaces') ? 'bg-success text-light' : 'bg-light text-dark border-dark'
} }
render () { render () {
let sectionLook = yo` let sectionLook = yo`
<div class="card ${this.cardStyle} p-3" style="min-width: 300px;"> <div class="card border-0 bg-light bd-light text-dark p-1" style="min-width: 300px; min-height: 210px;">
<div class="card-header font-weight-bold">${this.title}</div> <div class="card-header font-weight-bold" style="user-select: none;">${this.title}</div>
<p></p> <p></p>
</div> </div>
` `
@ -39,7 +40,7 @@ class Section {
if (this.actions[i].type === `callback`) { if (this.actions[i].type === `callback`) {
sectionLook.appendChild(yo` sectionLook.appendChild(yo`
<div> <div>
<span class ="${css.text}" onclick=${this.actions[i].payload} > <span class="${css.text} text-dark" onclick=${this.actions[i].payload} >
${this.actions[i].label} ${this.actions[i].label}
</span> </span>
</div> </div>
@ -47,7 +48,7 @@ class Section {
} else if (this.actions[i].type === `link`) { } else if (this.actions[i].type === `link`) {
sectionLook.appendChild(yo` sectionLook.appendChild(yo`
<div > <div >
<a class="${css.link} text-decoration-none" href=${this.actions[i].payload} target="_blank" > <a class="${css.link} text-dark text-decoration-none" href=${this.actions[i].payload} target="_blank" >
${this.actions[i].label} ${this.actions[i].label}
</a> </a>
</div> </div>

@ -1,7 +1,8 @@
export class Workspace { export class Workspace {
constructor (title, description, activate, deactivate) { constructor (title, description, isMain, activate, deactivate) {
this.title = title this.title = title
this.description = description this.description = description
this.isMain = isMain
this.activate = activate this.activate = activate
this.deactivate = deactivate this.deactivate = deactivate
} }
@ -9,23 +10,31 @@ export class Workspace {
export const defaultWorkspaces = (appManager) => { export const defaultWorkspaces = (appManager) => {
return [ return [
new Workspace('Solidity', '', () => { new Workspace(
'Solidity',
'Writing smart contracts. It is used for implementing smart contracts on various blockchain platforms',
true,
() => {
appManager.ensureActivated('solidity') appManager.ensureActivated('solidity')
appManager.ensureActivated('run') appManager.ensureActivated('run')
appManager.ensureActivated('solidityStaticAnalysis') appManager.ensureActivated('solidityStaticAnalysis')
appManager.ensureActivated('solidityUnitTesting') appManager.ensureActivated('solidityUnitTesting')
}, () => {}), }, () => {}),
new Workspace('Vyper', '', () => { new Workspace(
'Vyper',
'Vyper is a contract-oriented, pythonic programming language that targets the Ethereum Virtual Machine (EVM)',
true,
() => {
appManager.ensureActivated('vyper') appManager.ensureActivated('vyper')
appManager.ensureActivated('run') appManager.ensureActivated('run')
}, () => {}), }, () => {}),
new Workspace('Pipeline', '', () => { new Workspace('Debugger', 'Debug transactions with remix', false, () => {
appManager.ensureActivated('debugger')
}, () => {}),
new Workspace('Pipeline', '', false, () => {
appManager.ensureActivated('solidity') appManager.ensureActivated('solidity')
appManager.ensureActivated('run')
appManager.ensureActivated('pipeline') appManager.ensureActivated('pipeline')
}, () => {}), appManager.ensureActivated('run')
new Workspace('Debugger', '', () => { })
appManager.ensureActivated('debugger')
}, () => {})
] ]
} }

@ -6,23 +6,22 @@ var css = csjs`
position : relative; position : relative;
display : flex; display : flex;
flex-direction : column; flex-direction : column;
margin-right : 10px; margin-left : 10px;
width : auto; width : auto;
} }
.selectbox { .selectbox {
display : flex; display : flex;
align-items : center; align-items : center;
margin : 3px;
cursor : pointer; cursor : pointer;
} }
.selected { .selected {
display : inline-block; display : inline-block;
min-width : 30ch;
max-width : 30ch; max-width : 30ch;
white-space : nowrap; white-space : nowrap;
text-overflow : ellipsis; text-overflow : ellipsis;
overflow : hidden; overflow : hidden;
padding : 3px; margin-right : 10px;
min-width : 200px;
} }
.icon { .icon {
padding : 0px 5px; padding : 0px 5px;
@ -32,15 +31,18 @@ var css = csjs`
display : flex; display : flex;
flex-direction : column; flex-direction : column;
align-items : end; align-items : end;
top : 24px; top : 32px;
left : 0; left : 0;
width : 250px; width : 245px;
border : 1px solid var(--primary); border : 1px solid var(--dark);
border-radius : 3px; border-radius : 3px;
border-top : 0; border-top : 0;
padding-left : 5px;
} }
.option { .option {
margin: 0; margin-left : 5px;
margin-top : 5px;
width : -webkit-fill-available;
} }
` `

@ -18,6 +18,7 @@ export class RemixAppManager extends AppManagerApi {
ensureActivated (apiName) { ensureActivated (apiName) {
if (!this.store.isActive(apiName)) this.activateOne(apiName) if (!this.store.isActive(apiName)) this.activateOne(apiName)
this.event.emit('ensureActivated', apiName)
} }
proxy () { proxy () {

Loading…
Cancel
Save