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

Hide app-header when provider request pending (#5831)

This commit is contained in:
Whymarrh Whitby 2018-11-26 16:51:07 -03:30 committed by GitHub
parent 8198ec9ae1
commit 88defe3623
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 4 deletions

View File

@ -23,6 +23,7 @@ export default class AppHeader extends PureComponent {
toggleAccountMenu: PropTypes.func,
selectedAddress: PropTypes.string,
isUnlocked: PropTypes.bool,
providerRequests: PropTypes.array,
}
static contextTypes = {
@ -40,12 +41,23 @@ export default class AppHeader extends PureComponent {
: hideNetworkDropdown()
}
/**
* Returns whether or not the user is in the middle of a confirmation prompt
*
* This accounts for both tx confirmations as well as provider approvals
*
* @returns {boolean}
*/
isConfirming () {
const { location } = this.props
const { location, providerRequests } = this.props
const confirmTxRouteMatch = matchPath(location.pathname, {
exact: false,
path: CONFIRM_TRANSACTION_ROUTE,
})
const isConfirmingTx = Boolean(confirmTxRouteMatch)
const hasPendingProviderApprovals = Array.isArray(providerRequests) && providerRequests.length > 0
return Boolean(matchPath(location.pathname, {
path: CONFIRM_TRANSACTION_ROUTE, exact: false,
}))
return isConfirmingTx || hasPendingProviderApprovals
}
renderAccountMenu () {

View File

@ -11,6 +11,7 @@ const mapStateToProps = state => {
const {
network,
provider,
providerRequests,
selectedAddress,
isUnlocked,
} = metamask
@ -19,6 +20,7 @@ const mapStateToProps = state => {
networkDropdownOpen,
network,
provider,
providerRequests,
selectedAddress,
isUnlocked,
}