aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/settings.js
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-03-30 07:54:00 +0800
committerkumavis <aaron@kumavis.me>2018-03-30 07:54:00 +0800
commitb49ad750dd87232553a72663af94bb2840c2f2ad (patch)
tree71e4002e6bc28c42ea227299752814d6f1f10486 /ui/app/settings.js
parent93c123c6f52b28b525658492ce93fbcc30fc1e7c (diff)
parent9d4be1842e7c56e3bfde529ff555dcae8dec3dbd (diff)
downloadtangerine-wallet-browser-b49ad750dd87232553a72663af94bb2840c2f2ad.tar.gz
tangerine-wallet-browser-b49ad750dd87232553a72663af94bb2840c2f2ad.tar.zst
tangerine-wallet-browser-b49ad750dd87232553a72663af94bb2840c2f2ad.zip
Merge branch 'master' of github.com:MetaMask/metamask-extension into ci-artifacts
Diffstat (limited to 'ui/app/settings.js')
-rw-r--r--ui/app/settings.js81
1 files changed, 43 insertions, 38 deletions
diff --git a/ui/app/settings.js b/ui/app/settings.js
index ec24172e8..3aa7b9c6b 100644
--- a/ui/app/settings.js
+++ b/ui/app/settings.js
@@ -1,7 +1,7 @@
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 infuraCurrencies = require('./infura-conversion.json')
const validUrl = require('valid-url')
@@ -55,8 +55,8 @@ class Settings extends Component {
return h('div.settings__tabs', [
h(TabBar, {
tabs: [
- { content: this.props.t('settings'), key: 'settings' },
- { content: this.props.t('info'), key: 'info' },
+ { content: this.context.t('settings'), key: 'settings' },
+ { content: this.context.t('info'), key: 'info' },
],
defaultTab: activeTab,
tabSelected: key => this.setState({ activeTab: key }),
@@ -69,7 +69,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', [
@@ -89,13 +89,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),
@@ -137,31 +137,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
}
@@ -182,12 +182,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') {
@@ -200,7 +200,7 @@ class Settings extends Component {
event.preventDefault()
this.validateRpc(this.state.newRpc)
},
- }, this.props.t('save')),
+ }, this.context.t('save')),
]),
]),
])
@@ -216,9 +216,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'))
}
}
}
@@ -227,10 +227,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', [
@@ -239,13 +239,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')),
]),
]),
])
@@ -257,7 +257,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', {
@@ -265,7 +265,7 @@ class Settings extends Component {
event.preventDefault()
revealSeedConfirmation()
},
- }, this.props.t('revealSeedWords')),
+ }, this.context.t('revealSeedWords')),
]),
]),
])
@@ -277,7 +277,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', {
@@ -285,7 +285,7 @@ class Settings extends Component {
event.preventDefault()
setFeatureFlagToBeta()
},
- }, this.props.t('useOldUI')),
+ }, this.context.t('useOldUI')),
]),
]),
])
@@ -296,7 +296,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', {
@@ -304,7 +304,7 @@ class Settings extends Component {
event.preventDefault()
showResetAccountConfirmationModal()
},
- }, this.props.t('resetAccount')),
+ }, this.context.t('resetAccount')),
]),
]),
])
@@ -340,13 +340,13 @@ class Settings 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', [
@@ -354,7 +354,7 @@ class Settings 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', [
@@ -362,7 +362,7 @@ class Settings 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'),
@@ -371,7 +371,7 @@ class Settings 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', [
@@ -379,7 +379,7 @@ class Settings 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', [
@@ -387,7 +387,7 @@ class Settings 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')),
]),
]),
])
@@ -409,7 +409,7 @@ class Settings extends Component {
h('div.settings__info-item', [
h(
'div.settings__info-about',
- this.props.t('builtInCalifornia')
+ this.context.t('builtInCalifornia')
),
]),
]),
@@ -486,4 +486,9 @@ const mapDispatchToProps = dispatch => {
}
}
+Settings.contextTypes = {
+ t: PropTypes.func,
+}
+
module.exports = connect(mapStateToProps, mapDispatchToProps)(Settings)
+