diff options
author | Alexander Tseung <alextsg@gmail.com> | 2018-03-31 07:18:48 +0800 |
---|---|---|
committer | Alexander Tseung <alextsg@gmail.com> | 2018-03-31 07:18:48 +0800 |
commit | ba23843f91ca5046400cea14cea4c0d256578fec (patch) | |
tree | e29ef2a930930d4256bd7f59aa3d0274563bc4cf /ui/app/components/pages/settings | |
parent | bdc4a6964ae83faa8229c50870e3bcc9b9074989 (diff) | |
parent | 8e0f39353dd47c4a201aaf2ee160912846f2e68b (diff) | |
download | tangerine-wallet-browser-ba23843f91ca5046400cea14cea4c0d256578fec.tar tangerine-wallet-browser-ba23843f91ca5046400cea14cea4c0d256578fec.tar.gz tangerine-wallet-browser-ba23843f91ca5046400cea14cea4c0d256578fec.tar.bz2 tangerine-wallet-browser-ba23843f91ca5046400cea14cea4c0d256578fec.tar.lz tangerine-wallet-browser-ba23843f91ca5046400cea14cea4c0d256578fec.tar.xz tangerine-wallet-browser-ba23843f91ca5046400cea14cea4c0d256578fec.tar.zst tangerine-wallet-browser-ba23843f91ca5046400cea14cea4c0d256578fec.zip |
Fix merge conflicts
Diffstat (limited to 'ui/app/components/pages/settings')
-rw-r--r-- | ui/app/components/pages/settings/info.js | 23 | ||||
-rw-r--r-- | ui/app/components/pages/settings/settings.js | 63 |
2 files changed, 47 insertions, 39 deletions
diff --git a/ui/app/components/pages/settings/info.js b/ui/app/components/pages/settings/info.js index adb2fdfcd..eb9be66e6 100644 --- a/ui/app/components/pages/settings/info.js +++ b/ui/app/components/pages/settings/info.js @@ -1,7 +1,6 @@ const { Component } = require('react') const PropTypes = require('prop-types') const h = require('react-hyperscript') -const connect = require('../../../metamask-connect') class Info extends Component { renderLogo () { @@ -15,13 +14,13 @@ class Info extends Component { renderInfoLinks () { return ( h('div.settings__content-item.settings__content-item--without-height', [ - h('div.settings__info-link-header', this.props.t('links')), + h('div.settings__info-link-header', this.context.t('links')), h('div.settings__info-link-item', [ h('a', { href: 'https://metamask.io/privacy.html', target: '_blank', }, [ - h('span.settings__info-link', this.props.t('privacyMsg')), + h('span.settings__info-link', this.context.t('privacyMsg')), ]), ]), h('div.settings__info-link-item', [ @@ -29,7 +28,7 @@ class Info extends Component { href: 'https://metamask.io/terms.html', target: '_blank', }, [ - h('span.settings__info-link', this.props.t('terms')), + h('span.settings__info-link', this.context.t('terms')), ]), ]), h('div.settings__info-link-item', [ @@ -37,7 +36,7 @@ class Info extends Component { href: 'https://metamask.io/attributions.html', target: '_blank', }, [ - h('span.settings__info-link', this.props.t('attributions')), + h('span.settings__info-link', this.context.t('attributions')), ]), ]), h('hr.settings__info-separator'), @@ -46,7 +45,7 @@ class Info extends Component { href: 'https://support.metamask.io', target: '_blank', }, [ - h('span.settings__info-link', this.props.t('supportCenter')), + h('span.settings__info-link', this.context.t('supportCenter')), ]), ]), h('div.settings__info-link-item', [ @@ -54,7 +53,7 @@ class Info extends Component { href: 'https://metamask.io/', target: '_blank', }, [ - h('span.settings__info-link', this.props.t('visitWebSite')), + h('span.settings__info-link', this.context.t('visitWebSite')), ]), ]), h('div.settings__info-link-item', [ @@ -62,7 +61,7 @@ class Info extends Component { target: '_blank', href: 'mailto:help@metamask.io?subject=Feedback', }, [ - h('span.settings__info-link', this.props.t('emailUs')), + h('span.settings__info-link', this.context.t('emailUs')), ]), ]), ]) @@ -82,7 +81,7 @@ class Info extends Component { h('div.settings__info-item', [ h( 'div.settings__info-about', - this.props.t('builtInCalifornia') + this.context.t('builtInCalifornia') ), ]), ]), @@ -106,4 +105,8 @@ Info.propTypes = { t: PropTypes.func, } -module.exports = connect()(Info) +Info.contextTypes = { + t: PropTypes.func, +} + +module.exports = Info diff --git a/ui/app/components/pages/settings/settings.js b/ui/app/components/pages/settings/settings.js index 7b3704c4d..05a7379fb 100644 --- a/ui/app/components/pages/settings/settings.js +++ b/ui/app/components/pages/settings/settings.js @@ -3,7 +3,7 @@ const { withRouter } = require('react-router-dom') const { compose } = require('recompose') 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 infuraCurrencies = require('../../../infura-conversion.json') const validUrl = require('valid-url') @@ -52,7 +52,7 @@ class Settings extends Component { return h('div.settings__content-row', [ h('div.settings__content-item', [ - h('span', this.props.t('blockiesIdenticon')), + h('span', this.context.t('blockiesIdenticon')), ]), h('div.settings__content-item', [ h('div.settings__content-item-col', [ @@ -72,13 +72,13 @@ class Settings extends Component { return h('div.settings__content-row', [ h('div.settings__content-item', [ - h('span', this.props.t('currentConversion')), + h('span', this.context.t('currentConversion')), h('span.settings__content-description', `Updated ${Date(conversionDate)}`), ]), h('div.settings__content-item', [ h('div.settings__content-item-col', [ h(SimpleDropdown, { - placeholder: this.props.t('selectCurrency'), + placeholder: this.context.t('selectCurrency'), options: getInfuraCurrencyOptions(), selectedOption: currentCurrency, onSelect: newCurrency => setCurrentCurrency(newCurrency), @@ -91,11 +91,12 @@ class Settings extends Component { renderCurrentLocale () { const { updateCurrentLocale, currentLocale } = this.props const currentLocaleMeta = locales.find(locale => locale.code === currentLocale) + const currentLocaleName = currentLocaleMeta ? currentLocaleMeta.name : '' return h('div.settings__content-row', [ h('div.settings__content-item', [ h('span', 'Current Language'), - h('span.settings__content-description', `${currentLocaleMeta.name}`), + h('span.settings__content-description', `${currentLocaleName}`), ]), h('div.settings__content-item', [ h('div.settings__content-item-col', [ @@ -119,31 +120,31 @@ class Settings extends Component { switch (provider.type) { case 'mainnet': - title = this.props.t('currentNetwork') - value = this.props.t('mainnet') + title = this.context.t('currentNetwork') + value = this.context.t('mainnet') color = '#038789' break case 'ropsten': - title = this.props.t('currentNetwork') - value = this.props.t('ropsten') + title = this.context.t('currentNetwork') + value = this.context.t('ropsten') color = '#e91550' break case 'kovan': - title = this.props.t('currentNetwork') - value = this.props.t('kovan') + title = this.context.t('currentNetwork') + value = this.context.t('kovan') color = '#690496' break case 'rinkeby': - title = this.props.t('currentNetwork') - value = this.props.t('rinkeby') + title = this.context.t('currentNetwork') + value = this.context.t('rinkeby') color = '#ebb33f' break default: - title = this.props.t('currentRpc') + title = this.context.t('currentRpc') value = provider.rpcTarget } @@ -164,12 +165,12 @@ class Settings extends Component { return ( h('div.settings__content-row', [ h('div.settings__content-item', [ - h('span', this.props.t('newRPC')), + h('span', this.context.t('newRPC')), ]), h('div.settings__content-item', [ h('div.settings__content-item-col', [ h('input.settings__input', { - placeholder: this.props.t('newRPC'), + placeholder: this.context.t('newRPC'), onChange: event => this.setState({ newRpc: event.target.value }), onKeyPress: event => { if (event.key === 'Enter') { @@ -182,7 +183,7 @@ class Settings extends Component { event.preventDefault() this.validateRpc(this.state.newRpc) }, - }, this.props.t('save')), + }, this.context.t('save')), ]), ]), ]) @@ -198,9 +199,9 @@ class Settings extends Component { const appendedRpc = `http://${newRpc}` if (validUrl.isWebUri(appendedRpc)) { - displayWarning(this.props.t('uriErrorMsg')) + displayWarning(this.context.t('uriErrorMsg')) } else { - displayWarning(this.props.t('invalidRPC')) + displayWarning(this.context.t('invalidRPC')) } } } @@ -209,10 +210,10 @@ class Settings extends Component { return ( h('div.settings__content-row', [ h('div.settings__content-item', [ - h('div', this.props.t('stateLogs')), + h('div', this.context.t('stateLogs')), h( 'div.settings__content-description', - this.props.t('stateLogsDescription') + this.context.t('stateLogsDescription') ), ]), h('div.settings__content-item', [ @@ -221,13 +222,13 @@ class Settings extends Component { onClick (event) { window.logStateString((err, result) => { if (err) { - this.state.dispatch(actions.displayWarning(this.props.t('stateLogError'))) + this.state.dispatch(actions.displayWarning(this.context.t('stateLogError'))) } else { exportAsFile('MetaMask State Logs.json', result) } }) }, - }, this.props.t('downloadStateLogs')), + }, this.context.t('downloadStateLogs')), ]), ]), ]) @@ -239,7 +240,7 @@ class Settings extends Component { return ( h('div.settings__content-row', [ - h('div.settings__content-item', this.props.t('revealSeedWords')), + h('div.settings__content-item', this.context.t('revealSeedWords')), h('div.settings__content-item', [ h('div.settings__content-item-col', [ h('button.btn-primary--lg.settings__button--red', { @@ -247,7 +248,7 @@ class Settings extends Component { event.preventDefault() history.push(REVEAL_SEED_ROUTE) }, - }, this.props.t('revealSeedWords')), + }, this.context.t('revealSeedWords')), ]), ]), ]) @@ -259,7 +260,7 @@ class Settings extends Component { return ( h('div.settings__content-row', [ - h('div.settings__content-item', this.props.t('useOldUI')), + h('div.settings__content-item', this.context.t('useOldUI')), h('div.settings__content-item', [ h('div.settings__content-item-col', [ h('button.btn-primary--lg.settings__button--orange', { @@ -267,7 +268,7 @@ class Settings extends Component { event.preventDefault() setFeatureFlagToBeta() }, - }, this.props.t('useOldUI')), + }, this.context.t('useOldUI')), ]), ]), ]) @@ -278,7 +279,7 @@ class Settings extends Component { const { showResetAccountConfirmationModal } = this.props return h('div.settings__content-row', [ - h('div.settings__content-item', this.props.t('resetAccount')), + h('div.settings__content-item', this.context.t('resetAccount')), h('div.settings__content-item', [ h('div.settings__content-item-col', [ h('button.btn-primary--lg.settings__button--orange', { @@ -286,7 +287,7 @@ class Settings extends Component { event.preventDefault() showResetAccountConfirmationModal() }, - }, this.props.t('resetAccount')), + }, this.context.t('resetAccount')), ]), ]), ]) @@ -356,6 +357,10 @@ const mapDispatchToProps = dispatch => { } } +Settings.contextTypes = { + t: PropTypes.func, +} + module.exports = compose( withRouter, connect(mapStateToProps, mapDispatchToProps) |