Merge pull request #3977 from MetaMask/i-3913-big-number

Fix BigNumber exception in confirm-send-ether
feature/default_network_editable
Dan Finlay 7 years ago committed by GitHub
commit 061975cd4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      app/_locales/en/messages.json
  2. 13
      ui/app/app.js
  3. 10
      ui/app/components/loading.js
  4. 31
      ui/app/components/pending-tx/index.js
  5. 12
      ui/app/css/itcss/components/loading-overlay.scss

@ -908,5 +908,8 @@
}, },
"youSign": { "youSign": {
"message": "You are signing" "message": "You are signing"
},
"generatingTransaction": {
"message": "Generating transaction"
} }
} }

@ -146,8 +146,6 @@ class App extends Component {
loadingMessage: loadMessage, loadingMessage: loadMessage,
}), }),
// this.renderLoadingIndicator({ isLoading, isLoadingNetwork, loadMessage }),
// content // content
this.renderRoutes(), this.renderRoutes(),
]) ])
@ -311,17 +309,6 @@ class App extends Component {
) )
} }
renderLoadingIndicator ({ isLoading, isLoadingNetwork, loadMessage }) {
const { isMascara } = this.props
return isMascara
? null
: h(Loading, {
isLoading: isLoading || isLoadingNetwork,
loadingMessage: loadMessage,
})
}
toggleMetamaskActive () { toggleMetamaskActive () {
if (!this.props.isUnlocked) { if (!this.props.isUnlocked) {
// currently inactive: redirect to password box // currently inactive: redirect to password box

@ -1,6 +1,7 @@
const { Component } = require('react') const { Component } = require('react')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const PropTypes = require('prop-types') const PropTypes = require('prop-types')
const classnames = require('classnames')
class LoadingIndicator extends Component { class LoadingIndicator extends Component {
renderMessage () { renderMessage () {
@ -10,14 +11,16 @@ class LoadingIndicator extends Component {
render () { render () {
return ( return (
h('.full-flex-height.loading-overlay', {}, [ h('.loading-overlay', {
className: classnames({ 'loading-overlay--full-screen': this.props.fullScreen }),
}, [
h('.flex-center.flex-column', [
h('img', { h('img', {
src: 'images/loading.svg', src: 'images/loading.svg',
}), }),
h('br'),
this.renderMessage(), this.renderMessage(),
]),
]) ])
) )
} }
@ -25,6 +28,7 @@ class LoadingIndicator extends Component {
LoadingIndicator.propTypes = { LoadingIndicator.propTypes = {
loadingMessage: PropTypes.string, loadingMessage: PropTypes.string,
fullScreen: PropTypes.bool,
} }
module.exports = LoadingIndicator module.exports = LoadingIndicator

@ -1,6 +1,7 @@
const Component = require('react').Component const Component = require('react').Component
const connect = require('react-redux').connect const connect = require('react-redux').connect
const h = require('react-hyperscript') const h = require('react-hyperscript')
const PropTypes = require('prop-types')
const clone = require('clone') const clone = require('clone')
const abi = require('human-standard-token-abi') const abi = require('human-standard-token-abi')
const abiDecoder = require('abi-decoder') const abiDecoder = require('abi-decoder')
@ -11,6 +12,7 @@ const util = require('../../util')
const ConfirmSendEther = require('./confirm-send-ether') const ConfirmSendEther = require('./confirm-send-ether')
const ConfirmSendToken = require('./confirm-send-token') const ConfirmSendToken = require('./confirm-send-token')
const ConfirmDeployContract = require('./confirm-deploy-contract') const ConfirmDeployContract = require('./confirm-deploy-contract')
const Loading = require('../loading')
const TX_TYPES = { const TX_TYPES = {
DEPLOY_CONTRACT: 'deploy_contract', 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 txMeta = this.gatherTxMeta()
const txParams = txMeta.txParams || {} const txParams = txMeta.txParams || {}
if (txMeta.loadingDefaults) {
return
}
if (!txParams.to) { if (!txParams.to) {
return this.setState({ return this.setState({
transactionType: TX_TYPES.DEPLOY_CONTRACT, transactionType: TX_TYPES.DEPLOY_CONTRACT,
@ -125,7 +141,10 @@ PendingTx.prototype.render = function () {
const { sendTransaction } = this.props const { sendTransaction } = this.props
if (isFetching) { if (isFetching) {
return h('noscript') return h(Loading, {
fullScreen: true,
loadingMessage: this.context.t('generatingTransaction'),
})
} }
switch (transactionType) { switch (transactionType) {
@ -150,6 +169,12 @@ PendingTx.prototype.render = function () {
sendTransaction, sendTransaction,
}) })
default: default:
return h('noscript') return h(Loading, {
fullScreen: true,
})
} }
} }
PendingTx.contextTypes = {
t: PropTypes.func,
}

@ -1,13 +1,14 @@
.loading-overlay { .loading-overlay {
left: 0px; left: 0;
z-index: 50; z-index: 50;
position: absolute; position: absolute;
flex-direction: column; flex-direction: column;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
flex: 1 1 auto;
width: 100%; width: 100%;
background: rgba(255, 255, 255, 0.8); background: rgba(255, 255, 255, .8);
@media screen and (max-width: 575px) { @media screen and (max-width: 575px) {
margin-top: 56px; margin-top: 56px;
@ -18,4 +19,11 @@
margin-top: 75px; margin-top: 75px;
height: calc(100% - 75px); height: calc(100% - 75px);
} }
&--full-screen {
position: fixed;
height: 100vh;
width: 100vw;
margin-top: 0;
}
} }

Loading…
Cancel
Save