diff options
author | Alexander Tseung <alextsg@gmail.com> | 2018-03-30 00:37:29 +0800 |
---|---|---|
committer | Alexander Tseung <alextsg@gmail.com> | 2018-03-30 00:37:29 +0800 |
commit | ef61ef2ce885635862bb242612dd821cb3a65b6b (patch) | |
tree | 0f128f8b56b57a1bbe96dcf5743d34b5f95dc4cc /ui/app/components/pages/create-account | |
parent | 58f52b2b8de9efd43896e23ab0ac9972f45bb278 (diff) | |
parent | 8766420f19251b95211dd99ff9a45e60cf0177ad (diff) | |
download | tangerine-wallet-browser-ef61ef2ce885635862bb242612dd821cb3a65b6b.tar tangerine-wallet-browser-ef61ef2ce885635862bb242612dd821cb3a65b6b.tar.gz tangerine-wallet-browser-ef61ef2ce885635862bb242612dd821cb3a65b6b.tar.bz2 tangerine-wallet-browser-ef61ef2ce885635862bb242612dd821cb3a65b6b.tar.lz tangerine-wallet-browser-ef61ef2ce885635862bb242612dd821cb3a65b6b.tar.xz tangerine-wallet-browser-ef61ef2ce885635862bb242612dd821cb3a65b6b.tar.zst tangerine-wallet-browser-ef61ef2ce885635862bb242612dd821cb3a65b6b.zip |
Fix i18n merge conflicts
Diffstat (limited to 'ui/app/components/pages/create-account')
5 files changed, 39 insertions, 47 deletions
diff --git a/ui/app/components/pages/create-account/import-account/index.js b/ui/app/components/pages/create-account/import-account/index.js index 8031ea36d..26353b670 100644 --- a/ui/app/components/pages/create-account/import-account/index.js +++ b/ui/app/components/pages/create-account/import-account/index.js @@ -1,43 +1,38 @@ const inherits = require('util').inherits const Component = require('react').Component const h = require('react-hyperscript') -const connect = require('react-redux').connect -const t = require('../../../../../i18n') +const connect = require('../../../../metamask-connect') import Select from 'react-select' // Subviews const JsonImportView = require('./json.js') const PrivateKeyImportView = require('./private-key.js') -const menuItems = [ - t('privateKey'), - t('jsonFile'), -] -module.exports = connect(mapStateToProps)(AccountImportSubview) - -function mapStateToProps (state) { - return { - menuItems, - } -} +module.exports = connect()(AccountImportSubview) inherits(AccountImportSubview, Component) function AccountImportSubview () { Component.call(this) } +AccountImportSubview.prototype.getMenuItemTexts = function () { + return [ + this.props.t('privateKey'), + this.props.t('jsonFile'), + ] +} + AccountImportSubview.prototype.render = function () { - const props = this.props const state = this.state || {} - const { menuItems } = props + const menuItems = this.getMenuItemTexts() const { type } = state return ( h('div.new-account-import-form', [ h('.new-account-import-disclaimer', [ - h('span', t('importAccountMsg')), + h('span', this.props.t('importAccountMsg')), h('span', { style: { cursor: 'pointer', @@ -48,12 +43,12 @@ AccountImportSubview.prototype.render = function () { url: 'https://metamask.helpscoutdocs.com/article/17-what-are-loose-accounts', }) }, - }, t('here')), + }, this.props.t('here')), ]), h('div.new-account-import-form__select-section', [ - h('div.new-account-import-form__select-label', t('selectType')), + h('div.new-account-import-form__select-label', this.props.t('selectType')), h(Select, { className: 'new-account-import-form__select', @@ -79,16 +74,15 @@ AccountImportSubview.prototype.render = function () { } AccountImportSubview.prototype.renderImportView = function () { - const props = this.props const state = this.state || {} const { type } = state - const { menuItems } = props + const menuItems = this.getMenuItemTexts() const current = type || menuItems[0] switch (current) { - case t('privateKey'): + case this.props.t('privateKey'): return h(PrivateKeyImportView) - case t('jsonFile'): + case this.props.t('jsonFile'): return h(JsonImportView) default: return h(JsonImportView) diff --git a/ui/app/components/pages/create-account/import-account/json.js b/ui/app/components/pages/create-account/import-account/json.js index 554a67df4..2e858a8f0 100644 --- a/ui/app/components/pages/create-account/import-account/json.js +++ b/ui/app/components/pages/create-account/import-account/json.js @@ -3,10 +3,9 @@ const PropTypes = require('prop-types') const h = require('react-hyperscript') const { withRouter } = require('react-router-dom') const { compose } = require('recompose') -const { connect } = require('react-redux') +const connect = require('../../../../metamask-connect') const actions = require('../../../../actions') const FileInput = require('react-simple-file-input').default -const t = require('../../../../../i18n') const { DEFAULT_ROUTE } = require('../../../../routes') const HELP_LINK = 'https://support.metamask.io/kb/article/7-importing-accounts' @@ -26,11 +25,11 @@ class JsonImportSubview extends Component { return ( h('div.new-account-import-form__json', [ - h('p', t('usedByClients')), + h('p', this.props.t('usedByClients')), h('a.warning', { href: HELP_LINK, target: '_blank', - }, t('fileImportFail')), + }, this.props.t('fileImportFail')), h(FileInput, { readAs: 'text', @@ -45,7 +44,7 @@ class JsonImportSubview extends Component { h('input.new-account-import-form__input-password', { type: 'password', - placeholder: t('enterPassword'), + placeholder: this.props.t('enterPassword'), id: 'json-password-box', onKeyPress: this.createKeyringOnEnter.bind(this), }), @@ -55,13 +54,13 @@ class JsonImportSubview extends Component { h('button.btn-secondary.new-account-create-form__button', { onClick: () => this.props.history.push(DEFAULT_ROUTE), }, [ - t('cancel'), + this.props.t('cancel'), ]), h('button.btn-primary.new-account-create-form__button', { onClick: () => this.createNewKeychain(), }, [ - t('import'), + this.props.t('import'), ]), ]), @@ -86,14 +85,14 @@ class JsonImportSubview extends Component { const state = this.state if (!state) { - const message = t('validFileImport') + const message = this.props.t('validFileImport') return this.props.displayWarning(message) } const { fileContents } = state if (!fileContents) { - const message = t('needImportFile') + const message = this.props.t('needImportFile') return this.props.displayWarning(message) } @@ -101,7 +100,7 @@ class JsonImportSubview extends Component { const password = passwordInput.value if (!password) { - const message = t('needImportPassword') + const message = this.props.t('needImportPassword') return this.props.displayWarning(message) } @@ -115,6 +114,7 @@ JsonImportSubview.propTypes = { displayWarning: PropTypes.func, importNewJsonAccount: PropTypes.func, history: PropTypes.object, + t: PropTypes.func, } const mapStateToProps = state => { diff --git a/ui/app/components/pages/create-account/import-account/private-key.js b/ui/app/components/pages/create-account/import-account/private-key.js index a30492e3b..17a32c10f 100644 --- a/ui/app/components/pages/create-account/import-account/private-key.js +++ b/ui/app/components/pages/create-account/import-account/private-key.js @@ -3,10 +3,9 @@ const Component = require('react').Component const h = require('react-hyperscript') const { withRouter } = require('react-router-dom') const { compose } = require('recompose') -const { connect } = require('react-redux') +const connect = require('../../../../metamask-connect') const actions = require('../../../../actions') const { DEFAULT_ROUTE } = require('../../../../routes') -const t = require('../../../../../i18n') module.exports = compose( withRouter, @@ -39,7 +38,7 @@ PrivateKeyImportView.prototype.render = function () { return ( h('div.new-account-import-form__private-key', [ - h('span.new-account-create-form__instruction', t('pastePrivateKey')), + h('span.new-account-create-form__instruction', this.props.t('pastePrivateKey')), h('div.new-account-import-form__private-key-password-container', [ @@ -56,13 +55,13 @@ PrivateKeyImportView.prototype.render = function () { h('button.btn-secondary--lg.new-account-create-form__button', { onClick: () => this.props.history.push(DEFAULT_ROUTE), }, [ - t('cancel'), + this.props.t('cancel'), ]), h('button.btn-primary--lg.new-account-create-form__button', { onClick: () => this.createNewKeychain(), }, [ - t('import'), + this.props.t('import'), ]), ]), diff --git a/ui/app/components/pages/create-account/import-account/seed.js b/ui/app/components/pages/create-account/import-account/seed.js index 85fa93faa..15dd98c73 100644 --- a/ui/app/components/pages/create-account/import-account/seed.js +++ b/ui/app/components/pages/create-account/import-account/seed.js @@ -1,8 +1,7 @@ const inherits = require('util').inherits const Component = require('react').Component const h = require('react-hyperscript') -const connect = require('react-redux').connect -const t = require('../../../../../i18n') +const connect = require('../../../../metamask-connect') module.exports = connect(mapStateToProps)(SeedImportSubview) @@ -21,10 +20,10 @@ SeedImportSubview.prototype.render = function () { style: { }, }, [ - t('pasteSeed'), + this.props.t('pasteSeed'), h('textarea'), h('br'), - h('button', t('submit')), + h('button', this.props.t('submit')), ]) ) } diff --git a/ui/app/components/pages/create-account/new-account.js b/ui/app/components/pages/create-account/new-account.js index ceeb8a05b..dfe2a2ab1 100644 --- a/ui/app/components/pages/create-account/new-account.js +++ b/ui/app/components/pages/create-account/new-account.js @@ -1,10 +1,9 @@ const { Component } = require('react') const PropTypes = require('prop-types') const h = require('react-hyperscript') -const { connect } = require('react-redux') +const connect = require('../../../metamask-connect') const actions = require('../../../actions') const { DEFAULT_ROUTE } = require('../../../routes') -const t = require('../../../../i18n') class NewAccountCreateForm extends Component { constructor (props) { @@ -15,7 +14,7 @@ class NewAccountCreateForm extends Component { this.state = { newAccountName: '', - defaultAccountName: t('newAccountNumberName', [newAccountNumber]), + defaultAccountName: this.props.t('newAccountNumberName', [newAccountNumber]), } } @@ -26,7 +25,7 @@ class NewAccountCreateForm extends Component { return h('div.new-account-create-form', [ h('div.new-account-create-form__input-label', {}, [ - t('accountName'), + this.props.t('accountName'), ]), h('div.new-account-create-form__input-wrapper', {}, [ @@ -42,7 +41,7 @@ class NewAccountCreateForm extends Component { h('button.btn-secondary--lg.new-account-create-form__button', { onClick: () => history.push(DEFAULT_ROUTE), }, [ - t('cancel'), + this.props.t('cancel'), ]), h('button.btn-primary--lg.new-account-create-form__button', { @@ -51,7 +50,7 @@ class NewAccountCreateForm extends Component { .then(() => history.push(DEFAULT_ROUTE)) }, }, [ - t('create'), + this.props.t('create'), ]), ]), @@ -66,6 +65,7 @@ NewAccountCreateForm.propTypes = { createAccount: PropTypes.func, numberOfExistingAccounts: PropTypes.number, history: PropTypes.object, + t: PropTypes.func, } const mapStateToProps = state => { |