diff options
author | Alexander Tseung <alextsg@gmail.com> | 2018-03-20 07:12:09 +0800 |
---|---|---|
committer | Alexander Tseung <alextsg@gmail.com> | 2018-03-21 02:56:12 +0800 |
commit | 3c1248c8169a1cb96a0ee2bc0f523fb9c765569e (patch) | |
tree | c6b75368609ea0625490ad62ddb9e38342f3736f /ui/app/components/network-display.js | |
parent | 5c5f476ba4d0b26f6b8a71e16a8ff340566eb0b7 (diff) | |
download | tangerine-wallet-browser-3c1248c8169a1cb96a0ee2bc0f523fb9c765569e.tar tangerine-wallet-browser-3c1248c8169a1cb96a0ee2bc0f523fb9c765569e.tar.gz tangerine-wallet-browser-3c1248c8169a1cb96a0ee2bc0f523fb9c765569e.tar.bz2 tangerine-wallet-browser-3c1248c8169a1cb96a0ee2bc0f523fb9c765569e.tar.lz tangerine-wallet-browser-3c1248c8169a1cb96a0ee2bc0f523fb9c765569e.tar.xz tangerine-wallet-browser-3c1248c8169a1cb96a0ee2bc0f523fb9c765569e.tar.zst tangerine-wallet-browser-3c1248c8169a1cb96a0ee2bc0f523fb9c765569e.zip |
Update confirm transaction screen
Diffstat (limited to 'ui/app/components/network-display.js')
-rw-r--r-- | ui/app/components/network-display.js | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/ui/app/components/network-display.js b/ui/app/components/network-display.js new file mode 100644 index 000000000..9dc31b5c7 --- /dev/null +++ b/ui/app/components/network-display.js @@ -0,0 +1,51 @@ +const { Component } = require('react') +const h = require('react-hyperscript') +const PropTypes = require('prop-types') +const { connect } = require('react-redux') +const NetworkDropdownIcon = require('./dropdowns/components/network-dropdown-icon') +const t = require('../../i18n') + +const networkToColorHash = { + 1: '#038789', + 3: '#e91550', + 42: '#690496', + 4: '#ebb33f', +} + +class NetworkDisplay extends Component { + renderNetworkIcon () { + const { network } = this.props + const networkColor = networkToColorHash[network] + + return networkColor + ? h(NetworkDropdownIcon, { backgroundColor: networkColor }) + : h('i.fa.fa-question-circle.fa-med', { + style: { + margin: '0 4px', + color: 'rgb(125, 128, 130)', + }, + }) + } + + render () { + const { provider: { type } } = this.props + return h('.network-display__container', [ + this.renderNetworkIcon(), + h('.network-name', t(type)), + ]) + } +} + +NetworkDisplay.propTypes = { + network: PropTypes.string, + provider: PropTypes.object, +} + +const mapStateToProps = ({ metamask: { network, provider } }) => { + return { + network, + provider, + } +} + +module.exports = connect(mapStateToProps)(NetworkDisplay) |