diff options
author | Dan Finlay <542863+danfinlay@users.noreply.github.com> | 2018-04-19 02:45:20 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-19 02:45:20 +0800 |
commit | 061975cd4a92dfcff7c98c2ab34290b8680c5545 (patch) | |
tree | 2a90ea64602a5e986b1b1d898d535d6eb89ad01b /ui/app/components | |
parent | 0a14cedaf1b63a334da5384c2c9cd3c6a91f877a (diff) | |
parent | 053044fb6561bb3fe7b87c61bf5d5d2750c46c58 (diff) | |
download | tangerine-wallet-browser-061975cd4a92dfcff7c98c2ab34290b8680c5545.tar tangerine-wallet-browser-061975cd4a92dfcff7c98c2ab34290b8680c5545.tar.gz tangerine-wallet-browser-061975cd4a92dfcff7c98c2ab34290b8680c5545.tar.bz2 tangerine-wallet-browser-061975cd4a92dfcff7c98c2ab34290b8680c5545.tar.lz tangerine-wallet-browser-061975cd4a92dfcff7c98c2ab34290b8680c5545.tar.xz tangerine-wallet-browser-061975cd4a92dfcff7c98c2ab34290b8680c5545.tar.zst tangerine-wallet-browser-061975cd4a92dfcff7c98c2ab34290b8680c5545.zip |
Merge pull request #3977 from MetaMask/i-3913-big-number
Fix BigNumber exception in confirm-send-ether
Diffstat (limited to 'ui/app/components')
-rw-r--r-- | ui/app/components/loading.js | 18 | ||||
-rw-r--r-- | ui/app/components/pending-tx/index.js | 31 |
2 files changed, 39 insertions, 10 deletions
diff --git a/ui/app/components/loading.js b/ui/app/components/loading.js index cb6fa51fb..b9afc550f 100644 --- a/ui/app/components/loading.js +++ b/ui/app/components/loading.js @@ -1,6 +1,7 @@ const { Component } = require('react') const h = require('react-hyperscript') const PropTypes = require('prop-types') +const classnames = require('classnames') class LoadingIndicator extends Component { renderMessage () { @@ -10,14 +11,16 @@ class LoadingIndicator extends Component { render () { return ( - h('.full-flex-height.loading-overlay', {}, [ - h('img', { - src: 'images/loading.svg', - }), + h('.loading-overlay', { + className: classnames({ 'loading-overlay--full-screen': this.props.fullScreen }), + }, [ + h('.flex-center.flex-column', [ + h('img', { + src: 'images/loading.svg', + }), - h('br'), - - this.renderMessage(), + this.renderMessage(), + ]), ]) ) } @@ -25,6 +28,7 @@ class LoadingIndicator extends Component { LoadingIndicator.propTypes = { loadingMessage: PropTypes.string, + fullScreen: PropTypes.bool, } module.exports = LoadingIndicator diff --git a/ui/app/components/pending-tx/index.js b/ui/app/components/pending-tx/index.js index acdd99364..6ee83ba7e 100644 --- a/ui/app/components/pending-tx/index.js +++ b/ui/app/components/pending-tx/index.js @@ -1,6 +1,7 @@ const Component = require('react').Component const connect = require('react-redux').connect const h = require('react-hyperscript') +const PropTypes = require('prop-types') const clone = require('clone') const abi = require('human-standard-token-abi') const abiDecoder = require('abi-decoder') @@ -11,6 +12,7 @@ const util = require('../../util') const ConfirmSendEther = require('./confirm-send-ether') const ConfirmSendToken = require('./confirm-send-token') const ConfirmDeployContract = require('./confirm-deploy-contract') +const Loading = require('../loading') const TX_TYPES = { DEPLOY_CONTRACT: 'deploy_contract', @@ -53,10 +55,24 @@ function PendingTx () { } } -PendingTx.prototype.componentWillMount = async function () { +PendingTx.prototype.componentDidMount = function () { + this.setTokenData() +} + +PendingTx.prototype.componentDidUpdate = function (prevProps, prevState) { + if (prevState.isFetching) { + this.setTokenData() + } +} + +PendingTx.prototype.setTokenData = async function () { const txMeta = this.gatherTxMeta() const txParams = txMeta.txParams || {} + if (txMeta.loadingDefaults) { + return + } + if (!txParams.to) { return this.setState({ transactionType: TX_TYPES.DEPLOY_CONTRACT, @@ -125,7 +141,10 @@ PendingTx.prototype.render = function () { const { sendTransaction } = this.props if (isFetching) { - return h('noscript') + return h(Loading, { + fullScreen: true, + loadingMessage: this.context.t('generatingTransaction'), + }) } switch (transactionType) { @@ -150,6 +169,12 @@ PendingTx.prototype.render = function () { sendTransaction, }) default: - return h('noscript') + return h(Loading, { + fullScreen: true, + }) } } + +PendingTx.contextTypes = { + t: PropTypes.func, +} |