Merge pull request #1916 from ethereum/contextView

Improve solidity context view
pull/1/head
yann300 6 years ago committed by GitHub
commit adeab283ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      src/app/editor/contextView.js
  2. 11
      src/app/editor/styles/contextView-styles.js
  3. 6
      src/app/panels/editor-panel.js

@ -36,19 +36,17 @@ class ContextView {
this.update() this.update()
}) })
this.contextualListener.event.register('stopHighlighting', () => { this.contextualListener.event.register('stopHighlighting', () => {
this.hide()
}) })
} }
render () { render () {
const view = yo`<div class="${css.contextview} ${css.contextviewcontainer} badge badge-secondary border-top-0"> const view = yo`<div class="${css.contextview} ${css.contextviewcontainer} badge bg-light border-0">
<div class=${css.container}> <div class=${css.container}>
${this._renderTarget()} ${this._renderTarget()}
</div> </div>
</div>` </div>`
if (!this._view) { if (!this._view) {
this._view = view this._view = view
this.hide()
} }
return view return view
} }
@ -68,7 +66,6 @@ class ContextView {
update () { update () {
if (this._view) { if (this._view) {
yo.update(this._view, this.render()) yo.update(this._view, this.render())
this._view.style.display = this._current ? 'block' : 'none'
} }
} }
@ -169,14 +166,13 @@ class ContextView {
} }
} }
return yo`<div class=${css.line}> return yo`<div class=${css.line}>${showGasEstimation()}
<div title=${type} class=${css.type}>${type}</div> <div title=${type} class=${css.type}>${type}</div>
<div title=${node.attributes.name} class=${css.name}>${node.attributes.name}</div> <div title=${node.attributes.name} class=${css.name}>${node.attributes.name}</div>
<i class="fas fa-share ${css.jump}" aria-hidden="true" onclick=${jumpTo}></i> <i class="fas fa-share ${css.jump}" aria-hidden="true" onclick=${jumpTo}></i>
<span class=${css.referencesnb}>${references}</span> <span class=${css.referencesnb}>${references}</span>
<i data-action='previous' class="fas fa-chevron-up ${css.jump}" aria-hidden="true" onclick=${jump}></i> <i data-action='previous' class="fas fa-chevron-up ${css.jump}" aria-hidden="true" onclick=${jump}></i>
<i data-action='next' class="fas fa-chevron-down ${css.jump}" aria-hidden="true" onclick=${jump}></i> <i data-action='next' class="fas fa-chevron-down ${css.jump}" aria-hidden="true" onclick=${jump}></i>
${showGasEstimation()}
</div>` </div>`
} }
} }

@ -2,7 +2,9 @@ var csjs = require('csjs-inject')
var css = csjs` var css = csjs`
.contextview { .contextview {
opacity : 1; opacity : 1;
position : relative;
height : 20px;
} }
.container { .container {
padding : 1px 15px; padding : 1px 15px;
@ -14,7 +16,7 @@ var css = csjs`
text-overflow : ellipsis; text-overflow : ellipsis;
overflow : hidden; overflow : hidden;
white-space : nowrap; white-space : nowrap;
font-size : 18px; font-size : 13px;
} }
.type { .type {
font-style : italic; font-style : italic;
@ -35,7 +37,7 @@ var css = csjs`
margin-left : 15px; margin-left : 15px;
} }
.gasEstimation { .gasEstimation {
margin-left: 15px; margin-right: 15px;
display: flex; display: flex;
align-items: center; align-items: center;
} }
@ -44,10 +46,7 @@ var css = csjs`
margin-right: 5px; margin-right: 5px;
} }
.contextviewcontainer{ .contextviewcontainer{
position : absolute;
top : 35px;
z-index : 50; z-index : 50;
left : 40%;
border-radius : 1px; border-radius : 1px;
border : 2px solid var(--secondary); border : 2px solid var(--secondary);
} }

@ -71,17 +71,19 @@ class EditorPanel {
// we check upstream for "fileChanged" // we check upstream for "fileChanged"
self._view.editor.style.display = 'block' self._view.editor.style.display = 'block'
self._view.mainPanel.style.display = 'none' self._view.mainPanel.style.display = 'none'
self._components.contextView.show()
}) })
self.tabProxy.event.on('switchFile', (file) => { self.tabProxy.event.on('switchFile', (file) => {
self._view.editor.style.display = 'block' self._view.editor.style.display = 'block'
self._view.mainPanel.style.display = 'none' self._view.mainPanel.style.display = 'none'
self._components.contextView.show()
}) })
self.tabProxy.event.on('closeFile', (file) => { self.tabProxy.event.on('closeFile', (file) => {
}) })
self.tabProxy.event.on('switchApp', showApp) self.tabProxy.event.on('switchApp', showApp)
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.show()
self._view.mainPanel.style.display = 'none' self._view.mainPanel.style.display = 'none'
}) })
self.data = { self.data = {
@ -181,9 +183,9 @@ class EditorPanel {
self._view.content = yo` self._view.content = yo`
<div class=${css.content}> <div class=${css.content}>
${self.tabProxy.renderTabsbar()} ${self.tabProxy.renderTabsbar()}
${self._components.contextView.render()}
${self._view.editor} ${self._view.editor}
${self._view.mainPanel} ${self._view.mainPanel}
${self._components.contextView.render()}
${self._view.terminal} ${self._view.terminal}
</div> </div>
` `

Loading…
Cancel
Save