From fba17d77de9e60de0e02e90dc6dbcbbf7454158a Mon Sep 17 00:00:00 2001 From: Alexander Tseung Date: Wed, 23 Jan 2019 07:25:34 -0800 Subject: Refactor first time flow, remove seed phrase from state (#5994) * Refactor and fix styling for first time flow. Remove seed phrase from persisted metamask state * Fix linting and tests * Fix translations, initialization notice routing * Fix drizzle tests * Fix e2e tests * Fix integration tests * Fix styling * Fix migration naming from 030 to 031 * Open extension in browser when user has not completed onboarding --- .../components/app-header/app-header.component.js | 85 ++++++---------------- 1 file changed, 21 insertions(+), 64 deletions(-) (limited to 'ui/app/components/app-header/app-header.component.js') diff --git a/ui/app/components/app-header/app-header.component.js b/ui/app/components/app-header/app-header.component.js index 83fcca620..f7d8c8598 100644 --- a/ui/app/components/app-header/app-header.component.js +++ b/ui/app/components/app-header/app-header.component.js @@ -1,20 +1,13 @@ import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' -import { matchPath } from 'react-router-dom' import Identicon from '../identicon' - -const { - ENVIRONMENT_TYPE_NOTIFICATION, - ENVIRONMENT_TYPE_POPUP, -} = require('../../../../app/scripts/lib/enums') -const { DEFAULT_ROUTE, INITIALIZE_ROUTE, CONFIRM_TRANSACTION_ROUTE } = require('../../routes') +import { DEFAULT_ROUTE } from '../../routes' const NetworkIndicator = require('../network') export default class AppHeader extends PureComponent { static propTypes = { history: PropTypes.object, - location: PropTypes.object, network: PropTypes.string, provider: PropTypes.object, networkDropdownOpen: PropTypes.bool, @@ -23,7 +16,8 @@ export default class AppHeader extends PureComponent { toggleAccountMenu: PropTypes.func, selectedAddress: PropTypes.string, isUnlocked: PropTypes.bool, - providerRequests: PropTypes.array, + hideNetworkIndicator: PropTypes.bool, + disabled: PropTypes.bool, } static contextTypes = { @@ -41,34 +35,15 @@ 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, 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 isConfirmingTx || hasPendingProviderApprovals - } - renderAccountMenu () { - const { isUnlocked, toggleAccountMenu, selectedAddress } = this.props + const { isUnlocked, toggleAccountMenu, selectedAddress, disabled } = this.props return isUnlocked && (
this.isConfirming() || toggleAccountMenu()} + onClick={() => disabled || toggleAccountMenu()} > @@ -131,14 +84,18 @@ export default class AppHeader extends PureComponent { />
-
- this.handleNetworkIndicatorClick(event)} - disabled={this.isConfirming()} - /> -
+ { + !hideNetworkIndicator && ( +
+ this.handleNetworkIndicatorClick(event)} + disabled={disabled} + /> +
+ ) + } { this.renderAccountMenu() }
-- cgit