Skip to content

Commit

Permalink
Merge pull request ethereum#563 from ethereum/compilationWarning
Browse files Browse the repository at this point in the history
Restyle compilation warning
  • Loading branch information
yann300 authored May 30, 2017
2 parents d80462e + 1c4eca4 commit 49a1551
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
11 changes: 11 additions & 0 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ var $ = require('jquery')
var base64 = require('js-base64').Base64
var swarmgw = require('swarmgw')
var csjs = require('csjs-inject')
var styleGuide = require('./app/style-guide')
var styles = styleGuide()

var QueryParams = require('./app/query-params')
var queryParams = new QueryParams()
Expand Down Expand Up @@ -797,11 +799,20 @@ var run = function () {
config.set('autoCompile', autoCompile)
})

var cssCompilationWarning = csjs`
.compilationWarning extends ${styles.warningTextBox} {
margin-top: 1em;
margin-left: 0.5em;
}
`
var warnMsg = ' Last compilation took {X}ms. We suggest to turn off autocompilation.'
compiler.event.register('compilationDuration', (speed) => {
$('#warnCompilationSlow').html('')
$('#warnCompilationSlow').hide()
$('#header #menu .settingsView').css('color', '')
if (speed > 1000) {
document.querySelector('#warnCompilationSlow').className = cssCompilationWarning.compilationWarning
$('#warnCompilationSlow').show()
$('#warnCompilationSlow').html(warnMsg.replace('{X}', speed))
$('#header #menu .settingsView').css('color', '#FF8B8B')
}
Expand Down
6 changes: 2 additions & 4 deletions src/app/settings-tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ var css = csjs`
.checkboxText {
margin-left: 3px;
}
#warnCompilationSlow {
color: #FF8B8B;
}
}
`
module.exports = settingsTab
Expand All @@ -61,12 +58,13 @@ function settingsTab () {
</div>
<div class="${css.crow}">
<div><input class="${css.col1}" id="autoCompile" type="checkbox" checked></div>
<span class="${css.checkboxText}">Auto Compile</span><span id="warnCompilationSlow"></span>
<span class="${css.checkboxText}">Auto Compile</span>
</div>
</div>
<div class="${css.crow}">
<div class="${css.button} "id="compile" title="Compile source code">Compile</div>
</div>
<div id="warnCompilationSlow" class="${css.compilationWarning}"></div>
</div>
`
}

0 comments on commit 49a1551

Please sign in to comment.