import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import classnames from 'classnames'; import Identicon from '../../ui/identicon'; import MetaFoxLogo from '../../ui/metafox-logo'; import { DEFAULT_ROUTE } from '../../../helpers/constants/routes'; import NetworkDisplay from '../network-display'; export default class AppHeader extends PureComponent { static propTypes = { history: PropTypes.object, networkDropdownOpen: PropTypes.bool, showNetworkDropdown: PropTypes.func, hideNetworkDropdown: PropTypes.func, toggleAccountMenu: PropTypes.func, selectedAddress: PropTypes.string, isUnlocked: PropTypes.bool, hideNetworkIndicator: PropTypes.bool, disabled: PropTypes.bool, disableNetworkIndicator: PropTypes.bool, isAccountMenuOpen: PropTypes.bool, onClick: PropTypes.func, }; static contextTypes = { t: PropTypes.func, metricsEvent: PropTypes.func, }; handleNetworkIndicatorClick(event) { event.preventDefault(); event.stopPropagation(); const { networkDropdownOpen, showNetworkDropdown, hideNetworkDropdown, disabled, disableNetworkIndicator, } = this.props; if (disabled || disableNetworkIndicator) { return; } if (networkDropdownOpen === false) { this.context.metricsEvent({ eventOpts: { category: 'Navigation', action: 'Home', name: 'Opened Network Menu', }, }); showNetworkDropdown(); } else { hideNetworkDropdown(); } } renderAccountMenu() { const { isUnlocked, toggleAccountMenu, selectedAddress, disabled, isAccountMenuOpen, } = this.props; return ( isUnlocked && (