import React, { Component } from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' import { MAINNET_CODE, ROPSTEN_CODE, RINKEYBY_CODE, KOVAN_CODE, } from '../../../../app/scripts/controllers/network/enums' const networkToClassHash = { [MAINNET_CODE]: 'mainnet', [ROPSTEN_CODE]: 'ropsten', [RINKEYBY_CODE]: 'rinkeby', [KOVAN_CODE]: 'kovan', } export default class NetworkDisplay extends Component { static propTypes = { network: PropTypes.string, provider: PropTypes.object, } static contextTypes = { t: PropTypes.func, } renderNetworkIcon () { const { network } = this.props const networkClass = networkToClassHash[network] return networkClass ?
:
} render () { const { network, provider: { type, nickname } } = this.props const networkClass = networkToClassHash[network] return (
{ networkClass ?
:
}
{ type === 'rpc' && nickname ? nickname : this.context.t(type) }
) } }