improve UX run tab

pull/1/head
yann300 6 years ago
parent cd80e1d4d9
commit d98dc0f1b9
  1. 32
      src/app/tabs/run-tab.js
  2. 6
      src/app/tabs/styles/run-tab-styles.js

@ -303,6 +303,25 @@ function contractDropdown (events, self) {
} }
}) })
var deployAction = (value) => {
self._view.createPanel.style.display = value
self._view.orLabel.style.display = value
}
self._deps.fileManager.event.register('currentFileChanged', (currentFile) => {
if (/.(.abi)$/.exec(currentFile)) {
deployAction('none')
compFails.style.display = 'none'
document.querySelector(`.${css.contractNames}`).classList.remove(css.contractNamesError)
var contractNames = document.querySelector(`.${css.contractNames.classNames[0]}`)
contractNames.innerHTML = ''
contractNames.appendChild(yo`<option>(abi)</option>`)
selectContractNames.setAttribute('disabled', true)
} else if (/.(.sol)$/.exec(currentFile)) {
deployAction('block')
}
})
var atAddressButtonInput = yo`<input class="${css.input} ataddressinput" placeholder="Load contract from Address" title="atAddress" />` var atAddressButtonInput = yo`<input class="${css.input} ataddressinput" placeholder="Load contract from Address" title="atAddress" />`
var selectContractNames = yo`<select class="${css.contractNames}" disabled></select>` var selectContractNames = yo`<select class="${css.contractNames}" disabled></select>`
@ -317,15 +336,16 @@ function contractDropdown (events, self) {
return null return null
} }
var createPanel = yo`<div class="${css.button}"></div>` self._view.createPanel = yo`<div class="${css.button}"></div>`
self._view.orLabel = yo`<div class="${css.orLabel}">or</div>`
var el = yo` var el = yo`
<div class="${css.container}"> <div class="${css.container}">
<div class="${css.subcontainer}"> <div class="${css.subcontainer}">
${selectContractNames} ${compFails} ${selectContractNames} ${compFails}
</div> </div>
<div class="${css.buttons}"> <div class="${css.buttons}">
${createPanel} ${self._view.createPanel}
${self._view.orLabel}
<div class="${css.button} ${css.atAddressSect}"> <div class="${css.button} ${css.atAddressSect}">
<div class="${css.atAddress}" onclick=${function () { loadFromAddress() }}>At Address</div> <div class="${css.atAddress}" onclick=${function () { loadFromAddress() }}>At Address</div>
${atAddressButtonInput} ${atAddressButtonInput}
@ -335,17 +355,17 @@ function contractDropdown (events, self) {
` `
function setInputParamsPlaceHolder () { function setInputParamsPlaceHolder () {
createPanel.innerHTML = '' self._view.createPanel.innerHTML = ''
if (self._deps.compiler.getContract && selectContractNames.selectedIndex >= 0 && selectContractNames.children.length > 0) { if (self._deps.compiler.getContract && selectContractNames.selectedIndex >= 0 && selectContractNames.children.length > 0) {
var ctrabi = txHelper.getConstructorInterface(getSelectedContract().contract.object.abi) var ctrabi = txHelper.getConstructorInterface(getSelectedContract().contract.object.abi)
var ctrEVMbc = getSelectedContract().contract.object.evm.bytecode.object var ctrEVMbc = getSelectedContract().contract.object.evm.bytecode.object
var createConstructorInstance = new MultiParamManager(0, ctrabi, (valArray, inputsValues) => { var createConstructorInstance = new MultiParamManager(0, ctrabi, (valArray, inputsValues) => {
createInstance(inputsValues) createInstance(inputsValues)
}, txHelper.inputParametersDeclarationToString(ctrabi.inputs), 'Deploy', ctrEVMbc) }, txHelper.inputParametersDeclarationToString(ctrabi.inputs), 'Deploy', ctrEVMbc)
createPanel.appendChild(createConstructorInstance.render()) self._view.createPanel.appendChild(createConstructorInstance.render())
return return
} else { } else {
createPanel.innerHTML = 'No compiled contracts' self._view.createPanel.innerHTML = 'No compiled contracts'
} }
} }

@ -148,7 +148,8 @@ var css = csjs`
${styles.rightPanel.runTab.button_Create} ${styles.rightPanel.runTab.button_Create}
} }
.input { .input {
${styles.rightPanel.runTab.input_RunTab} ${styles.rightPanel.runTab.input_RunTab};
font-size: 10px;
} }
.noInstancesText { .noInstancesText {
${styles.rightPanel.runTab.box_Instance} ${styles.rightPanel.runTab.box_Instance}
@ -234,6 +235,9 @@ var css = csjs`
${styles.rightPanel.runTab.box_Info_RunTab}; ${styles.rightPanel.runTab.box_Info_RunTab};
width: 145px; width: 145px;
} }
.orLabel {
text-align: center;
}
` `
module.exports = css module.exports = css

Loading…
Cancel
Save