aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/pages/create-account
diff options
context:
space:
mode:
authorAlexander Tseung <alextsg@gmail.com>2018-03-31 07:18:48 +0800
committerAlexander Tseung <alextsg@gmail.com>2018-03-31 07:18:48 +0800
commitba23843f91ca5046400cea14cea4c0d256578fec (patch)
treee29ef2a930930d4256bd7f59aa3d0274563bc4cf /ui/app/components/pages/create-account
parentbdc4a6964ae83faa8229c50870e3bcc9b9074989 (diff)
parent8e0f39353dd47c4a201aaf2ee160912846f2e68b (diff)
downloadtangerine-wallet-browser-ba23843f91ca5046400cea14cea4c0d256578fec.tar.gz
tangerine-wallet-browser-ba23843f91ca5046400cea14cea4c0d256578fec.tar.zst
tangerine-wallet-browser-ba23843f91ca5046400cea14cea4c0d256578fec.zip
Fix merge conflicts
Diffstat (limited to 'ui/app/components/pages/create-account')
-rw-r--r--ui/app/components/pages/create-account/import-account/index.js22
-rw-r--r--ui/app/components/pages/create-account/import-account/json.js22
-rw-r--r--ui/app/components/pages/create-account/import-account/private-key.js14
-rw-r--r--ui/app/components/pages/create-account/import-account/seed.js12
-rw-r--r--ui/app/components/pages/create-account/new-account.js17
5 files changed, 57 insertions, 30 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 26353b670..52d3dcde9 100644
--- a/ui/app/components/pages/create-account/import-account/index.js
+++ b/ui/app/components/pages/create-account/import-account/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)
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 2e858a8f0..946907a47 100644
--- a/ui/app/components/pages/create-account/import-account/json.js
+++ b/ui/app/components/pages/create-account/import-account/json.js
@@ -3,7 +3,7 @@ const PropTypes = require('prop-types')
const h = require('react-hyperscript')
const { withRouter } = require('react-router-dom')
const { compose } = require('recompose')
-const connect = require('../../../../metamask-connect')
+const connect = require('react-redux').connect
const actions = require('../../../../actions')
const FileInput = require('react-simple-file-input').default
const { DEFAULT_ROUTE } = require('../../../../routes')
@@ -25,11 +25,11 @@ class JsonImportSubview extends Component {
return (
h('div.new-account-import-form__json', [
- h('p', this.props.t('usedByClients')),
+ h('p', this.context.t('usedByClients')),
h('a.warning', {
href: HELP_LINK,
target: '_blank',
- }, this.props.t('fileImportFail')),
+ }, this.context.t('fileImportFail')),
h(FileInput, {
readAs: 'text',
@@ -44,7 +44,7 @@ class JsonImportSubview extends Component {
h('input.new-account-import-form__input-password', {
type: 'password',
- placeholder: this.props.t('enterPassword'),
+ placeholder: this.context.t('enterPassword'),
id: 'json-password-box',
onKeyPress: this.createKeyringOnEnter.bind(this),
}),
@@ -54,13 +54,13 @@ class JsonImportSubview extends Component {
h('button.btn-secondary.new-account-create-form__button', {
onClick: () => this.props.history.push(DEFAULT_ROUTE),
}, [
- this.props.t('cancel'),
+ this.context.t('cancel'),
]),
h('button.btn-primary.new-account-create-form__button', {
onClick: () => this.createNewKeychain(),
}, [
- this.props.t('import'),
+ this.context.t('import'),
]),
]),
@@ -85,14 +85,14 @@ class JsonImportSubview extends Component {
const state = this.state
if (!state) {
- const message = this.props.t('validFileImport')
+ const message = this.context.t('validFileImport')
return this.props.displayWarning(message)
}
const { fileContents } = state
if (!fileContents) {
- const message = this.props.t('needImportFile')
+ const message = this.context.t('needImportFile')
return this.props.displayWarning(message)
}
@@ -100,7 +100,7 @@ class JsonImportSubview extends Component {
const password = passwordInput.value
if (!password) {
- const message = this.props.t('needImportPassword')
+ const message = this.context.t('needImportPassword')
return this.props.displayWarning(message)
}
@@ -131,6 +131,10 @@ const mapDispatchToProps = dispatch => {
}
}
+JsonImportSubview.contextTypes = {
+ t: PropTypes.func,
+}
+
module.exports = compose(
withRouter,
connect(mapStateToProps, mapDispatchToProps)
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 17a32c10f..0f6789282 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,15 +3,21 @@ const Component = require('react').Component
const h = require('react-hyperscript')
const { withRouter } = require('react-router-dom')
const { compose } = require('recompose')
-const connect = require('../../../../metamask-connect')
+const PropTypes = require('prop-types')
+const connect = require('react-redux').connect
const actions = require('../../../../actions')
const { DEFAULT_ROUTE } = require('../../../../routes')
+PrivateKeyImportView.contextTypes = {
+ t: PropTypes.func,
+}
+
module.exports = compose(
withRouter,
connect(mapStateToProps, mapDispatchToProps)
)(PrivateKeyImportView)
+
function mapStateToProps (state) {
return {
error: state.appState.warning,
@@ -38,7 +44,7 @@ PrivateKeyImportView.prototype.render = function () {
return (
h('div.new-account-import-form__private-key', [
- h('span.new-account-create-form__instruction', this.props.t('pastePrivateKey')),
+ h('span.new-account-create-form__instruction', this.context.t('pastePrivateKey')),
h('div.new-account-import-form__private-key-password-container', [
@@ -55,13 +61,13 @@ PrivateKeyImportView.prototype.render = function () {
h('button.btn-secondary--lg.new-account-create-form__button', {
onClick: () => this.props.history.push(DEFAULT_ROUTE),
}, [
- this.props.t('cancel'),
+ this.context.t('cancel'),
]),
h('button.btn-primary--lg.new-account-create-form__button', {
onClick: () => this.createNewKeychain(),
}, [
- this.props.t('import'),
+ this.context.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 15dd98c73..d98909baa 100644
--- a/ui/app/components/pages/create-account/import-account/seed.js
+++ b/ui/app/components/pages/create-account/import-account/seed.js
@@ -1,10 +1,16 @@
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
+
+SeedImportSubview.contextTypes = {
+ t: PropTypes.func,
+}
module.exports = connect(mapStateToProps)(SeedImportSubview)
+
function mapStateToProps (state) {
return {}
}
@@ -20,10 +26,10 @@ SeedImportSubview.prototype.render = function () {
style: {
},
}, [
- this.props.t('pasteSeed'),
+ this.context.t('pasteSeed'),
h('textarea'),
h('br'),
- h('button', this.props.t('submit')),
+ h('button', this.context.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 dfe2a2ab1..40fa584be 100644
--- a/ui/app/components/pages/create-account/new-account.js
+++ b/ui/app/components/pages/create-account/new-account.js
@@ -1,12 +1,12 @@
const { Component } = require('react')
const PropTypes = require('prop-types')
const h = require('react-hyperscript')
-const connect = require('../../../metamask-connect')
+const connect = require('react-redux').connect
const actions = require('../../../actions')
const { DEFAULT_ROUTE } = require('../../../routes')
class NewAccountCreateForm extends Component {
- constructor (props) {
+ constructor (props, context) {
super(props)
const { numberOfExistingAccounts = 0 } = props
@@ -14,7 +14,7 @@ class NewAccountCreateForm extends Component {
this.state = {
newAccountName: '',
- defaultAccountName: this.props.t('newAccountNumberName', [newAccountNumber]),
+ defaultAccountName: context.t('newAccountNumberName', [newAccountNumber]),
}
}
@@ -25,7 +25,7 @@ class NewAccountCreateForm extends Component {
return h('div.new-account-create-form', [
h('div.new-account-create-form__input-label', {}, [
- this.props.t('accountName'),
+ this.context.t('accountName'),
]),
h('div.new-account-create-form__input-wrapper', {}, [
@@ -41,7 +41,7 @@ class NewAccountCreateForm extends Component {
h('button.btn-secondary--lg.new-account-create-form__button', {
onClick: () => history.push(DEFAULT_ROUTE),
}, [
- this.props.t('cancel'),
+ this.context.t('cancel'),
]),
h('button.btn-primary--lg.new-account-create-form__button', {
@@ -50,7 +50,7 @@ class NewAccountCreateForm extends Component {
.then(() => history.push(DEFAULT_ROUTE))
},
}, [
- this.props.t('create'),
+ this.context.t('create'),
]),
]),
@@ -95,4 +95,9 @@ const mapDispatchToProps = dispatch => {
}
}
+NewAccountCreateForm.contextTypes = {
+ t: PropTypes.func,
+}
+
module.exports = connect(mapStateToProps, mapDispatchToProps)(NewAccountCreateForm)
+