From d98dc0f1b9278007f96229aa0c15181a96de7f1a Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 17 Sep 2018 13:50:04 +0200 Subject: [PATCH] improve UX run tab --- src/app/tabs/run-tab.js | 32 ++++++++++++++++++++++----- src/app/tabs/styles/run-tab-styles.js | 8 +++++-- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/app/tabs/run-tab.js b/src/app/tabs/run-tab.js index 377e953b68..e979b20254 100644 --- a/src/app/tabs/run-tab.js +++ b/src/app/tabs/run-tab.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``) + selectContractNames.setAttribute('disabled', true) + } else if (/.(.sol)$/.exec(currentFile)) { + deployAction('block') + } + }) + var atAddressButtonInput = yo`` var selectContractNames = yo`` @@ -317,15 +336,16 @@ function contractDropdown (events, self) { return null } - var createPanel = yo`
` - + self._view.createPanel = yo`
` + self._view.orLabel = yo`
or
` var el = yo`
${selectContractNames} ${compFails}
- ${createPanel} + ${self._view.createPanel} + ${self._view.orLabel}
At Address
${atAddressButtonInput} @@ -335,17 +355,17 @@ function contractDropdown (events, self) { ` function setInputParamsPlaceHolder () { - createPanel.innerHTML = '' + self._view.createPanel.innerHTML = '' if (self._deps.compiler.getContract && selectContractNames.selectedIndex >= 0 && selectContractNames.children.length > 0) { var ctrabi = txHelper.getConstructorInterface(getSelectedContract().contract.object.abi) var ctrEVMbc = getSelectedContract().contract.object.evm.bytecode.object var createConstructorInstance = new MultiParamManager(0, ctrabi, (valArray, inputsValues) => { createInstance(inputsValues) }, txHelper.inputParametersDeclarationToString(ctrabi.inputs), 'Deploy', ctrEVMbc) - createPanel.appendChild(createConstructorInstance.render()) + self._view.createPanel.appendChild(createConstructorInstance.render()) return } else { - createPanel.innerHTML = 'No compiled contracts' + self._view.createPanel.innerHTML = 'No compiled contracts' } } diff --git a/src/app/tabs/styles/run-tab-styles.js b/src/app/tabs/styles/run-tab-styles.js index 02493e9926..51425db511 100644 --- a/src/app/tabs/styles/run-tab-styles.js +++ b/src/app/tabs/styles/run-tab-styles.js @@ -148,7 +148,8 @@ var css = csjs` ${styles.rightPanel.runTab.button_Create} } .input { - ${styles.rightPanel.runTab.input_RunTab} + ${styles.rightPanel.runTab.input_RunTab}; + font-size: 10px; } .noInstancesText { ${styles.rightPanel.runTab.box_Instance} @@ -233,7 +234,10 @@ var css = csjs` justify-content: space-evenly; ${styles.rightPanel.runTab.box_Info_RunTab}; width: 145px; -} + } + .orLabel { + text-align: center; + } ` module.exports = css