Merge pull request #1804 from ethereum/noFileSeleted

display no file selected in compile tab
pull/1/head
yann300 6 years ago committed by GitHub
commit 4cbe41c386
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      src/app/files/file-explorer.js
  2. 1
      src/app/files/fileManager.js
  3. 5
      src/app/tabs/compile-tab.js
  4. 10
      src/app/tabs/compileTab/compilerContainer.js

@ -245,6 +245,14 @@ function fileExplorer (localRegistry, files, menuItems) {
}
})
self._deps.fileManager.events.on('noFileSelected', () => {
if (self.focusElement) {
self.focusElement.classList.remove('bg-secondary')
self.focusElement = null
self.focusPath = null
}
})
var textUnderEdit = null
function selectElementContents (el) {

@ -101,6 +101,7 @@ class FileManager extends ApiFactory {
} else {
this._deps.editor.displayEmptyReadOnlySession()
this._deps.config.set('currentFile', '')
this.events.emit('noFileSelected')
}
this.events.emit('fileClosed', name)
}

@ -85,6 +85,11 @@ class CompileTab extends ApiFactory {
this.fileManager.events.on('currentFileChanged', (name) => {
this.compilerContainer.currentFile = name
})
this.fileManager.events.on('noFileSelected', () => {
this.compilerContainer.currentFile = ''
})
this.compiler.event.register('compilationFinished', (success, data, source) => {
if (success) {
// forwarding the event to the appManager infra

@ -95,12 +95,18 @@ class CompilerContainer {
* SUBCOMPONENT
*/
compilationButton (name) {
return yo`
if (!name) name = ''
var displayed = name === '' ? '<no file selected>' : name
var el = yo`
<div class="${css.compilerArticle}">
<button class="btn btn-primary btn-block" title="Compile" onclick="${this.compile.bind(this)}">
<span>${this._view.compileIcon} Compile ${name}</span>
<span>${this._view.compileIcon} Compile ${displayed}</span>
</button>
</div>`
if (name === '') {
el.setAttribute('disabled', 'true')
}
return el
}
render () {

Loading…
Cancel
Save