aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/dropdowns
diff options
context:
space:
mode:
authornyatla <nyatla39@gmail.com>2018-04-10 16:14:28 +0800
committernyatla <nyatla39@gmail.com>2018-04-10 16:14:28 +0800
commitcc246528b509b80e560715f3b315acf0764e99e7 (patch)
treea04cc12e6c11345bf751726f15fa9d3dd6be4733 /ui/app/components/dropdowns
parentbc0487006c623f1c81c186ba5b2a7137efb940ec (diff)
parentb91bd818c7c2aec2952036a2f69ab05e0690a06e (diff)
downloadtangerine-wallet-browser-cc246528b509b80e560715f3b315acf0764e99e7.tar.gz
tangerine-wallet-browser-cc246528b509b80e560715f3b315acf0764e99e7.tar.zst
tangerine-wallet-browser-cc246528b509b80e560715f3b315acf0764e99e7.zip
Merge tag 'v4.5.5'
# Conflicts: # app/_locales/ja/messages.json # package-lock.json messages.jsonのローカライズ
Diffstat (limited to 'ui/app/components/dropdowns')
-rw-r--r--ui/app/components/dropdowns/components/account-dropdowns.js26
-rw-r--r--ui/app/components/dropdowns/network-dropdown.js42
-rw-r--r--ui/app/components/dropdowns/token-menu-dropdown.js10
3 files changed, 48 insertions, 30 deletions
diff --git a/ui/app/components/dropdowns/components/account-dropdowns.js b/ui/app/components/dropdowns/components/account-dropdowns.js
index e5359c1d6..a133f0e29 100644
--- a/ui/app/components/dropdowns/components/account-dropdowns.js
+++ b/ui/app/components/dropdowns/components/account-dropdowns.js
@@ -10,7 +10,7 @@ const Identicon = require('../../identicon')
const ethUtil = require('ethereumjs-util')
const copyToClipboard = require('copy-to-clipboard')
const { formatBalance } = require('../../../util')
-const t = require('../../../../i18n')
+
class AccountDropdowns extends Component {
constructor (props) {
@@ -130,7 +130,7 @@ class AccountDropdowns extends Component {
actions.showEditAccountModal(identity)
},
}, [
- t('edit'),
+ this.context.t('edit'),
]),
]),
@@ -144,7 +144,7 @@ class AccountDropdowns extends Component {
try { // Sometimes keyrings aren't loaded yet:
const type = keyring.type
const isLoose = type !== 'HD Key Tree'
- return isLoose ? h('.keyring-label.allcaps', t('loose')) : null
+ return isLoose ? h('.keyring-label.allcaps', this.context.t('loose')) : null
} catch (e) { return }
}
@@ -202,7 +202,7 @@ class AccountDropdowns extends Component {
fontSize: '16px',
lineHeight: '23px',
},
- }, t('createAccount')),
+ }, this.context.t('createAccount')),
],
),
h(
@@ -236,7 +236,7 @@ class AccountDropdowns extends Component {
fontSize: '16px',
lineHeight: '23px',
},
- }, t('importAccount')),
+ }, this.context.t('importAccount')),
]
),
]
@@ -287,7 +287,7 @@ class AccountDropdowns extends Component {
menuItemStyles,
),
},
- t('accountDetails'),
+ this.context.t('accountDetails'),
),
h(
DropdownMenuItem,
@@ -303,7 +303,7 @@ class AccountDropdowns extends Component {
menuItemStyles,
),
},
- t('etherscanView'),
+ this.context.t('etherscanView'),
),
h(
DropdownMenuItem,
@@ -319,7 +319,7 @@ class AccountDropdowns extends Component {
menuItemStyles,
),
},
- t('copyAddress'),
+ this.context.t('copyAddress'),
),
h(
DropdownMenuItem,
@@ -331,7 +331,7 @@ class AccountDropdowns extends Component {
menuItemStyles,
),
},
- t('exportPrivateKey'),
+ this.context.t('exportPrivateKey'),
),
h(
DropdownMenuItem,
@@ -346,7 +346,7 @@ class AccountDropdowns extends Component {
menuItemStyles,
),
},
- t('addToken'),
+ this.context.t('addToken'),
),
]
@@ -425,6 +425,7 @@ AccountDropdowns.propTypes = {
enableAccountsSelector: PropTypes.bool,
enableAccountOption: PropTypes.bool,
enableAccountOptions: PropTypes.bool,
+ t: PropTypes.func,
}
const mapDispatchToProps = (dispatch) => {
@@ -463,4 +464,9 @@ function mapStateToProps (state) {
}
}
+AccountDropdowns.contextTypes = {
+ t: PropTypes.func,
+}
+
module.exports = connect(mapStateToProps, mapDispatchToProps)(AccountDropdowns)
+
diff --git a/ui/app/components/dropdowns/network-dropdown.js b/ui/app/components/dropdowns/network-dropdown.js
index 5afe730c1..9e47f38ef 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')),
]
),
@@ -197,20 +203,20 @@ NetworkDropdown.prototype.render = function () {
{
key: 'default',
closeMenu: () => this.props.hideNetworkDropdown(),
- onClick: () => props.setRpcTarget('http://localhost:8545'),
+ onClick: () => props.setProviderType('localhost'),
style: dropdownMenuItemStyle,
},
[
- activeNetwork === 'http://localhost:8545' ? h('i.fa.fa-check') : h('.network-check__transparent', '✓'),
+ providerType === 'localhost' ? h('i.fa.fa-check') : h('.network-check__transparent', '✓'),
h(NetworkDropdownIcon, {
- isSelected: activeNetwork === 'http://localhost:8545',
+ isSelected: providerType === 'localhost',
innerBorder: '1px solid #9b9b9b',
}),
h('span.network-name-item', {
style: {
- color: activeNetwork === 'http://localhost:8545' ? '#ffffff' : '#9b9b9b',
+ color: providerType === 'localhost' ? '#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
diff --git a/ui/app/components/dropdowns/token-menu-dropdown.js b/ui/app/components/dropdowns/token-menu-dropdown.js
index a4f93b505..b70d0b893 100644
--- a/ui/app/components/dropdowns/token-menu-dropdown.js
+++ b/ui/app/components/dropdowns/token-menu-dropdown.js
@@ -1,12 +1,18 @@
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
const actions = require('../../actions')
-const t = require('../../../i18n')
+
+
+TokenMenuDropdown.contextTypes = {
+ t: PropTypes.func,
+}
module.exports = connect(null, mapDispatchToProps)(TokenMenuDropdown)
+
function mapDispatchToProps (dispatch) {
return {
showHideTokenConfirmationModal: (token) => {
@@ -44,7 +50,7 @@ TokenMenuDropdown.prototype.render = function () {
showHideTokenConfirmationModal(this.props.token)
this.props.onClose()
},
- }, t('hideToken')),
+ }, this.context.t('hideToken')),
]),
]),