1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Merge pull request #2410 from alextsg/nu-2280

[NewUI] Fix loading animation not showing on network change
This commit is contained in:
Chi Kei Chan 2017-10-20 15:35:26 -07:00 committed by GitHub
commit d6f1f2bcca
4 changed files with 38 additions and 46 deletions

View File

@ -137,8 +137,7 @@ App.prototype.render = function () {
h(AccountMenu), h(AccountMenu),
h(Loading, { (isLoading || isLoadingNetwork) && h(Loading, {
isLoading: isLoading || isLoadingNetwork,
loadingMessage: loadMessage, loadingMessage: loadMessage,
}), }),

View File

@ -87,7 +87,7 @@ BuyButtonSubview.prototype.headerSubview = function () {
left: '49vw', left: '49vw',
}, },
}, [ }, [
h(Loading, { isLoading }), isLoading && h(Loading),
]), ]),
// account panel // account panel

View File

@ -1,23 +1,18 @@
const inherits = require('util').inherits const { Component } = require('react')
const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
class LoadingIndicator extends Component {
renderMessage () {
const { loadingMessage } = this.props
return loadingMessage && h('span', loadingMessage)
}
inherits(LoadingIndicator, Component) render () {
module.exports = LoadingIndicator
function LoadingIndicator () {
Component.call(this)
}
LoadingIndicator.prototype.render = function () {
const { isLoading, loadingMessage } = this.props
return ( return (
isLoading ? h('.full-flex-height', { h('.full-flex-height', {
style: { style: {
left: '0px', left: '0px',
zIndex: 10, zIndex: 50,
position: 'absolute', position: 'absolute',
flexDirection: 'column', flexDirection: 'column',
display: 'flex', display: 'flex',
@ -34,12 +29,10 @@ LoadingIndicator.prototype.render = function () {
h('br'), h('br'),
showMessageIfAny(loadingMessage), this.renderMessage(),
]) : null ])
) )
}
} }
function showMessageIfAny (loadingMessage) { module.exports = LoadingIndicator
if (!loadingMessage) return null
return h('span', loadingMessage)
}

View File

@ -84,7 +84,7 @@ ConfirmTxScreen.prototype.render = function () {
*/ */
log.info(`rendering a combined ${unconfTxList.length} unconf msg & txs`) log.info(`rendering a combined ${unconfTxList.length} unconf msg & txs`)
if (unconfTxList.length === 0) return h(Loading, { isLoading: true }) if (unconfTxList.length === 0) return h(Loading)
return currentTxView({ return currentTxView({
// Properties // Properties
@ -130,7 +130,7 @@ function currentTxView (opts) {
return h(PendingTypedMsg, opts) return h(PendingTypedMsg, opts)
} }
} }
return h(Loading, { isLoading: true }) return h(Loading)
} }
ConfirmTxScreen.prototype.buyEth = function (address, event) { ConfirmTxScreen.prototype.buyEth = function (address, event) {