disable add account when nesseccary

pull/3094/head
LianaHus 6 years ago
parent 288739a0ac
commit 98a1f6d635
  1. 30
      src/app/tabs/runTab/settings.js
  2. 3
      src/app/tabs/styles/run-tab-styles.js
  3. 3
      src/app/ui/styles/tooltip-styles.js

@ -87,7 +87,7 @@ class SettingsUI {
<div class="${css.crow}"> <div class="${css.crow}">
<div class="${css.col1_1}"> <div class="${css.col1_1}">
Account Account
<i class="fas fa-plus-circle ${css.icon}" aria-hidden="true" onclick=${this.newAccount.bind(this)} title="Create a new account"></i> <i id="remixRunPlus" class="fas fa-plus-circle ${css.icon}" aria-hidden="true" onclick=${this.newAccount.bind(this)} title="Create a new account"></i>
</div> </div>
<div class=${css.account}> <div class=${css.account}>
<select name="txorigin" class="form-control ${css.select}" id="txorigin"></select> <select name="txorigin" class="form-control ${css.select}" id="txorigin"></select>
@ -194,6 +194,34 @@ class SettingsUI {
this.event.trigger('clearInstance', []) this.event.trigger('clearInstance', [])
this.updateNetwork() this.updateNetwork()
this.fillAccountsList() this.fillAccountsList()
this.updatePlusButton()
}
updatePlusButton() {
// enable/disable + button
let plusBtn = document.getElementById("remixRunPlus")
switch (this.selectExEnv.value) {
case "injected": {
plusBtn.classList.add(css.disableMouseEvents)
plusBtn.title = "Unfortnately it's not possible to create an account for injected web3, please use the Metamask or other providers"
}
break;
case "vm": {
plusBtn.classList.remove(css.disableMouseEvents)
plusBtn.title = "Create a new account"
}
break;
case "web3": {
if (!this._components.registry.get('config').api.get("settings/personal-mode")) {
plusBtn.classList.add(css.disableMouseEvents)
plusBtn.title = "Creating an account is possible only in Personal mode. Please go to Settings to enable it."
} else {
plusBtn.classList.remove(css.disableMouseEvents)
plusBtn.title = "Create a new account"
}
}
default:
}
} }
newAccount () { newAccount () {

@ -178,6 +178,9 @@ var css = csjs`
border-radius: 3px; border-radius: 3px;
margin-left: 5px; margin-left: 5px;
} }
.disableMouseEvents {
pointer-events: none;
}
.icon { .icon {
cursor: pointer; cursor: pointer;
font-size: 12px; font-size: 12px;

@ -7,13 +7,12 @@ var css = csjs`
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
position: fixed; position: fixed;
color: var(--primary)
min-height: 50px; min-height: 50px;
padding: 16px 24px 12px; padding: 16px 24px 12px;
border-radius: 3px; border-radius: 3px;
bottom: -300; bottom: -300;
left: 40%; left: 40%;
font-size: 12px; font-size: 14px;
text-align: center; text-align: center;
bottom: 0; bottom: 0;
} }

Loading…
Cancel
Save