aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/account-menu
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2018-03-29 23:00:44 +0800
committerDan <danjm.com@gmail.com>2018-03-29 23:12:38 +0800
commit0a711f0de0e342b24988a5da4ca5c64342153210 (patch)
tree9dd6014e6389cfad02d5380e6810a12fdf747b0a /ui/app/components/account-menu
parent650b716f55fcfa809b22708b9ad43c8a0716f9fc (diff)
downloadtangerine-wallet-browser-0a711f0de0e342b24988a5da4ca5c64342153210.tar
tangerine-wallet-browser-0a711f0de0e342b24988a5da4ca5c64342153210.tar.gz
tangerine-wallet-browser-0a711f0de0e342b24988a5da4ca5c64342153210.tar.bz2
tangerine-wallet-browser-0a711f0de0e342b24988a5da4ca5c64342153210.tar.lz
tangerine-wallet-browser-0a711f0de0e342b24988a5da4ca5c64342153210.tar.xz
tangerine-wallet-browser-0a711f0de0e342b24988a5da4ca5c64342153210.tar.zst
tangerine-wallet-browser-0a711f0de0e342b24988a5da4ca5c64342153210.zip
Removes t from props via metamask-connect and instead places it on context via a provider.
Diffstat (limited to 'ui/app/components/account-menu')
-rw-r--r--ui/app/components/account-menu/index.js22
1 files changed, 14 insertions, 8 deletions
diff --git a/ui/app/components/account-menu/index.js b/ui/app/components/account-menu/index.js
index a9120f9db..21de358d6 100644
--- a/ui/app/components/account-menu/index.js
+++ b/ui/app/components/account-menu/index.js
@@ -1,14 +1,20 @@
const inherits = require('util').inherits
const Component = require('react').Component
-const connect = require('../../metamask-connect')
+const PropTypes = require('prop-types')
+const connect = require('react-redux').connect
const h = require('react-hyperscript')
const actions = require('../../actions')
const { Menu, Item, Divider, CloseArea } = require('../dropdowns/components/menu')
const Identicon = require('../identicon')
const { formatBalance } = require('../../util')
+AccountMenu.contextTypes = {
+ t: PropTypes.func,
+}
+
module.exports = connect(mapStateToProps, mapDispatchToProps)(AccountMenu)
+
inherits(AccountMenu, Component)
function AccountMenu () { Component.call(this) }
@@ -70,10 +76,10 @@ AccountMenu.prototype.render = function () {
h(Item, {
className: 'account-menu__header',
}, [
- this.props.t('myAccounts'),
+ this.context.t('myAccounts'),
h('button.account-menu__logout-button', {
onClick: lockMetamask,
- }, this.props.t('logout')),
+ }, this.context.t('logout')),
]),
h(Divider),
h('div.account-menu__accounts', this.renderAccounts()),
@@ -81,23 +87,23 @@ AccountMenu.prototype.render = function () {
h(Item, {
onClick: () => showNewAccountPage('CREATE'),
icon: h('img.account-menu__item-icon', { src: 'images/plus-btn-white.svg' }),
- text: this.props.t('createAccount'),
+ text: this.context.t('createAccount'),
}),
h(Item, {
onClick: () => showNewAccountPage('IMPORT'),
icon: h('img.account-menu__item-icon', { src: 'images/import-account.svg' }),
- text: this.props.t('importAccount'),
+ text: this.context.t('importAccount'),
}),
h(Divider),
h(Item, {
onClick: showInfoPage,
icon: h('img', { src: 'images/mm-info-icon.svg' }),
- text: this.props.t('infoHelp'),
+ text: this.context.t('infoHelp'),
}),
h(Item, {
onClick: showConfigPage,
icon: h('img.account-menu__item-icon', { src: 'images/settings.svg' }),
- text: this.props.t('settings'),
+ text: this.context.t('settings'),
}),
])
}
@@ -155,6 +161,6 @@ AccountMenu.prototype.indicateIfLoose = function (keyring) {
try { // Sometimes keyrings aren't loaded yet:
const type = keyring.type
const isLoose = type !== 'HD Key Tree'
- return isLoose ? h('.keyring-label.allcaps', this.props.t('imported')) : null
+ return isLoose ? h('.keyring-label.allcaps', this.context.t('imported')) : null
} catch (e) { return }
}