aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/settings.js
diff options
context:
space:
mode:
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 8764dcafe..e91ac7340 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),
@@ -136,31 +136,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
}
@@ -181,12 +181,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') {
@@ -199,7 +199,7 @@ class Settings extends Component {
event.preventDefault()
this.validateRpc(this.state.newRpc)
},
- }, this.props.t('save')),
+ }, this.context.t('save')),
]),
]),
])
@@ -215,9 +215,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'))
}
}
}
@@ -226,10 +226,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', [
@@ -238,13 +238,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')),
]),
]),
])
@@ -256,7 +256,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', {
@@ -264,7 +264,7 @@ class Settings extends Component {
event.preventDefault()
revealSeedConfirmation()
},
- }, this.props.t('revealSeedWords')),
+ }, this.context.t('revealSeedWords')),
]),
]),
])
@@ -276,7 +276,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', {
@@ -284,7 +284,7 @@ class Settings extends Component {
event.preventDefault()
setFeatureFlagToBeta()
},
- }, this.props.t('useOldUI')),
+ }, this.context.t('useOldUI')),
]),
]),
])
@@ -295,7 +295,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', {
@@ -303,7 +303,7 @@ class Settings extends Component {
event.preventDefault()
showResetAccountConfirmationModal()
},
- }, this.props.t('resetAccount')),
+ }, this.context.t('resetAccount')),
]),
]),
])
@@ -339,13 +339,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', [
@@ -353,7 +353,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', [
@@ -361,7 +361,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'),
@@ -370,7 +370,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', [
@@ -378,7 +378,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', [
@@ -386,7 +386,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')),
]),
]),
])
@@ -408,7 +408,7 @@ class Settings extends Component {
h('div.settings__info-item', [
h(
'div.settings__info-about',
- this.props.t('builtInCalifornia')
+ this.context.t('builtInCalifornia')
),
]),
]),
@@ -485,4 +485,9 @@ const mapDispatchToProps = dispatch => {
}
}
+Settings.contextTypes = {
+ t: PropTypes.func,
+}
+
module.exports = connect(mapStateToProps, mapDispatchToProps)(Settings)
+