aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/dropdowns/network-dropdown.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/components/dropdowns/network-dropdown.js')
-rw-r--r--ui/app/components/dropdowns/network-dropdown.js34
1 files changed, 20 insertions, 14 deletions
diff --git a/ui/app/components/dropdowns/network-dropdown.js b/ui/app/components/dropdowns/network-dropdown.js
index 5afe730c1..94e5d967b 100644
--- a/ui/app/components/dropdowns/network-dropdown.js
+++ b/ui/app/components/dropdowns/network-dropdown.js
@@ -1,4 +1,5 @@
const Component = require('react').Component
+const PropTypes = require('prop-types')
const h = require('react-hyperscript')
const inherits = require('util').inherits
const connect = require('react-redux').connect
@@ -6,9 +7,9 @@ const actions = require('../../actions')
const Dropdown = require('./components/dropdown').Dropdown
const DropdownMenuItem = require('./components/dropdown').DropdownMenuItem
const NetworkDropdownIcon = require('./components/network-dropdown-icon')
-const t = require('../../../i18n')
const R = require('ramda')
+
// classes from nodes of the toggle element.
const notToggleElementClassnames = [
'menu-icon',
@@ -54,8 +55,13 @@ function NetworkDropdown () {
Component.call(this)
}
+NetworkDropdown.contextTypes = {
+ t: PropTypes.func,
+}
+
module.exports = connect(mapStateToProps, mapDispatchToProps)(NetworkDropdown)
+
// TODO: specify default props and proptypes
NetworkDropdown.prototype.render = function () {
const props = this.props
@@ -94,13 +100,13 @@ NetworkDropdown.prototype.render = function () {
}, [
h('div.network-dropdown-header', {}, [
- h('div.network-dropdown-title', {}, t('networks')),
+ h('div.network-dropdown-title', {}, this.context.t('networks')),
h('div.network-dropdown-divider'),
h('div.network-dropdown-content',
{},
- t('defaultNetwork')
+ this.context.t('defaultNetwork')
),
]),
@@ -122,7 +128,7 @@ NetworkDropdown.prototype.render = function () {
style: {
color: providerType === 'mainnet' ? '#ffffff' : '#9b9b9b',
},
- }, t('mainnet')),
+ }, this.context.t('mainnet')),
]
),
@@ -144,7 +150,7 @@ NetworkDropdown.prototype.render = function () {
style: {
color: providerType === 'ropsten' ? '#ffffff' : '#9b9b9b',
},
- }, t('ropsten')),
+ }, this.context.t('ropsten')),
]
),
@@ -166,7 +172,7 @@ NetworkDropdown.prototype.render = function () {
style: {
color: providerType === 'kovan' ? '#ffffff' : '#9b9b9b',
},
- }, t('kovan')),
+ }, this.context.t('kovan')),
]
),
@@ -188,7 +194,7 @@ NetworkDropdown.prototype.render = function () {
style: {
color: providerType === 'rinkeby' ? '#ffffff' : '#9b9b9b',
},
- }, t('rinkeby')),
+ }, this.context.t('rinkeby')),
]
),
@@ -210,7 +216,7 @@ NetworkDropdown.prototype.render = function () {
style: {
color: activeNetwork === 'http://localhost:8545' ? '#ffffff' : '#9b9b9b',
},
- }, t('localhost')),
+ }, this.context.t('localhost')),
]
),
@@ -234,7 +240,7 @@ NetworkDropdown.prototype.render = function () {
style: {
color: activeNetwork === 'custom' ? '#ffffff' : '#9b9b9b',
},
- }, t('customRPC')),
+ }, this.context.t('customRPC')),
]
),
@@ -249,15 +255,15 @@ NetworkDropdown.prototype.getNetworkName = function () {
let name
if (providerName === 'mainnet') {
- name = t('mainnet')
+ name = this.context.t('mainnet')
} else if (providerName === 'ropsten') {
- name = t('ropsten')
+ name = this.context.t('ropsten')
} else if (providerName === 'kovan') {
- name = t('kovan')
+ name = this.context.t('kovan')
} else if (providerName === 'rinkeby') {
- name = t('rinkeby')
+ name = this.context.t('rinkeby')
} else {
- name = t('unknownNetwork')
+ name = this.context.t('unknownNetwork')
}
return name