From 0a711f0de0e342b24988a5da4ca5c64342153210 Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 29 Mar 2018 12:30:44 -0230 Subject: Removes t from props via metamask-connect and instead places it on context via a provider. --- ui/app/accounts/import/index.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'ui/app/accounts/import/index.js') diff --git a/ui/app/accounts/import/index.js b/ui/app/accounts/import/index.js index b09b50ef7..52d3dcde9 100644 --- a/ui/app/accounts/import/index.js +++ b/ui/app/accounts/import/index.js @@ -1,7 +1,8 @@ const inherits = require('util').inherits const Component = require('react').Component const h = require('react-hyperscript') -const connect = require('../../metamask-connect') +const PropTypes = require('prop-types') +const connect = require('react-redux').connect import Select from 'react-select' // Subviews @@ -9,8 +10,13 @@ const JsonImportView = require('./json.js') const PrivateKeyImportView = require('./private-key.js') +AccountImportSubview.contextTypes = { + t: PropTypes.func, +} + module.exports = connect()(AccountImportSubview) + inherits(AccountImportSubview, Component) function AccountImportSubview () { Component.call(this) @@ -18,8 +24,8 @@ function AccountImportSubview () { AccountImportSubview.prototype.getMenuItemTexts = function () { return [ - this.props.t('privateKey'), - this.props.t('jsonFile'), + this.context.t('privateKey'), + this.context.t('jsonFile'), ] } @@ -32,7 +38,7 @@ AccountImportSubview.prototype.render = function () { h('div.new-account-import-form', [ h('.new-account-import-disclaimer', [ - h('span', this.props.t('importAccountMsg')), + h('span', this.context.t('importAccountMsg')), h('span', { style: { cursor: 'pointer', @@ -43,12 +49,12 @@ AccountImportSubview.prototype.render = function () { url: 'https://metamask.helpscoutdocs.com/article/17-what-are-loose-accounts', }) }, - }, this.props.t('here')), + }, this.context.t('here')), ]), h('div.new-account-import-form__select-section', [ - h('div.new-account-import-form__select-label', this.props.t('selectType')), + h('div.new-account-import-form__select-label', this.context.t('selectType')), h(Select, { className: 'new-account-import-form__select', @@ -80,9 +86,9 @@ AccountImportSubview.prototype.renderImportView = function () { const current = type || menuItems[0] switch (current) { - case this.props.t('privateKey'): + case this.context.t('privateKey'): return h(PrivateKeyImportView) - case this.props.t('jsonFile'): + case this.context.t('jsonFile'): return h(JsonImportView) default: return h(JsonImportView) -- cgit