diff options
Diffstat (limited to 'old-ui/app')
-rw-r--r-- | old-ui/app/account-detail.js | 2 | ||||
-rw-r--r-- | old-ui/app/accounts/import/json.js | 2 | ||||
-rw-r--r-- | old-ui/app/accounts/import/private-key.js | 2 | ||||
-rw-r--r-- | old-ui/app/app.js | 9 | ||||
-rw-r--r-- | old-ui/app/components/ens-input.js | 101 |
5 files changed, 61 insertions, 55 deletions
diff --git a/old-ui/app/account-detail.js b/old-ui/app/account-detail.js index 692d50491..c67f0cf71 100644 --- a/old-ui/app/account-detail.js +++ b/old-ui/app/account-detail.js @@ -91,7 +91,7 @@ AccountDetailScreen.prototype.render = function () { isEditingLabel: false, }, saveText: (text) => { - props.dispatch(actions.saveAccountLabel(selected, text)) + props.dispatch(actions.setAccountLabel(selected, text)) }, }, [ diff --git a/old-ui/app/accounts/import/json.js b/old-ui/app/accounts/import/json.js index 3ee3b95df..8388f17a7 100644 --- a/old-ui/app/accounts/import/json.js +++ b/old-ui/app/accounts/import/json.js @@ -96,6 +96,8 @@ class JsonImportSubview extends Component { } this.props.importNewAccount([ fileContents, password ]) + // JS runtime requires caught rejections but failures are handled by Redux + .catch() } } diff --git a/old-ui/app/accounts/import/private-key.js b/old-ui/app/accounts/import/private-key.js index 105191105..92e42549d 100644 --- a/old-ui/app/accounts/import/private-key.js +++ b/old-ui/app/accounts/import/private-key.js @@ -64,4 +64,6 @@ PrivateKeyImportView.prototype.createNewKeychain = function () { const input = document.getElementById('private-key-box') const privateKey = input.value this.props.dispatch(actions.importNewAccount('Private Key', [ privateKey ])) + // JS runtime requires caught rejections but failures are handled by Redux + .catch() } diff --git a/old-ui/app/app.js b/old-ui/app/app.js index 3aa845b3a..abeb4f3f9 100644 --- a/old-ui/app/app.js +++ b/old-ui/app/app.js @@ -35,7 +35,6 @@ const HDCreateVaultComplete = require('./keychains/hd/create-vault-complete') const HDRestoreVaultScreen = require('./keychains/hd/restore-vault') const RevealSeedConfirmation = require('./keychains/hd/recover-seed/confirmation') const AccountDropdowns = require('./components/account-dropdowns').AccountDropdowns -const { BETA_UI_NETWORK_TYPE } = require('../../app/scripts/controllers/network/enums') module.exports = connect(mapStateToProps)(App) @@ -63,7 +62,7 @@ function mapStateToProps (state) { isInitialized: state.metamask.isInitialized, isUnlocked: state.metamask.isUnlocked, currentView: state.appState.currentView, - activeAddress: state.appState.activeAddress, + selectedAddress: state.metamask.selectedAddress, transForward: state.appState.transForward, isMascara: state.metamask.isMascara, isOnboarding: Boolean(!noActiveNotices || seedWords || !isInitialized), @@ -198,7 +197,7 @@ App.prototype.renderAppBar = function () { style: {}, enableAccountsSelector: true, identities: this.props.identities, - selected: this.props.currentView.context, + selected: this.props.selectedAddress, network: this.props.network, keyrings: this.props.keyrings, }, []), @@ -409,7 +408,6 @@ App.prototype.renderDropdown = function () { closeMenu: () => this.setState({ isMainMenuOpen: !isOpen }), onClick: () => { this.props.dispatch(actions.setFeatureFlag('betaUI', true, 'BETA_UI_NOTIFICATION_MODAL')) - .then(() => this.props.dispatch(actions.setNetworkEndpoints(BETA_UI_NETWORK_TYPE))) }, }, 'Try Beta!'), ]) @@ -472,7 +470,6 @@ App.prototype.renderPrimary = function () { onClick: () => { global.platform.openExtensionInBrowser() props.dispatch(actions.setFeatureFlag('betaUI', true, 'BETA_UI_NOTIFICATION_MODAL')) - .then(() => props.dispatch(actions.setNetworkEndpoints(BETA_UI_NETWORK_TYPE))) }, style: { fontSize: '0.8em', @@ -591,7 +588,7 @@ App.prototype.renderPrimary = function () { }, }, [ h('i.fa.fa-arrow-left.fa-lg.cursor-pointer.color-orange', { - onClick: () => props.dispatch(actions.backToAccountDetail(props.activeAddress)), + onClick: () => props.dispatch(actions.backToAccountDetail(props.selectedAddress)), style: { marginLeft: '10px', marginTop: '50px', diff --git a/old-ui/app/components/ens-input.js b/old-ui/app/components/ens-input.js index d09c30644..7e06fa9f1 100644 --- a/old-ui/app/components/ens-input.js +++ b/old-ui/app/components/ens-input.js @@ -1,7 +1,6 @@ const Component = require('react').Component const h = require('react-hyperscript') const inherits = require('util').inherits -const extend = require('xtend') const debounce = require('debounce') const copyToClipboard = require('copy-to-clipboard') const ENS = require('ethjs-ens') @@ -20,55 +19,61 @@ function EnsInput () { EnsInput.prototype.render = function () { const props = this.props - const opts = extend(props, { - list: 'addresses', - onChange: () => { - const network = this.props.network - const networkHasEnsSupport = getNetworkEnsSupport(network) - if (!networkHasEnsSupport) return - - const recipient = document.querySelector('input[name="address"]').value - if (recipient.match(ensRE) === null) { - return this.setState({ - loadingEns: false, - ensResolution: null, - ensFailure: null, - }) - } - this.setState({ - loadingEns: true, + function onInputChange() { + const network = this.props.network + const networkHasEnsSupport = getNetworkEnsSupport(network) + if (!networkHasEnsSupport) return + + const recipient = document.querySelector('input[name="address"]').value + if (recipient.match(ensRE) === null) { + return this.setState({ + loadingEns: false, + ensResolution: null, + ensFailure: null, }) - this.checkName() - }, - }) - return h('div', { - style: { width: '100%' }, - }, [ - h('input.large-input', opts), - // The address book functionality. - h('datalist#addresses', - [ - // Corresponds to the addresses owned. - Object.keys(props.identities).map((key) => { - const identity = props.identities[key] - return h('option', { - value: identity.address, - label: identity.name, - key: identity.address, - }) - }), - // Corresponds to previously sent-to addresses. - props.addressBook.map((identity) => { - return h('option', { - value: identity.address, - label: identity.name, - key: identity.address, - }) - }), - ]), - this.ensIcon(), - ]) + } + + this.setState({ + loadingEns: true, + }) + this.checkName() + } + + return ( + h('div', { + style: { width: '100%' }, + }, [ + h('input.large-input', { + name: props.name, + placeholder: props.placeholder, + list: 'addresses', + onChange: onInputChange.bind(this), + }), + // The address book functionality. + h('datalist#addresses', + [ + // Corresponds to the addresses owned. + Object.keys(props.identities).map((key) => { + const identity = props.identities[key] + return h('option', { + value: identity.address, + label: identity.name, + key: identity.address, + }) + }), + // Corresponds to previously sent-to addresses. + props.addressBook.map((identity) => { + return h('option', { + value: identity.address, + label: identity.name, + key: identity.address, + }) + }), + ]), + this.ensIcon(), + ]) + ) } EnsInput.prototype.componentDidMount = function () { |