Removes t from props via metamask-connect and instead places it on context via a provider.

feature/default_network_editable
Dan 7 years ago
parent 650b716f55
commit 0a711f0de0
  1. 22
      ui/app/accounts/import/index.js
  2. 23
      ui/app/accounts/import/json.js
  3. 14
      ui/app/accounts/import/private-key.js
  4. 12
      ui/app/accounts/import/seed.js
  5. 17
      ui/app/accounts/new-account/create-form.js
  6. 14
      ui/app/accounts/new-account/index.js
  7. 56
      ui/app/add-token.js
  8. 32
      ui/app/app.js
  9. 20
      ui/app/components/account-dropdowns.js
  10. 22
      ui/app/components/account-export.js
  11. 22
      ui/app/components/account-menu/index.js
  12. 2
      ui/app/components/balance-component.js
  13. 16
      ui/app/components/bn-as-decimal-input.js
  14. 22
      ui/app/components/buy-button-subview.js
  15. 12
      ui/app/components/coinbase-form.js
  16. 10
      ui/app/components/copyButton.js
  17. 10
      ui/app/components/copyable.js
  18. 28
      ui/app/components/customize-gas-modal/index.js
  19. 25
      ui/app/components/dropdowns/components/account-dropdowns.js
  20. 34
      ui/app/components/dropdowns/network-dropdown.js
  21. 10
      ui/app/components/dropdowns/token-menu-dropdown.js
  22. 12
      ui/app/components/ens-input.js
  23. 16
      ui/app/components/hex-as-decimal-input.js
  24. 2
      ui/app/components/identicon.js
  25. 12
      ui/app/components/modals/account-details-modal.js
  26. 10
      ui/app/components/modals/account-modal-container.js
  27. 22
      ui/app/components/modals/buy-options-modal.js
  28. 38
      ui/app/components/modals/deposit-ether-modal.js
  29. 12
      ui/app/components/modals/edit-account-name-modal.js
  30. 20
      ui/app/components/modals/export-private-key-modal.js
  31. 16
      ui/app/components/modals/hide-token-confirmation-modal.js
  32. 21
      ui/app/components/modals/new-account-modal.js
  33. 11
      ui/app/components/modals/notification-modal.js
  34. 2
      ui/app/components/modals/notification-modals/confirm-reset-account.js
  35. 2
      ui/app/components/modals/shapeshift-deposit-tx-modal.js
  36. 9
      ui/app/components/network-display.js
  37. 33
      ui/app/components/network.js
  38. 10
      ui/app/components/notice.js
  39. 10
      ui/app/components/pending-msg-details.js
  40. 18
      ui/app/components/pending-msg.js
  41. 30
      ui/app/components/pending-tx/confirm-deploy-contract.js
  42. 26
      ui/app/components/pending-tx/confirm-send-ether.js
  43. 42
      ui/app/components/pending-tx/confirm-send-token.js
  44. 2
      ui/app/components/pending-tx/index.js
  45. 2
      ui/app/components/qr-code.js
  46. 2
      ui/app/components/send/account-list-item.js
  47. 12
      ui/app/components/send/gas-fee-display-v2.js
  48. 10
      ui/app/components/send/gas-tooltip.js
  49. 2
      ui/app/components/send/send-v2-container.js
  50. 10
      ui/app/components/send/to-autocomplete.js
  51. 9
      ui/app/components/sender-to-recipient.js
  52. 28
      ui/app/components/shapeshift-form.js
  53. 22
      ui/app/components/shift-list-item.js
  54. 28
      ui/app/components/signature-request.js
  55. 2
      ui/app/components/token-balance.js
  56. 2
      ui/app/components/token-cell.js
  57. 14
      ui/app/components/token-list.js
  58. 26
      ui/app/components/tx-list-item.js
  59. 14
      ui/app/components/tx-list.js
  60. 14
      ui/app/components/tx-view.js
  61. 16
      ui/app/components/wallet-view.js
  62. 2
      ui/app/conf-tx.js
  63. 26
      ui/app/first-time/init-menu.js
  64. 37
      ui/app/i18n-provider.js
  65. 2
      ui/app/keychains/hd/create-vault-complete.js
  66. 15
      ui/app/keychains/hd/recover-seed/confirmation.js
  67. 32
      ui/app/keychains/hd/restore-vault.js
  68. 2
      ui/app/new-keychain.js
  69. 3
      ui/app/root.js
  70. 2
      ui/app/select-app.js
  71. 33
      ui/app/send-v2.js
  72. 81
      ui/app/settings.js
  73. 16
      ui/app/unlock.js

@ -1,7 +1,8 @@
const inherits = require('util').inherits const inherits = require('util').inherits
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') 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' import Select from 'react-select'
// Subviews // Subviews
@ -9,8 +10,13 @@ const JsonImportView = require('./json.js')
const PrivateKeyImportView = require('./private-key.js') const PrivateKeyImportView = require('./private-key.js')
AccountImportSubview.contextTypes = {
t: PropTypes.func,
}
module.exports = connect()(AccountImportSubview) module.exports = connect()(AccountImportSubview)
inherits(AccountImportSubview, Component) inherits(AccountImportSubview, Component)
function AccountImportSubview () { function AccountImportSubview () {
Component.call(this) Component.call(this)
@ -18,8 +24,8 @@ function AccountImportSubview () {
AccountImportSubview.prototype.getMenuItemTexts = function () { AccountImportSubview.prototype.getMenuItemTexts = function () {
return [ return [
this.props.t('privateKey'), this.context.t('privateKey'),
this.props.t('jsonFile'), this.context.t('jsonFile'),
] ]
} }
@ -32,7 +38,7 @@ AccountImportSubview.prototype.render = function () {
h('div.new-account-import-form', [ h('div.new-account-import-form', [
h('.new-account-import-disclaimer', [ h('.new-account-import-disclaimer', [
h('span', this.props.t('importAccountMsg')), h('span', this.context.t('importAccountMsg')),
h('span', { h('span', {
style: { style: {
cursor: 'pointer', cursor: 'pointer',
@ -43,12 +49,12 @@ AccountImportSubview.prototype.render = function () {
url: 'https://metamask.helpscoutdocs.com/article/17-what-are-loose-accounts', 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-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, { h(Select, {
className: 'new-account-import-form__select', className: 'new-account-import-form__select',
@ -80,9 +86,9 @@ AccountImportSubview.prototype.renderImportView = function () {
const current = type || menuItems[0] const current = type || menuItems[0]
switch (current) { switch (current) {
case this.props.t('privateKey'): case this.context.t('privateKey'):
return h(PrivateKeyImportView) return h(PrivateKeyImportView)
case this.props.t('jsonFile'): case this.context.t('jsonFile'):
return h(JsonImportView) return h(JsonImportView)
default: default:
return h(JsonImportView) return h(JsonImportView)

@ -1,7 +1,7 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('prop-types') const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const connect = require('../../metamask-connect') const connect = require('react-redux').connect
const actions = require('../../actions') const actions = require('../../actions')
const FileInput = require('react-simple-file-input').default const FileInput = require('react-simple-file-input').default
@ -24,11 +24,11 @@ class JsonImportSubview extends Component {
return ( return (
h('div.new-account-import-form__json', [ h('div.new-account-import-form__json', [
h('p', this.props.t('usedByClients')), h('p', this.context.t('usedByClients')),
h('a.warning', { h('a.warning', {
href: HELP_LINK, href: HELP_LINK,
target: '_blank', target: '_blank',
}, this.props.t('fileImportFail')), }, this.context.t('fileImportFail')),
h(FileInput, { h(FileInput, {
readAs: 'text', readAs: 'text',
@ -43,7 +43,7 @@ class JsonImportSubview extends Component {
h('input.new-account-import-form__input-password', { h('input.new-account-import-form__input-password', {
type: 'password', type: 'password',
placeholder: this.props.t('enterPassword'), placeholder: this.context.t('enterPassword'),
id: 'json-password-box', id: 'json-password-box',
onKeyPress: this.createKeyringOnEnter.bind(this), onKeyPress: this.createKeyringOnEnter.bind(this),
}), }),
@ -53,13 +53,13 @@ class JsonImportSubview extends Component {
h('button.btn-secondary.new-account-create-form__button', { h('button.btn-secondary.new-account-create-form__button', {
onClick: () => this.props.goHome(), onClick: () => this.props.goHome(),
}, [ }, [
this.props.t('cancel'), this.context.t('cancel'),
]), ]),
h('button.btn-primary.new-account-create-form__button', { h('button.btn-primary.new-account-create-form__button', {
onClick: () => this.createNewKeychain(), onClick: () => this.createNewKeychain(),
}, [ }, [
this.props.t('import'), this.context.t('import'),
]), ]),
]), ]),
@ -84,14 +84,14 @@ class JsonImportSubview extends Component {
const state = this.state const state = this.state
if (!state) { if (!state) {
const message = this.props.t('validFileImport') const message = this.context.t('validFileImport')
return this.props.displayWarning(message) return this.props.displayWarning(message)
} }
const { fileContents } = state const { fileContents } = state
if (!fileContents) { if (!fileContents) {
const message = this.props.t('needImportFile') const message = this.context.t('needImportFile')
return this.props.displayWarning(message) return this.props.displayWarning(message)
} }
@ -99,7 +99,7 @@ class JsonImportSubview extends Component {
const password = passwordInput.value const password = passwordInput.value
if (!password) { if (!password) {
const message = this.props.t('needImportPassword') const message = this.context.t('needImportPassword')
return this.props.displayWarning(message) return this.props.displayWarning(message)
} }
@ -129,4 +129,9 @@ const mapDispatchToProps = dispatch => {
} }
} }
JsonImportSubview.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps, mapDispatchToProps)(JsonImportSubview) module.exports = connect(mapStateToProps, mapDispatchToProps)(JsonImportSubview)

@ -1,11 +1,17 @@
const inherits = require('util').inherits const inherits = require('util').inherits
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const connect = require('../../metamask-connect') const PropTypes = require('prop-types')
const connect = require('react-redux').connect
const actions = require('../../actions') const actions = require('../../actions')
PrivateKeyImportView.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps, mapDispatchToProps)(PrivateKeyImportView) module.exports = connect(mapStateToProps, mapDispatchToProps)(PrivateKeyImportView)
function mapStateToProps (state) { function mapStateToProps (state) {
return { return {
error: state.appState.warning, error: state.appState.warning,
@ -33,7 +39,7 @@ PrivateKeyImportView.prototype.render = function () {
return ( return (
h('div.new-account-import-form__private-key', [ 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', [ h('div.new-account-import-form__private-key-password-container', [
@ -50,13 +56,13 @@ PrivateKeyImportView.prototype.render = function () {
h('button.btn-secondary--lg.new-account-create-form__button', { h('button.btn-secondary--lg.new-account-create-form__button', {
onClick: () => goHome(), onClick: () => goHome(),
}, [ }, [
this.props.t('cancel'), this.context.t('cancel'),
]), ]),
h('button.btn-primary--lg.new-account-create-form__button', { h('button.btn-primary--lg.new-account-create-form__button', {
onClick: () => this.createNewKeychain(), onClick: () => this.createNewKeychain(),
}, [ }, [
this.props.t('import'), this.context.t('import'),
]), ]),
]), ]),

@ -1,10 +1,16 @@
const inherits = require('util').inherits const inherits = require('util').inherits
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') 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) module.exports = connect(mapStateToProps)(SeedImportSubview)
function mapStateToProps (state) { function mapStateToProps (state) {
return {} return {}
} }
@ -20,10 +26,10 @@ SeedImportSubview.prototype.render = function () {
style: { style: {
}, },
}, [ }, [
this.props.t('pasteSeed'), this.context.t('pasteSeed'),
h('textarea'), h('textarea'),
h('br'), h('br'),
h('button', this.props.t('submit')), h('button', this.context.t('submit')),
]) ])
) )
} }

@ -1,11 +1,11 @@
const { Component } = require('react') const { Component } = require('react')
const PropTypes = require('prop-types') const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const connect = require('../../metamask-connect') const connect = require('react-redux').connect
const actions = require('../../actions') const actions = require('../../actions')
class NewAccountCreateForm extends Component { class NewAccountCreateForm extends Component {
constructor (props) { constructor (props, context) {
super(props) super(props)
const { numberOfExistingAccounts = 0 } = props const { numberOfExistingAccounts = 0 } = props
@ -13,7 +13,7 @@ class NewAccountCreateForm extends Component {
this.state = { this.state = {
newAccountName: '', newAccountName: '',
defaultAccountName: this.props.t('newAccountNumberName', [newAccountNumber]), defaultAccountName: context.t('newAccountNumberName', [newAccountNumber]),
} }
} }
@ -24,7 +24,7 @@ class NewAccountCreateForm extends Component {
return h('div.new-account-create-form', [ return h('div.new-account-create-form', [
h('div.new-account-create-form__input-label', {}, [ h('div.new-account-create-form__input-label', {}, [
this.props.t('accountName'), this.context.t('accountName'),
]), ]),
h('div.new-account-create-form__input-wrapper', {}, [ h('div.new-account-create-form__input-wrapper', {}, [
@ -40,13 +40,13 @@ class NewAccountCreateForm extends Component {
h('button.btn-secondary--lg.new-account-create-form__button', { h('button.btn-secondary--lg.new-account-create-form__button', {
onClick: () => this.props.goHome(), onClick: () => this.props.goHome(),
}, [ }, [
this.props.t('cancel'), this.context.t('cancel'),
]), ]),
h('button.btn-primary--lg.new-account-create-form__button', { h('button.btn-primary--lg.new-account-create-form__button', {
onClick: () => this.props.createAccount(newAccountName || defaultAccountName), onClick: () => this.props.createAccount(newAccountName || defaultAccountName),
}, [ }, [
this.props.t('create'), this.context.t('create'),
]), ]),
]), ]),
@ -97,4 +97,9 @@ const mapDispatchToProps = dispatch => {
} }
} }
NewAccountCreateForm.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps, mapDispatchToProps)(NewAccountCreateForm) module.exports = connect(mapStateToProps, mapDispatchToProps)(NewAccountCreateForm)

@ -1,7 +1,8 @@
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const PropTypes = require('prop-types')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('../../metamask-connect') const connect = require('react-redux').connect
const actions = require('../../actions') const actions = require('../../actions')
const { getCurrentViewContext } = require('../../selectors') const { getCurrentViewContext } = require('../../selectors')
const classnames = require('classnames') const classnames = require('classnames')
@ -36,8 +37,13 @@ function AccountDetailsModal (props) {
} }
} }
AccountDetailsModal.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps, mapDispatchToProps)(AccountDetailsModal) module.exports = connect(mapStateToProps, mapDispatchToProps)(AccountDetailsModal)
AccountDetailsModal.prototype.render = function () { AccountDetailsModal.prototype.render = function () {
const { displayedForm, displayForm } = this.props const { displayedForm, displayForm } = this.props
@ -45,7 +51,7 @@ AccountDetailsModal.prototype.render = function () {
h('div.new-account__header', [ h('div.new-account__header', [
h('div.new-account__title', this.props.t('newAccount')), h('div.new-account__title', this.context.t('newAccount')),
h('div.new-account__tabs', [ h('div.new-account__tabs', [
@ -55,7 +61,7 @@ AccountDetailsModal.prototype.render = function () {
'new-account__tabs__unselected cursor-pointer': displayedForm !== 'CREATE', 'new-account__tabs__unselected cursor-pointer': displayedForm !== 'CREATE',
}), }),
onClick: () => displayForm('CREATE'), onClick: () => displayForm('CREATE'),
}, this.props.t('createDen')), }, this.context.t('createDen')),
h('div.new-account__tabs__tab', { h('div.new-account__tabs__tab', {
className: classnames('new-account__tabs__tab', { className: classnames('new-account__tabs__tab', {
@ -63,7 +69,7 @@ AccountDetailsModal.prototype.render = function () {
'new-account__tabs__unselected cursor-pointer': displayedForm !== 'IMPORT', 'new-account__tabs__unselected cursor-pointer': displayedForm !== 'IMPORT',
}), }),
onClick: () => displayForm('IMPORT'), onClick: () => displayForm('IMPORT'),
}, this.props.t('import')), }, this.context.t('import')),
]), ]),

@ -2,7 +2,8 @@ const inherits = require('util').inherits
const Component = require('react').Component const Component = require('react').Component
const classnames = require('classnames') const classnames = require('classnames')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const connect = require('./metamask-connect') const PropTypes = require('prop-types')
const connect = require('react-redux').connect
const R = require('ramda') const R = require('ramda')
const Fuse = require('fuse.js') const Fuse = require('fuse.js')
const contractMap = require('eth-contract-metadata') const contractMap = require('eth-contract-metadata')
@ -29,8 +30,13 @@ const { tokenInfoGetter } = require('./token-util')
const emptyAddr = '0x0000000000000000000000000000000000000000' const emptyAddr = '0x0000000000000000000000000000000000000000'
AddTokenScreen.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps, mapDispatchToProps)(AddTokenScreen) module.exports = connect(mapStateToProps, mapDispatchToProps)(AddTokenScreen)
function mapStateToProps (state) { function mapStateToProps (state) {
const { identities, tokens } = state.metamask const { identities, tokens } = state.metamask
return { return {
@ -139,7 +145,7 @@ AddTokenScreen.prototype.validate = function () {
if (customAddress) { if (customAddress) {
const validAddress = ethUtil.isValidAddress(customAddress) const validAddress = ethUtil.isValidAddress(customAddress)
if (!validAddress) { if (!validAddress) {
errors.customAddress = this.props.t('invalidAddress') errors.customAddress = this.context.t('invalidAddress')
} }
const validDecimals = customDecimals !== null const validDecimals = customDecimals !== null
@ -147,23 +153,23 @@ AddTokenScreen.prototype.validate = function () {
&& customDecimals >= 0 && customDecimals >= 0
&& customDecimals < 36 && customDecimals < 36
if (!validDecimals) { if (!validDecimals) {
errors.customDecimals = this.props.t('decimalsMustZerotoTen') errors.customDecimals = this.context.t('decimalsMustZerotoTen')
} }
const symbolLen = customSymbol.trim().length const symbolLen = customSymbol.trim().length
const validSymbol = symbolLen > 0 && symbolLen < 10 const validSymbol = symbolLen > 0 && symbolLen < 10
if (!validSymbol) { if (!validSymbol) {
errors.customSymbol = this.props.t('symbolBetweenZeroTen') errors.customSymbol = this.context.t('symbolBetweenZeroTen')
} }
const ownAddress = identitiesList.includes(standardAddress) const ownAddress = identitiesList.includes(standardAddress)
if (ownAddress) { if (ownAddress) {
errors.customAddress = this.props.t('personalAddressDetected') errors.customAddress = this.context.t('personalAddressDetected')
} }
const tokenAlreadyAdded = this.checkExistingAddresses(customAddress) const tokenAlreadyAdded = this.checkExistingAddresses(customAddress)
if (tokenAlreadyAdded) { if (tokenAlreadyAdded) {
errors.customAddress = this.props.t('tokenAlreadyAdded') errors.customAddress = this.context.t('tokenAlreadyAdded')
} }
} else if ( } else if (
Object.entries(selectedTokens) Object.entries(selectedTokens)
@ -171,7 +177,7 @@ AddTokenScreen.prototype.validate = function () {
isEmpty && !isSelected isEmpty && !isSelected
), true) ), true)
) { ) {
errors.tokenSelector = this.props.t('mustSelectOne') errors.tokenSelector = this.context.t('mustSelectOne')
} }
return { return {
@ -201,7 +207,7 @@ AddTokenScreen.prototype.renderCustomForm = function () {
'add-token__add-custom-field--error': errors.customAddress, 'add-token__add-custom-field--error': errors.customAddress,
}), }),
}, [ }, [
h('div.add-token__add-custom-label', this.props.t('tokenAddress')), h('div.add-token__add-custom-label', this.context.t('tokenAddress')),
h('input.add-token__add-custom-input', { h('input.add-token__add-custom-input', {
type: 'text', type: 'text',
onChange: this.tokenAddressDidChange, onChange: this.tokenAddressDidChange,
@ -214,7 +220,7 @@ AddTokenScreen.prototype.renderCustomForm = function () {
'add-token__add-custom-field--error': errors.customSymbol, 'add-token__add-custom-field--error': errors.customSymbol,
}), }),
}, [ }, [
h('div.add-token__add-custom-label', this.props.t('tokenSymbol')), h('div.add-token__add-custom-label', this.context.t('tokenSymbol')),
h('input.add-token__add-custom-input', { h('input.add-token__add-custom-input', {
type: 'text', type: 'text',
onChange: this.tokenSymbolDidChange, onChange: this.tokenSymbolDidChange,
@ -228,7 +234,7 @@ AddTokenScreen.prototype.renderCustomForm = function () {
'add-token__add-custom-field--error': errors.customDecimals, 'add-token__add-custom-field--error': errors.customDecimals,
}), }),
}, [ }, [
h('div.add-token__add-custom-label', this.props.t('decimal')), h('div.add-token__add-custom-label', this.context.t('decimal')),
h('input.add-token__add-custom-input', { h('input.add-token__add-custom-input', {
type: 'number', type: 'number',
onChange: this.tokenDecimalsDidChange, onChange: this.tokenDecimalsDidChange,
@ -250,7 +256,7 @@ AddTokenScreen.prototype.renderTokenList = function () {
const results = [...addressSearchResult, ...fuseSearchResult] const results = [...addressSearchResult, ...fuseSearchResult]
return h('div', [ return h('div', [
results.length > 0 && h('div.add-token__token-icons-title', this.props.t('popularTokens')), results.length > 0 && h('div.add-token__token-icons-title', this.context.t('popularTokens')),
h('div.add-token__token-icons-container', Array(6).fill(undefined) h('div.add-token__token-icons-container', Array(6).fill(undefined)
.map((_, i) => { .map((_, i) => {
const { logo, symbol, name, address } = results[i] || {} const { logo, symbol, name, address } = results[i] || {}
@ -305,10 +311,10 @@ AddTokenScreen.prototype.renderConfirmation = function () {
h('div.add-token', [ h('div.add-token', [
h('div.add-token__wrapper', [ h('div.add-token__wrapper', [
h('div.add-token__title-container.add-token__confirmation-title', [ h('div.add-token__title-container.add-token__confirmation-title', [
h('div.add-token__description', this.props.t('likeToAddTokens')), h('div.add-token__description', this.context.t('likeToAddTokens')),
]), ]),
h('div.add-token__content-container.add-token__confirmation-content', [ h('div.add-token__content-container.add-token__confirmation-content', [
h('div.add-token__description.add-token__confirmation-description', this.props.t('balances')), h('div.add-token__description.add-token__confirmation-description', this.context.t('balances')),
h('div.add-token__confirmation-token-list', h('div.add-token__confirmation-token-list',
Object.entries(tokens) Object.entries(tokens)
.map(([ address, token ]) => ( .map(([ address, token ]) => (
@ -327,10 +333,10 @@ AddTokenScreen.prototype.renderConfirmation = function () {
h('div.add-token__buttons', [ h('div.add-token__buttons', [
h('button.btn-secondary--lg.add-token__cancel-button', { h('button.btn-secondary--lg.add-token__cancel-button', {
onClick: () => this.setState({ isShowingConfirmation: false }), onClick: () => this.setState({ isShowingConfirmation: false }),
}, this.props.t('back')), }, this.context.t('back')),
h('button.btn-primary--lg', { h('button.btn-primary--lg', {
onClick: () => addTokens(tokens).then(goHome), onClick: () => addTokens(tokens).then(goHome),
}, this.props.t('addTokens')), }, this.context.t('addTokens')),
]), ]),
]) ])
) )
@ -350,14 +356,14 @@ AddTokenScreen.prototype.renderTabs = function () {
h('div.add-token__content-container', [ h('div.add-token__content-container', [
h('div.add-token__info-box', [ h('div.add-token__info-box', [
h('div.add-token__info-box__close'), h('div.add-token__info-box__close'),
h('div.add-token__info-box__title', this.props.t('whatsThis')), h('div.add-token__info-box__title', this.context.t('whatsThis')),
h('div.add-token__info-box__copy', this.props.t('keepTrackTokens')), h('div.add-token__info-box__copy', this.context.t('keepTrackTokens')),
h('div.add-token__info-box__copy--blue', this.props.t('learnMore')), h('div.add-token__info-box__copy--blue', this.context.t('learnMore')),
]), ]),
h('div.add-token__input-container', [ h('div.add-token__input-container', [
h('input.add-token__input', { h('input.add-token__input', {
type: 'text', type: 'text',
placeholder: this.props.t('searchTokens'), placeholder: this.context.t('searchTokens'),
onChange: e => this.setState({ searchQuery: e.target.value }), onChange: e => this.setState({ searchQuery: e.target.value }),
}), }),
h('div.add-token__search-input-error-message', errors.tokenSelector), h('div.add-token__search-input-error-message', errors.tokenSelector),
@ -381,9 +387,9 @@ AddTokenScreen.prototype.render = function () {
onClick: () => goHome(), onClick: () => goHome(),
}, [ }, [
h('i.fa.fa-angle-left.fa-lg'), h('i.fa.fa-angle-left.fa-lg'),
h('span', this.props.t('cancel')), h('span', this.context.t('cancel')),
]), ]),
h('div.add-token__header__title', this.props.t('addTokens')), h('div.add-token__header__title', this.context.t('addTokens')),
!isShowingConfirmation && h('div.add-token__header__tabs', [ !isShowingConfirmation && h('div.add-token__header__tabs', [
h('div.add-token__header__tabs__tab', { h('div.add-token__header__tabs__tab', {
@ -392,7 +398,7 @@ AddTokenScreen.prototype.render = function () {
'add-token__header__tabs__unselected cursor-pointer': displayedTab !== 'SEARCH', 'add-token__header__tabs__unselected cursor-pointer': displayedTab !== 'SEARCH',
}), }),
onClick: () => this.displayTab('SEARCH'), onClick: () => this.displayTab('SEARCH'),
}, this.props.t('search')), }, this.context.t('search')),
h('div.add-token__header__tabs__tab', { h('div.add-token__header__tabs__tab', {
className: classnames('add-token__header__tabs__tab', { className: classnames('add-token__header__tabs__tab', {
@ -400,7 +406,7 @@ AddTokenScreen.prototype.render = function () {
'add-token__header__tabs__unselected cursor-pointer': displayedTab !== 'CUSTOM_TOKEN', 'add-token__header__tabs__unselected cursor-pointer': displayedTab !== 'CUSTOM_TOKEN',
}), }),
onClick: () => this.displayTab('CUSTOM_TOKEN'), onClick: () => this.displayTab('CUSTOM_TOKEN'),
}, this.props.t('customToken')), }, this.context.t('customToken')),
]), ]),
]), ]),
@ -412,10 +418,10 @@ AddTokenScreen.prototype.render = function () {
!isShowingConfirmation && h('div.add-token__buttons', [ !isShowingConfirmation && h('div.add-token__buttons', [
h('button.btn-secondary--lg.add-token__cancel-button', { h('button.btn-secondary--lg.add-token__cancel-button', {
onClick: goHome, onClick: goHome,
}, this.props.t('cancel')), }, this.context.t('cancel')),
h('button.btn-primary--lg.add-token__confirm-button', { h('button.btn-primary--lg.add-token__confirm-button', {
onClick: this.onNext, onClick: this.onNext,
}, this.props.t('next')), }, this.context.t('next')),
]), ]),
]) ])
} }

@ -1,7 +1,8 @@
const inherits = require('util').inherits const inherits = require('util').inherits
const Component = require('react').Component const Component = require('react').Component
const connect = require('./metamask-connect') const connect = require('react-redux').connect
const h = require('react-hyperscript') const h = require('react-hyperscript')
const PropTypes = require('prop-types')
const actions = require('./actions') const actions = require('./actions')
const classnames = require('classnames') const classnames = require('classnames')
@ -45,8 +46,13 @@ const QrView = require('./components/qr-code')
// Global Modals // Global Modals
const Modal = require('./components/modals/index').Modal const Modal = require('./components/modals/index').Modal
App.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps, mapDispatchToProps)(App) module.exports = connect(mapStateToProps, mapDispatchToProps)(App)
inherits(App, Component) inherits(App, Component)
function App () { Component.call(this) } function App () { Component.call(this) }
@ -293,8 +299,8 @@ App.prototype.renderAppBar = function () {
// metamask name // metamask name
h('.flex-row', [ h('.flex-row', [
h('h1', this.props.t('appName')), h('h1', this.context.t('appName')),
h('div.beta-label', this.props.t('beta')), h('div.beta-label', this.context.t('beta')),
]), ]),
]), ]),
@ -556,15 +562,15 @@ App.prototype.getConnectingLabel = function () {
let name let name
if (providerName === 'mainnet') { if (providerName === 'mainnet') {
name = this.props.t('connectingToMainnet') name = this.context.t('connectingToMainnet')
} else if (providerName === 'ropsten') { } else if (providerName === 'ropsten') {
name = this.props.t('connectingToRopsten') name = this.context.t('connectingToRopsten')
} else if (providerName === 'kovan') { } else if (providerName === 'kovan') {
name = this.props.t('connectingToRopsten') name = this.context.t('connectingToRopsten')
} else if (providerName === 'rinkeby') { } else if (providerName === 'rinkeby') {
name = this.props.t('connectingToRinkeby') name = this.context.t('connectingToRinkeby')
} else { } else {
name = this.props.t('connectingToUnknown') name = this.context.t('connectingToUnknown')
} }
return name return name
@ -577,15 +583,15 @@ App.prototype.getNetworkName = function () {
let name let name
if (providerName === 'mainnet') { if (providerName === 'mainnet') {
name = this.props.t('mainnet') name = this.context.t('mainnet')
} else if (providerName === 'ropsten') { } else if (providerName === 'ropsten') {
name = this.props.t('ropsten') name = this.context.t('ropsten')
} else if (providerName === 'kovan') { } else if (providerName === 'kovan') {
name = this.props.t('kovan') name = this.context.t('kovan')
} else if (providerName === 'rinkeby') { } else if (providerName === 'rinkeby') {
name = this.props.t('rinkeby') name = this.context.t('rinkeby')
} else { } else {
name = this.props.t('unknownNetwork') name = this.context.t('unknownNetwork')
} }
return name return name

@ -3,7 +3,7 @@ const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const actions = require('../actions') const actions = require('../actions')
const genAccountLink = require('etherscan-link').createAccountLink const genAccountLink = require('etherscan-link').createAccountLink
const connect = require('../metamask-connect') const connect = require('react-redux').connect
const Dropdown = require('./dropdown').Dropdown const Dropdown = require('./dropdown').Dropdown
const DropdownMenuItem = require('./dropdown').DropdownMenuItem const DropdownMenuItem = require('./dropdown').DropdownMenuItem
const Identicon = require('./identicon') const Identicon = require('./identicon')
@ -79,7 +79,7 @@ class AccountDropdowns extends Component {
try { // Sometimes keyrings aren't loaded yet: try { // Sometimes keyrings aren't loaded yet:
const type = keyring.type const type = keyring.type
const isLoose = type !== 'HD Key Tree' const isLoose = type !== 'HD Key Tree'
return isLoose ? h('.keyring-label.allcaps', this.props.t('loose')) : null return isLoose ? h('.keyring-label.allcaps', this.context.t('loose')) : null
} catch (e) { return } } catch (e) { return }
} }
@ -129,7 +129,7 @@ class AccountDropdowns extends Component {
diameter: 32, diameter: 32,
}, },
), ),
h('span', { style: { marginLeft: '20px', fontSize: '24px' } }, this.props.t('createAccount')), h('span', { style: { marginLeft: '20px', fontSize: '24px' } }, this.context.t('createAccount')),
], ],
), ),
h( h(
@ -154,7 +154,7 @@ class AccountDropdowns extends Component {
fontSize: '24px', fontSize: '24px',
marginBottom: '5px', marginBottom: '5px',
}, },
}, this.props.t('importAccount')), }, this.context.t('importAccount')),
] ]
), ),
] ]
@ -192,7 +192,7 @@ class AccountDropdowns extends Component {
global.platform.openWindow({ url }) global.platform.openWindow({ url })
}, },
}, },
this.props.t('etherscanView'), this.context.t('etherscanView'),
), ),
h( h(
DropdownMenuItem, DropdownMenuItem,
@ -204,7 +204,7 @@ class AccountDropdowns extends Component {
actions.showQrView(selected, identity ? identity.name : '') actions.showQrView(selected, identity ? identity.name : '')
}, },
}, },
this.props.t('showQRCode'), this.context.t('showQRCode'),
), ),
h( h(
DropdownMenuItem, DropdownMenuItem,
@ -216,7 +216,7 @@ class AccountDropdowns extends Component {
copyToClipboard(checkSumAddress) copyToClipboard(checkSumAddress)
}, },
}, },
this.props.t('copyAddress'), this.context.t('copyAddress'),
), ),
h( h(
DropdownMenuItem, DropdownMenuItem,
@ -226,7 +226,7 @@ class AccountDropdowns extends Component {
actions.requestAccountExport() actions.requestAccountExport()
}, },
}, },
this.props.t('exportPrivateKey'), this.context.t('exportPrivateKey'),
), ),
] ]
) )
@ -316,6 +316,10 @@ const mapDispatchToProps = (dispatch) => {
} }
} }
AccountDropdowns.contextTypes = {
t: PropTypes.func,
}
module.exports = { module.exports = {
AccountDropdowns: connect(null, mapDispatchToProps)(AccountDropdowns), AccountDropdowns: connect(null, mapDispatchToProps)(AccountDropdowns),
} }

@ -1,14 +1,20 @@
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const PropTypes = require('prop-types')
const inherits = require('util').inherits const inherits = require('util').inherits
const exportAsFile = require('../util').exportAsFile const exportAsFile = require('../util').exportAsFile
const copyToClipboard = require('copy-to-clipboard') const copyToClipboard = require('copy-to-clipboard')
const actions = require('../actions') const actions = require('../actions')
const ethUtil = require('ethereumjs-util') const ethUtil = require('ethereumjs-util')
const connect = require('../metamask-connect') const connect = require('react-redux').connect
ExportAccountView.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps)(ExportAccountView) module.exports = connect(mapStateToProps)(ExportAccountView)
inherits(ExportAccountView, Component) inherits(ExportAccountView, Component)
function ExportAccountView () { function ExportAccountView () {
Component.call(this) Component.call(this)
@ -35,7 +41,7 @@ ExportAccountView.prototype.render = function () {
if (notExporting) return h('div') if (notExporting) return h('div')
if (exportRequested) { if (exportRequested) {
const warning = this.props.t('exportPrivateKeyWarning') const warning = this.context.t('exportPrivateKeyWarning')
return ( return (
h('div', { h('div', {
style: { style: {
@ -53,7 +59,7 @@ ExportAccountView.prototype.render = function () {
h('p.error', warning), h('p.error', warning),
h('input#exportAccount.sizing-input', { h('input#exportAccount.sizing-input', {
type: 'password', type: 'password',
placeholder: this.props.t('confirmPassword').toLowerCase(), placeholder: this.context.t('confirmPassword').toLowerCase(),
onKeyPress: this.onExportKeyPress.bind(this), onKeyPress: this.onExportKeyPress.bind(this),
style: { style: {
position: 'relative', position: 'relative',
@ -74,10 +80,10 @@ ExportAccountView.prototype.render = function () {
style: { style: {
marginRight: '10px', marginRight: '10px',
}, },
}, this.props.t('submit')), }, this.context.t('submit')),
h('button', { h('button', {
onClick: () => this.props.dispatch(actions.backToAccountDetail(this.props.address)), onClick: () => this.props.dispatch(actions.backToAccountDetail(this.props.address)),
}, this.props.t('cancel')), }, this.context.t('cancel')),
]), ]),
(this.props.warning) && ( (this.props.warning) && (
h('span.error', { h('span.error', {
@ -98,7 +104,7 @@ ExportAccountView.prototype.render = function () {
margin: '0 20px', margin: '0 20px',
}, },
}, [ }, [
h('label', this.props.t('copyPrivateKey') + ':'), h('label', this.context.t('copyPrivateKey') + ':'),
h('p.error.cursor-pointer', { h('p.error.cursor-pointer', {
style: { style: {
textOverflow: 'ellipsis', textOverflow: 'ellipsis',
@ -112,13 +118,13 @@ ExportAccountView.prototype.render = function () {
}, plainKey), }, plainKey),
h('button', { h('button', {
onClick: () => this.props.dispatch(actions.backToAccountDetail(this.props.address)), onClick: () => this.props.dispatch(actions.backToAccountDetail(this.props.address)),
}, this.props.t('done')), }, this.context.t('done')),
h('button', { h('button', {
style: { style: {
marginLeft: '10px', marginLeft: '10px',
}, },
onClick: () => exportAsFile(`MetaMask ${nickname} Private Key`, plainKey), onClick: () => exportAsFile(`MetaMask ${nickname} Private Key`, plainKey),
}, this.props.t('saveAsFile')), }, this.context.t('saveAsFile')),
]) ])
} }
} }

@ -1,14 +1,20 @@
const inherits = require('util').inherits const inherits = require('util').inherits
const Component = require('react').Component const Component = require('react').Component
const connect = require('../../metamask-connect') const PropTypes = require('prop-types')
const connect = require('react-redux').connect
const h = require('react-hyperscript') const h = require('react-hyperscript')
const actions = require('../../actions') const actions = require('../../actions')
const { Menu, Item, Divider, CloseArea } = require('../dropdowns/components/menu') const { Menu, Item, Divider, CloseArea } = require('../dropdowns/components/menu')
const Identicon = require('../identicon') const Identicon = require('../identicon')
const { formatBalance } = require('../../util') const { formatBalance } = require('../../util')
AccountMenu.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps, mapDispatchToProps)(AccountMenu) module.exports = connect(mapStateToProps, mapDispatchToProps)(AccountMenu)
inherits(AccountMenu, Component) inherits(AccountMenu, Component)
function AccountMenu () { Component.call(this) } function AccountMenu () { Component.call(this) }
@ -70,10 +76,10 @@ AccountMenu.prototype.render = function () {
h(Item, { h(Item, {
className: 'account-menu__header', className: 'account-menu__header',
}, [ }, [
this.props.t('myAccounts'), this.context.t('myAccounts'),
h('button.account-menu__logout-button', { h('button.account-menu__logout-button', {
onClick: lockMetamask, onClick: lockMetamask,
}, this.props.t('logout')), }, this.context.t('logout')),
]), ]),
h(Divider), h(Divider),
h('div.account-menu__accounts', this.renderAccounts()), h('div.account-menu__accounts', this.renderAccounts()),
@ -81,23 +87,23 @@ AccountMenu.prototype.render = function () {
h(Item, { h(Item, {
onClick: () => showNewAccountPage('CREATE'), onClick: () => showNewAccountPage('CREATE'),
icon: h('img.account-menu__item-icon', { src: 'images/plus-btn-white.svg' }), icon: h('img.account-menu__item-icon', { src: 'images/plus-btn-white.svg' }),
text: this.props.t('createAccount'), text: this.context.t('createAccount'),
}), }),
h(Item, { h(Item, {
onClick: () => showNewAccountPage('IMPORT'), onClick: () => showNewAccountPage('IMPORT'),
icon: h('img.account-menu__item-icon', { src: 'images/import-account.svg' }), icon: h('img.account-menu__item-icon', { src: 'images/import-account.svg' }),
text: this.props.t('importAccount'), text: this.context.t('importAccount'),
}), }),
h(Divider), h(Divider),
h(Item, { h(Item, {
onClick: showInfoPage, onClick: showInfoPage,
icon: h('img', { src: 'images/mm-info-icon.svg' }), icon: h('img', { src: 'images/mm-info-icon.svg' }),
text: this.props.t('infoHelp'), text: this.context.t('infoHelp'),
}), }),
h(Item, { h(Item, {
onClick: showConfigPage, onClick: showConfigPage,
icon: h('img.account-menu__item-icon', { src: 'images/settings.svg' }), icon: h('img.account-menu__item-icon', { src: 'images/settings.svg' }),
text: this.props.t('settings'), text: this.context.t('settings'),
}), }),
]) ])
} }
@ -155,6 +161,6 @@ AccountMenu.prototype.indicateIfLoose = function (keyring) {
try { // Sometimes keyrings aren't loaded yet: try { // Sometimes keyrings aren't loaded yet:
const type = keyring.type const type = keyring.type
const isLoose = type !== 'HD Key Tree' const isLoose = type !== 'HD Key Tree'
return isLoose ? h('.keyring-label.allcaps', this.props.t('imported')) : null return isLoose ? h('.keyring-label.allcaps', this.context.t('imported')) : null
} catch (e) { return } } catch (e) { return }
} }

@ -1,5 +1,5 @@
const Component = require('react').Component const Component = require('react').Component
const connect = require('../metamask-connect') const connect = require('react-redux').connect
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const TokenBalance = require('./token-balance') const TokenBalance = require('./token-balance')

@ -1,13 +1,19 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const ethUtil = require('ethereumjs-util') const ethUtil = require('ethereumjs-util')
const BN = ethUtil.BN const BN = ethUtil.BN
const extend = require('xtend') const extend = require('xtend')
const connect = require('../metamask-connect') const connect = require('react-redux').connect
BnAsDecimalInput.contextTypes = {
t: PropTypes.func,
}
module.exports = connect()(BnAsDecimalInput) module.exports = connect()(BnAsDecimalInput)
inherits(BnAsDecimalInput, Component) inherits(BnAsDecimalInput, Component)
function BnAsDecimalInput () { function BnAsDecimalInput () {
this.state = { invalid: null } this.state = { invalid: null }
@ -137,13 +143,13 @@ BnAsDecimalInput.prototype.constructWarning = function () {
let message = name ? name + ' ' : '' let message = name ? name + ' ' : ''
if (min && max) { if (min && max) {
message += this.props.t('betweenMinAndMax', [`${newMin} ${suffix}`, `${newMax} ${suffix}`]) message += this.context.t('betweenMinAndMax', [`${newMin} ${suffix}`, `${newMax} ${suffix}`])
} else if (min) { } else if (min) {
message += this.props.t('greaterThanMin', [`${newMin} ${suffix}`]) message += this.context.t('greaterThanMin', [`${newMin} ${suffix}`])
} else if (max) { } else if (max) {
message += this.props.t('lessThanMax', [`${newMax} ${suffix}`]) message += this.context.t('lessThanMax', [`${newMax} ${suffix}`])
} else { } else {
message += this.props.t('invalidInput') message += this.context.t('invalidInput')
} }
return message return message

@ -1,7 +1,8 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('../metamask-connect') const connect = require('react-redux').connect
const actions = require('../actions') const actions = require('../actions')
const CoinbaseForm = require('./coinbase-form') const CoinbaseForm = require('./coinbase-form')
const ShapeshiftForm = require('./shapeshift-form') const ShapeshiftForm = require('./shapeshift-form')
@ -10,8 +11,13 @@ const AccountPanel = require('./account-panel')
const RadioList = require('./custom-radio-list') const RadioList = require('./custom-radio-list')
const networkNames = require('../../../app/scripts/config.js').networkNames const networkNames = require('../../../app/scripts/config.js').networkNames
BuyButtonSubview.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps)(BuyButtonSubview) module.exports = connect(mapStateToProps)(BuyButtonSubview)
function mapStateToProps (state) { function mapStateToProps (state) {
return { return {
identity: state.appState.identity, identity: state.appState.identity,
@ -76,7 +82,7 @@ BuyButtonSubview.prototype.headerSubview = function () {
paddingTop: '4px', paddingTop: '4px',
paddingBottom: '4px', paddingBottom: '4px',
}, },
}, this.props.t('depositEth')), }, this.context.t('depositEth')),
]), ]),
// loading indication // loading indication
@ -118,7 +124,7 @@ BuyButtonSubview.prototype.headerSubview = function () {
paddingTop: '4px', paddingTop: '4px',
paddingBottom: '4px', paddingBottom: '4px',
}, },
}, this.props.t('selectService')), }, this.context.t('selectService')),
]), ]),
]) ])
@ -143,7 +149,7 @@ BuyButtonSubview.prototype.primarySubview = function () {
case '4': case '4':
case '42': case '42':
const networkName = networkNames[network] const networkName = networkNames[network]
const label = `${networkName} ${this.props.t('testFaucet')}` const label = `${networkName} ${this.context.t('testFaucet')}`
return ( return (
h('div.flex-column', { h('div.flex-column', {
style: { style: {
@ -164,14 +170,14 @@ BuyButtonSubview.prototype.primarySubview = function () {
style: { style: {
marginTop: '15px', marginTop: '15px',
}, },
}, this.props.t('borrowDharma')) }, this.context.t('borrowDharma'))
) : null, ) : null,
]) ])
) )
default: default:
return ( return (
h('h2.error', this.props.t('unknownNetworkId')) h('h2.error', this.context.t('unknownNetworkId'))
) )
} }
@ -203,8 +209,8 @@ BuyButtonSubview.prototype.mainnetSubview = function () {
'ShapeShift', 'ShapeShift',
], ],
subtext: { subtext: {
'Coinbase': `${this.props.t('crypto')}/${this.props.t('fiat')} (${this.props.t('usaOnly')})`, 'Coinbase': `${this.context.t('crypto')}/${this.context.t('fiat')} (${this.context.t('usaOnly')})`,
'ShapeShift': this.props.t('crypto'), 'ShapeShift': this.context.t('crypto'),
}, },
onClick: this.radioHandler.bind(this), onClick: this.radioHandler.bind(this),
}), }),

@ -1,11 +1,17 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('../metamask-connect') const connect = require('react-redux').connect
const actions = require('../actions') const actions = require('../actions')
CoinbaseForm.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps)(CoinbaseForm) module.exports = connect(mapStateToProps)(CoinbaseForm)
function mapStateToProps (state) { function mapStateToProps (state) {
return { return {
warning: state.appState.warning, warning: state.appState.warning,
@ -37,11 +43,11 @@ CoinbaseForm.prototype.render = function () {
}, [ }, [
h('button.btn-green', { h('button.btn-green', {
onClick: this.toCoinbase.bind(this), onClick: this.toCoinbase.bind(this),
}, this.props.t('continueToCoinbase')), }, this.context.t('continueToCoinbase')),
h('button.btn-red', { h('button.btn-red', {
onClick: () => props.dispatch(actions.goHome()), onClick: () => props.dispatch(actions.goHome()),
}, this.props.t('cancel')), }, this.context.t('cancel')),
]), ]),
]) ])
} }

@ -1,13 +1,19 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const copyToClipboard = require('copy-to-clipboard') const copyToClipboard = require('copy-to-clipboard')
const connect = require('../metamask-connect') const connect = require('react-redux').connect
const Tooltip = require('./tooltip') const Tooltip = require('./tooltip')
CopyButton.contextTypes = {
t: PropTypes.func,
}
module.exports = connect()(CopyButton) module.exports = connect()(CopyButton)
inherits(CopyButton, Component) inherits(CopyButton, Component)
function CopyButton () { function CopyButton () {
Component.call(this) Component.call(this)
@ -23,7 +29,7 @@ CopyButton.prototype.render = function () {
const value = props.value const value = props.value
const copied = state.copied const copied = state.copied
const message = copied ? this.props.t('copiedButton') : props.title || this.props.t('copyButton') const message = copied ? this.context.t('copiedButton') : props.title || this.context.t('copyButton')
return h('.copy-button', { return h('.copy-button', {
style: { style: {

@ -1,13 +1,19 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const Tooltip = require('./tooltip') const Tooltip = require('./tooltip')
const copyToClipboard = require('copy-to-clipboard') const copyToClipboard = require('copy-to-clipboard')
const connect = require('../metamask-connect') const connect = require('react-redux').connect
Copyable.contextTypes = {
t: PropTypes.func,
}
module.exports = connect()(Copyable) module.exports = connect()(Copyable)
inherits(Copyable, Component) inherits(Copyable, Component)
function Copyable () { function Copyable () {
Component.call(this) Component.call(this)
@ -23,7 +29,7 @@ Copyable.prototype.render = function () {
const { copied } = state const { copied } = state
return h(Tooltip, { return h(Tooltip, {
title: copied ? this.props.t('copiedExclamation') : this.props.t('copy'), title: copied ? this.context.t('copiedExclamation') : this.context.t('copy'),
position: 'bottom', position: 'bottom',
}, h('span', { }, h('span', {
style: { style: {

@ -1,7 +1,8 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('../../metamask-connect') const connect = require('react-redux').connect
const actions = require('../../actions') const actions = require('../../actions')
const GasModalCard = require('./gas-modal-card') const GasModalCard = require('./gas-modal-card')
@ -94,8 +95,13 @@ function CustomizeGasModal (props) {
this.state = getOriginalState(props) this.state = getOriginalState(props)
} }
CustomizeGasModal.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps, mapDispatchToProps)(CustomizeGasModal) module.exports = connect(mapStateToProps, mapDispatchToProps)(CustomizeGasModal)
CustomizeGasModal.prototype.save = function (gasPrice, gasLimit, gasTotal) { CustomizeGasModal.prototype.save = function (gasPrice, gasLimit, gasTotal) {
const { const {
updateGasPrice, updateGasPrice,
@ -149,7 +155,7 @@ CustomizeGasModal.prototype.validate = function ({ gasTotal, gasLimit }) {
}) })
if (!balanceIsSufficient) { if (!balanceIsSufficient) {
error = this.props.t('balanceIsInsufficientGas') error = this.context.t('balanceIsInsufficientGas')
} }
const gasLimitTooLow = gasLimit && conversionGreaterThan( const gasLimitTooLow = gasLimit && conversionGreaterThan(
@ -165,7 +171,7 @@ CustomizeGasModal.prototype.validate = function ({ gasTotal, gasLimit }) {
) )
if (gasLimitTooLow) { if (gasLimitTooLow) {
error = this.props.t('gasLimitTooLow') error = this.context.t('gasLimitTooLow')
} }
this.setState({ error }) this.setState({ error })
@ -258,7 +264,7 @@ CustomizeGasModal.prototype.render = function () {
}, [ }, [
h('div.send-v2__customize-gas__header', {}, [ h('div.send-v2__customize-gas__header', {}, [
h('div.send-v2__customize-gas__title', this.props.t('customGas')), h('div.send-v2__customize-gas__title', this.context.t('customGas')),
h('div.send-v2__customize-gas__close', { h('div.send-v2__customize-gas__close', {
onClick: hideModal, onClick: hideModal,
@ -274,8 +280,8 @@ CustomizeGasModal.prototype.render = function () {
// max: 1000, // max: 1000,
step: multiplyCurrencies(MIN_GAS_PRICE_GWEI, 10), step: multiplyCurrencies(MIN_GAS_PRICE_GWEI, 10),
onChange: value => this.convertAndSetGasPrice(value), onChange: value => this.convertAndSetGasPrice(value),
title: this.props.t('gasPrice'), title: this.context.t('gasPrice'),
copy: this.props.t('gasPriceCalculation'), copy: this.context.t('gasPriceCalculation'),
}), }),
h(GasModalCard, { h(GasModalCard, {
@ -284,8 +290,8 @@ CustomizeGasModal.prototype.render = function () {
// max: 100000, // max: 100000,
step: 1, step: 1,
onChange: value => this.convertAndSetGasLimit(value), onChange: value => this.convertAndSetGasLimit(value),
title: this.props.t('gasLimit'), title: this.context.t('gasLimit'),
copy: this.props.t('gasLimitCalculation'), copy: this.context.t('gasLimitCalculation'),
}), }),
]), ]),
@ -298,7 +304,7 @@ CustomizeGasModal.prototype.render = function () {
h('div.send-v2__customize-gas__revert', { h('div.send-v2__customize-gas__revert', {
onClick: () => this.revert(), onClick: () => this.revert(),
}, [this.props.t('revert')]), }, [this.context.t('revert')]),
h('div.send-v2__customize-gas__buttons', [ h('div.send-v2__customize-gas__buttons', [
h('button.btn-secondary.send-v2__customize-gas__cancel', { h('button.btn-secondary.send-v2__customize-gas__cancel', {
@ -306,12 +312,12 @@ CustomizeGasModal.prototype.render = function () {
style: { style: {
marginRight: '10px', marginRight: '10px',
}, },
}, [this.props.t('cancel')]), }, [this.context.t('cancel')]),
h('button.btn-primary.send-v2__customize-gas__save', { h('button.btn-primary.send-v2__customize-gas__save', {
onClick: () => !error && this.save(newGasPrice, gasLimit, gasTotal), onClick: () => !error && this.save(newGasPrice, gasLimit, gasTotal),
className: error && 'btn-primary--disabled', className: error && 'btn-primary--disabled',
}, [this.props.t('save')]), }, [this.context.t('save')]),
]), ]),
]), ]),

@ -3,7 +3,7 @@ const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const actions = require('../../../actions') const actions = require('../../../actions')
const genAccountLink = require('../../../../lib/account-link.js') const genAccountLink = require('../../../../lib/account-link.js')
const connect = require('../../../metamask-connect') const connect = require('react-redux').connect
const Dropdown = require('./dropdown').Dropdown const Dropdown = require('./dropdown').Dropdown
const DropdownMenuItem = require('./dropdown').DropdownMenuItem const DropdownMenuItem = require('./dropdown').DropdownMenuItem
const Identicon = require('../../identicon') const Identicon = require('../../identicon')
@ -130,7 +130,7 @@ class AccountDropdowns extends Component {
actions.showEditAccountModal(identity) actions.showEditAccountModal(identity)
}, },
}, [ }, [
this.props.t('edit'), this.context.t('edit'),
]), ]),
]), ]),
@ -144,7 +144,7 @@ class AccountDropdowns extends Component {
try { // Sometimes keyrings aren't loaded yet: try { // Sometimes keyrings aren't loaded yet:
const type = keyring.type const type = keyring.type
const isLoose = type !== 'HD Key Tree' const isLoose = type !== 'HD Key Tree'
return isLoose ? h('.keyring-label.allcaps', this.props.t('loose')) : null return isLoose ? h('.keyring-label.allcaps', this.context.t('loose')) : null
} catch (e) { return } } catch (e) { return }
} }
@ -202,7 +202,7 @@ class AccountDropdowns extends Component {
fontSize: '16px', fontSize: '16px',
lineHeight: '23px', lineHeight: '23px',
}, },
}, this.props.t('createAccount')), }, this.context.t('createAccount')),
], ],
), ),
h( h(
@ -236,7 +236,7 @@ class AccountDropdowns extends Component {
fontSize: '16px', fontSize: '16px',
lineHeight: '23px', lineHeight: '23px',
}, },
}, this.props.t('importAccount')), }, this.context.t('importAccount')),
] ]
), ),
] ]
@ -287,7 +287,7 @@ class AccountDropdowns extends Component {
menuItemStyles, menuItemStyles,
), ),
}, },
this.props.t('accountDetails'), this.context.t('accountDetails'),
), ),
h( h(
DropdownMenuItem, DropdownMenuItem,
@ -303,7 +303,7 @@ class AccountDropdowns extends Component {
menuItemStyles, menuItemStyles,
), ),
}, },
this.props.t('etherscanView'), this.context.t('etherscanView'),
), ),
h( h(
DropdownMenuItem, DropdownMenuItem,
@ -319,7 +319,7 @@ class AccountDropdowns extends Component {
menuItemStyles, menuItemStyles,
), ),
}, },
this.props.t('copyAddress'), this.context.t('copyAddress'),
), ),
h( h(
DropdownMenuItem, DropdownMenuItem,
@ -331,7 +331,7 @@ class AccountDropdowns extends Component {
menuItemStyles, menuItemStyles,
), ),
}, },
this.props.t('exportPrivateKey'), this.context.t('exportPrivateKey'),
), ),
h( h(
DropdownMenuItem, DropdownMenuItem,
@ -346,7 +346,7 @@ class AccountDropdowns extends Component {
menuItemStyles, menuItemStyles,
), ),
}, },
this.props.t('addToken'), this.context.t('addToken'),
), ),
] ]
@ -464,4 +464,9 @@ function mapStateToProps (state) {
} }
} }
AccountDropdowns.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps, mapDispatchToProps)(AccountDropdowns) module.exports = connect(mapStateToProps, mapDispatchToProps)(AccountDropdowns)

@ -1,7 +1,8 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('../../metamask-connect') const connect = require('react-redux').connect
const actions = require('../../actions') const actions = require('../../actions')
const Dropdown = require('./components/dropdown').Dropdown const Dropdown = require('./components/dropdown').Dropdown
const DropdownMenuItem = require('./components/dropdown').DropdownMenuItem const DropdownMenuItem = require('./components/dropdown').DropdownMenuItem
@ -54,8 +55,13 @@ function NetworkDropdown () {
Component.call(this) Component.call(this)
} }
NetworkDropdown.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps, mapDispatchToProps)(NetworkDropdown) module.exports = connect(mapStateToProps, mapDispatchToProps)(NetworkDropdown)
// TODO: specify default props and proptypes // TODO: specify default props and proptypes
NetworkDropdown.prototype.render = function () { NetworkDropdown.prototype.render = function () {
const props = this.props const props = this.props
@ -94,13 +100,13 @@ NetworkDropdown.prototype.render = function () {
}, [ }, [
h('div.network-dropdown-header', {}, [ h('div.network-dropdown-header', {}, [
h('div.network-dropdown-title', {}, this.props.t('networks')), h('div.network-dropdown-title', {}, this.context.t('networks')),
h('div.network-dropdown-divider'), h('div.network-dropdown-divider'),
h('div.network-dropdown-content', h('div.network-dropdown-content',
{}, {},
this.props.t('defaultNetwork') this.context.t('defaultNetwork')
), ),
]), ]),
@ -122,7 +128,7 @@ NetworkDropdown.prototype.render = function () {
style: { style: {
color: providerType === 'mainnet' ? '#ffffff' : '#9b9b9b', color: providerType === 'mainnet' ? '#ffffff' : '#9b9b9b',
}, },
}, this.props.t('mainnet')), }, this.context.t('mainnet')),
] ]
), ),
@ -144,7 +150,7 @@ NetworkDropdown.prototype.render = function () {
style: { style: {
color: providerType === 'ropsten' ? '#ffffff' : '#9b9b9b', color: providerType === 'ropsten' ? '#ffffff' : '#9b9b9b',
}, },
}, this.props.t('ropsten')), }, this.context.t('ropsten')),
] ]
), ),
@ -166,7 +172,7 @@ NetworkDropdown.prototype.render = function () {
style: { style: {
color: providerType === 'kovan' ? '#ffffff' : '#9b9b9b', color: providerType === 'kovan' ? '#ffffff' : '#9b9b9b',
}, },
}, this.props.t('kovan')), }, this.context.t('kovan')),
] ]
), ),
@ -188,7 +194,7 @@ NetworkDropdown.prototype.render = function () {
style: { style: {
color: providerType === 'rinkeby' ? '#ffffff' : '#9b9b9b', color: providerType === 'rinkeby' ? '#ffffff' : '#9b9b9b',
}, },
}, this.props.t('rinkeby')), }, this.context.t('rinkeby')),
] ]
), ),
@ -210,7 +216,7 @@ NetworkDropdown.prototype.render = function () {
style: { style: {
color: activeNetwork === 'http://localhost:8545' ? '#ffffff' : '#9b9b9b', color: activeNetwork === 'http://localhost:8545' ? '#ffffff' : '#9b9b9b',
}, },
}, this.props.t('localhost')), }, this.context.t('localhost')),
] ]
), ),
@ -234,7 +240,7 @@ NetworkDropdown.prototype.render = function () {
style: { style: {
color: activeNetwork === 'custom' ? '#ffffff' : '#9b9b9b', color: activeNetwork === 'custom' ? '#ffffff' : '#9b9b9b',
}, },
}, this.props.t('customRPC')), }, this.context.t('customRPC')),
] ]
), ),
@ -249,15 +255,15 @@ NetworkDropdown.prototype.getNetworkName = function () {
let name let name
if (providerName === 'mainnet') { if (providerName === 'mainnet') {
name = this.props.t('mainnet') name = this.context.t('mainnet')
} else if (providerName === 'ropsten') { } else if (providerName === 'ropsten') {
name = this.props.t('ropsten') name = this.context.t('ropsten')
} else if (providerName === 'kovan') { } else if (providerName === 'kovan') {
name = this.props.t('kovan') name = this.context.t('kovan')
} else if (providerName === 'rinkeby') { } else if (providerName === 'rinkeby') {
name = this.props.t('rinkeby') name = this.context.t('rinkeby')
} else { } else {
name = this.props.t('unknownNetwork') name = this.context.t('unknownNetwork')
} }
return name return name

@ -1,12 +1,18 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('../../metamask-connect') const connect = require('react-redux').connect
const actions = require('../../actions') const actions = require('../../actions')
TokenMenuDropdown.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(null, mapDispatchToProps)(TokenMenuDropdown) module.exports = connect(null, mapDispatchToProps)(TokenMenuDropdown)
function mapDispatchToProps (dispatch) { function mapDispatchToProps (dispatch) {
return { return {
showHideTokenConfirmationModal: (token) => { showHideTokenConfirmationModal: (token) => {
@ -44,7 +50,7 @@ TokenMenuDropdown.prototype.render = function () {
showHideTokenConfirmationModal(this.props.token) showHideTokenConfirmationModal(this.props.token)
this.props.onClose() this.props.onClose()
}, },
}, this.props.t('hideToken')), }, this.context.t('hideToken')),
]), ]),
]), ]),

@ -1,4 +1,5 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const extend = require('xtend') const extend = require('xtend')
@ -8,11 +9,16 @@ const ENS = require('ethjs-ens')
const networkMap = require('ethjs-ens/lib/network-map.json') const networkMap = require('ethjs-ens/lib/network-map.json')
const ensRE = /.+\..+$/ const ensRE = /.+\..+$/
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000' const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'
const connect = require('../metamask-connect') const connect = require('react-redux').connect
const ToAutoComplete = require('./send/to-autocomplete') const ToAutoComplete = require('./send/to-autocomplete')
EnsInput.contextTypes = {
t: PropTypes.func,
}
module.exports = connect()(EnsInput) module.exports = connect()(EnsInput)
inherits(EnsInput, Component) inherits(EnsInput, Component)
function EnsInput () { function EnsInput () {
Component.call(this) Component.call(this)
@ -70,13 +76,13 @@ EnsInput.prototype.lookupEnsName = function (recipient) {
log.info(`ENS attempting to resolve name: ${recipient}`) log.info(`ENS attempting to resolve name: ${recipient}`)
this.ens.lookup(recipient.trim()) this.ens.lookup(recipient.trim())
.then((address) => { .then((address) => {
if (address === ZERO_ADDRESS) throw new Error(this.props.t('noAddressForName')) if (address === ZERO_ADDRESS) throw new Error(this.context.t('noAddressForName'))
if (address !== ensResolution) { if (address !== ensResolution) {
this.setState({ this.setState({
loadingEns: false, loadingEns: false,
ensResolution: address, ensResolution: address,
nickname: recipient.trim(), nickname: recipient.trim(),
hoverText: address + '\n' + this.props.t('clickCopy'), hoverText: address + '\n' + this.context.t('clickCopy'),
ensFailure: false, ensFailure: false,
}) })
} }

@ -1,13 +1,19 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const ethUtil = require('ethereumjs-util') const ethUtil = require('ethereumjs-util')
const BN = ethUtil.BN const BN = ethUtil.BN
const extend = require('xtend') const extend = require('xtend')
const connect = require('../metamask-connect') const connect = require('react-redux').connect
HexAsDecimalInput.contextTypes = {
t: PropTypes.func,
}
module.exports = connect()(HexAsDecimalInput) module.exports = connect()(HexAsDecimalInput)
inherits(HexAsDecimalInput, Component) inherits(HexAsDecimalInput, Component)
function HexAsDecimalInput () { function HexAsDecimalInput () {
this.state = { invalid: null } this.state = { invalid: null }
@ -127,13 +133,13 @@ HexAsDecimalInput.prototype.constructWarning = function () {
let message = name ? name + ' ' : '' let message = name ? name + ' ' : ''
if (min && max) { if (min && max) {
message += this.props.t('betweenMinAndMax', [min, max]) message += this.context.t('betweenMinAndMax', [min, max])
} else if (min) { } else if (min) {
message += this.props.t('greaterThanMin', [min]) message += this.context.t('greaterThanMin', [min])
} else if (max) { } else if (max) {
message += this.props.t('lessThanMax', [max]) message += this.context.t('lessThanMax', [max])
} else { } else {
message += this.props.t('invalidInput') message += this.context.t('invalidInput')
} }
return message return message

@ -1,7 +1,7 @@
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('../metamask-connect') const connect = require('react-redux').connect
const isNode = require('detect-node') const isNode = require('detect-node')
const findDOMNode = require('react-dom').findDOMNode const findDOMNode = require('react-dom').findDOMNode
const jazzicon = require('jazzicon') const jazzicon = require('jazzicon')

@ -1,7 +1,8 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('../../metamask-connect') const connect = require('react-redux').connect
const actions = require('../../actions') const actions = require('../../actions')
const AccountModalContainer = require('./account-modal-container') const AccountModalContainer = require('./account-modal-container')
const { getSelectedIdentity } = require('../../selectors') const { getSelectedIdentity } = require('../../selectors')
@ -33,8 +34,13 @@ function AccountDetailsModal () {
Component.call(this) Component.call(this)
} }
AccountDetailsModal.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps, mapDispatchToProps)(AccountDetailsModal) module.exports = connect(mapStateToProps, mapDispatchToProps)(AccountDetailsModal)
// Not yet pixel perfect todos: // Not yet pixel perfect todos:
// fonts of qr-header // fonts of qr-header
@ -64,12 +70,12 @@ AccountDetailsModal.prototype.render = function () {
h('button.btn-primary.account-modal__button', { h('button.btn-primary.account-modal__button', {
onClick: () => global.platform.openWindow({ url: genAccountLink(address, network) }), onClick: () => global.platform.openWindow({ url: genAccountLink(address, network) }),
}, this.props.t('etherscanView')), }, this.context.t('etherscanView')),
// Holding on redesign for Export Private Key functionality // Holding on redesign for Export Private Key functionality
h('button.btn-primary.account-modal__button', { h('button.btn-primary.account-modal__button', {
onClick: () => showExportPrivateKeyModal(), onClick: () => showExportPrivateKeyModal(),
}, this.props.t('exportPrivateKey')), }, this.context.t('exportPrivateKey')),
]) ])
} }

@ -1,7 +1,8 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('../../metamask-connect') const connect = require('react-redux').connect
const actions = require('../../actions') const actions = require('../../actions')
const { getSelectedIdentity } = require('../../selectors') const { getSelectedIdentity } = require('../../selectors')
const Identicon = require('../identicon') const Identicon = require('../identicon')
@ -25,8 +26,13 @@ function AccountModalContainer () {
Component.call(this) Component.call(this)
} }
AccountModalContainer.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps, mapDispatchToProps)(AccountModalContainer) module.exports = connect(mapStateToProps, mapDispatchToProps)(AccountModalContainer)
AccountModalContainer.prototype.render = function () { AccountModalContainer.prototype.render = function () {
const { const {
selectedIdentity, selectedIdentity,
@ -59,7 +65,7 @@ AccountModalContainer.prototype.render = function () {
h('i.fa.fa-angle-left.fa-lg'), h('i.fa.fa-angle-left.fa-lg'),
h('span.account-modal-back__text', ' ' + this.props.t('back')), h('span.account-modal-back__text', ' ' + this.context.t('back')),
]), ]),

@ -1,7 +1,8 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('../../metamask-connect') const connect = require('react-redux').connect
const actions = require('../../actions') const actions = require('../../actions')
const networkNames = require('../../../../app/scripts/config.js').networkNames const networkNames = require('../../../../app/scripts/config.js').networkNames
@ -32,8 +33,13 @@ function BuyOptions () {
Component.call(this) Component.call(this)
} }
BuyOptions.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps, mapDispatchToProps)(BuyOptions) module.exports = connect(mapStateToProps, mapDispatchToProps)(BuyOptions)
BuyOptions.prototype.renderModalContentOption = function (title, header, onClick) { BuyOptions.prototype.renderModalContentOption = function (title, header, onClick) {
return h('div.buy-modal-content-option', { return h('div.buy-modal-content-option', {
onClick, onClick,
@ -56,15 +62,15 @@ BuyOptions.prototype.render = function () {
}, [ }, [
h('div.buy-modal-content-title', { h('div.buy-modal-content-title', {
style: {}, style: {},
}, this.props.t('transfers')), }, this.context.t('transfers')),
h('div', {}, this.props.t('howToDeposit')), h('div', {}, this.context.t('howToDeposit')),
]), ]),
h('div.buy-modal-content-options.flex-column.flex-center', {}, [ h('div.buy-modal-content-options.flex-column.flex-center', {}, [
isTestNetwork isTestNetwork
? this.renderModalContentOption(networkName, this.props.t('testFaucet'), () => toFaucet(network)) ? this.renderModalContentOption(networkName, this.context.t('testFaucet'), () => toFaucet(network))
: this.renderModalContentOption('Coinbase', this.props.t('depositFiat'), () => toCoinbase(address)), : this.renderModalContentOption('Coinbase', this.context.t('depositFiat'), () => toCoinbase(address)),
// h('div.buy-modal-content-option', {}, [ // h('div.buy-modal-content-option', {}, [
// h('div.buy-modal-content-option-title', {}, 'Shapeshift'), // h('div.buy-modal-content-option-title', {}, 'Shapeshift'),
@ -72,8 +78,8 @@ BuyOptions.prototype.render = function () {
// ]),, // ]),,
this.renderModalContentOption( this.renderModalContentOption(
this.props.t('directDeposit'), this.context.t('directDeposit'),
this.props.t('depositFromAccount'), this.context.t('depositFromAccount'),
() => this.goToAccountDetailsModal() () => this.goToAccountDetailsModal()
), ),
@ -84,7 +90,7 @@ BuyOptions.prototype.render = function () {
background: 'white', background: 'white',
}, },
onClick: () => { this.props.hideModal() }, onClick: () => { this.props.hideModal() },
}, h('div.buy-modal-content-footer#buy-modal-content-footer-text', {}, this.props.t('cancel'))), }, h('div.buy-modal-content-footer#buy-modal-content-footer-text', {}, this.context.t('cancel'))),
]), ]),
]) ])
} }

@ -1,7 +1,8 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('../../metamask-connect') const connect = require('react-redux').connect
const actions = require('../../actions') const actions = require('../../actions')
const networkNames = require('../../../../app/scripts/config.js').networkNames const networkNames = require('../../../../app/scripts/config.js').networkNames
const ShapeshiftForm = require('../shapeshift-form') const ShapeshiftForm = require('../shapeshift-form')
@ -40,27 +41,32 @@ function mapDispatchToProps (dispatch) {
} }
inherits(DepositEtherModal, Component) inherits(DepositEtherModal, Component)
function DepositEtherModal (props) { function DepositEtherModal (props, context) {
Component.call(this) Component.call(this)
// need to set after i18n locale has loaded // need to set after i18n locale has loaded
DIRECT_DEPOSIT_ROW_TITLE = props.t('directDepositEther') DIRECT_DEPOSIT_ROW_TITLE = context.t('directDepositEther')
DIRECT_DEPOSIT_ROW_TEXT = props.t('directDepositEtherExplainer') DIRECT_DEPOSIT_ROW_TEXT = context.t('directDepositEtherExplainer')
COINBASE_ROW_TITLE = props.t('buyCoinbase') COINBASE_ROW_TITLE = context.t('buyCoinbase')
COINBASE_ROW_TEXT = props.t('buyCoinbaseExplainer') COINBASE_ROW_TEXT = context.t('buyCoinbaseExplainer')
SHAPESHIFT_ROW_TITLE = props.t('depositShapeShift') SHAPESHIFT_ROW_TITLE = context.t('depositShapeShift')
SHAPESHIFT_ROW_TEXT = props.t('depositShapeShiftExplainer') SHAPESHIFT_ROW_TEXT = context.t('depositShapeShiftExplainer')
FAUCET_ROW_TITLE = props.t('testFaucet') FAUCET_ROW_TITLE = context.t('testFaucet')
this.state = { this.state = {
buyingWithShapeshift: false, buyingWithShapeshift: false,
} }
} }
DepositEtherModal.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps, mapDispatchToProps)(DepositEtherModal) module.exports = connect(mapStateToProps, mapDispatchToProps)(DepositEtherModal)
DepositEtherModal.prototype.facuetRowText = function (networkName) { DepositEtherModal.prototype.facuetRowText = function (networkName) {
return this.props.t('getEtherFromFaucet', [networkName]) return this.context.t('getEtherFromFaucet', [networkName])
} }
DepositEtherModal.prototype.renderRow = function ({ DepositEtherModal.prototype.renderRow = function ({
@ -122,10 +128,10 @@ DepositEtherModal.prototype.render = function () {
h('div.page-container__header', [ h('div.page-container__header', [
h('div.page-container__title', [this.props.t('depositEther')]), h('div.page-container__title', [this.context.t('depositEther')]),
h('div.page-container__subtitle', [ h('div.page-container__subtitle', [
this.props.t('needEtherInWallet'), this.context.t('needEtherInWallet'),
]), ]),
h('div.page-container__header-close', { h('div.page-container__header-close', {
@ -148,7 +154,7 @@ DepositEtherModal.prototype.render = function () {
}), }),
title: DIRECT_DEPOSIT_ROW_TITLE, title: DIRECT_DEPOSIT_ROW_TITLE,
text: DIRECT_DEPOSIT_ROW_TEXT, text: DIRECT_DEPOSIT_ROW_TEXT,
buttonLabel: this.props.t('viewAccount'), buttonLabel: this.context.t('viewAccount'),
onButtonClick: () => this.goToAccountDetailsModal(), onButtonClick: () => this.goToAccountDetailsModal(),
hide: buyingWithShapeshift, hide: buyingWithShapeshift,
}), }),
@ -157,7 +163,7 @@ DepositEtherModal.prototype.render = function () {
logo: h('i.fa.fa-tint.fa-2x'), logo: h('i.fa.fa-tint.fa-2x'),
title: FAUCET_ROW_TITLE, title: FAUCET_ROW_TITLE,
text: this.facuetRowText(networkName), text: this.facuetRowText(networkName),
buttonLabel: this.props.t('getEther'), buttonLabel: this.context.t('getEther'),
onButtonClick: () => toFaucet(network), onButtonClick: () => toFaucet(network),
hide: !isTestNetwork || buyingWithShapeshift, hide: !isTestNetwork || buyingWithShapeshift,
}), }),
@ -171,7 +177,7 @@ DepositEtherModal.prototype.render = function () {
}), }),
title: COINBASE_ROW_TITLE, title: COINBASE_ROW_TITLE,
text: COINBASE_ROW_TEXT, text: COINBASE_ROW_TEXT,
buttonLabel: this.props.t('continueToCoinbase'), buttonLabel: this.context.t('continueToCoinbase'),
onButtonClick: () => toCoinbase(address), onButtonClick: () => toCoinbase(address),
hide: isTestNetwork || buyingWithShapeshift, hide: isTestNetwork || buyingWithShapeshift,
}), }),
@ -184,7 +190,7 @@ DepositEtherModal.prototype.render = function () {
}), }),
title: SHAPESHIFT_ROW_TITLE, title: SHAPESHIFT_ROW_TITLE,
text: SHAPESHIFT_ROW_TEXT, text: SHAPESHIFT_ROW_TEXT,
buttonLabel: this.props.t('shapeshiftBuy'), buttonLabel: this.context.t('shapeshiftBuy'),
onButtonClick: () => this.setState({ buyingWithShapeshift: true }), onButtonClick: () => this.setState({ buyingWithShapeshift: true }),
hide: isTestNetwork, hide: isTestNetwork,
hideButton: buyingWithShapeshift, hideButton: buyingWithShapeshift,

@ -1,7 +1,8 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('../../metamask-connect') const connect = require('react-redux').connect
const actions = require('../../actions') const actions = require('../../actions')
const { getSelectedAccount } = require('../../selectors') const { getSelectedAccount } = require('../../selectors')
@ -32,8 +33,13 @@ function EditAccountNameModal (props) {
} }
} }
EditAccountNameModal.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps, mapDispatchToProps)(EditAccountNameModal) module.exports = connect(mapStateToProps, mapDispatchToProps)(EditAccountNameModal)
EditAccountNameModal.prototype.render = function () { EditAccountNameModal.prototype.render = function () {
const { hideModal, saveAccountLabel, identity } = this.props const { hideModal, saveAccountLabel, identity } = this.props
@ -50,7 +56,7 @@ EditAccountNameModal.prototype.render = function () {
]), ]),
h('div.edit-account-name-modal-title', { h('div.edit-account-name-modal-title', {
}, [this.props.t('editAccountName')]), }, [this.context.t('editAccountName')]),
h('input.edit-account-name-modal-input', { h('input.edit-account-name-modal-input', {
placeholder: identity.name, placeholder: identity.name,
@ -69,7 +75,7 @@ EditAccountNameModal.prototype.render = function () {
}, },
disabled: this.state.inputText.length === 0, disabled: this.state.inputText.length === 0,
}, [ }, [
this.props.t('save'), this.context.t('save'),
]), ]),
]), ]),

@ -1,7 +1,8 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('../../metamask-connect') const connect = require('react-redux').connect
const ethUtil = require('ethereumjs-util') const ethUtil = require('ethereumjs-util')
const actions = require('../../actions') const actions = require('../../actions')
const AccountModalContainer = require('./account-modal-container') const AccountModalContainer = require('./account-modal-container')
@ -37,8 +38,13 @@ function ExportPrivateKeyModal () {
} }
} }
ExportPrivateKeyModal.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps, mapDispatchToProps)(ExportPrivateKeyModal) module.exports = connect(mapStateToProps, mapDispatchToProps)(ExportPrivateKeyModal)
ExportPrivateKeyModal.prototype.exportAccountAndGetPrivateKey = function (password, address) { ExportPrivateKeyModal.prototype.exportAccountAndGetPrivateKey = function (password, address) {
const { exportAccount } = this.props const { exportAccount } = this.props
@ -48,8 +54,8 @@ ExportPrivateKeyModal.prototype.exportAccountAndGetPrivateKey = function (passwo
ExportPrivateKeyModal.prototype.renderPasswordLabel = function (privateKey) { ExportPrivateKeyModal.prototype.renderPasswordLabel = function (privateKey) {
return h('span.private-key-password-label', privateKey return h('span.private-key-password-label', privateKey
? this.props.t('copyPrivateKey') ? this.context.t('copyPrivateKey')
: this.props.t('typePassword') : this.context.t('typePassword')
) )
} }
@ -86,8 +92,8 @@ ExportPrivateKeyModal.prototype.renderButtons = function (privateKey, password,
), ),
(privateKey (privateKey
? this.renderButton('btn-primary--lg export-private-key__button', () => hideModal(), this.props.t('done')) ? this.renderButton('btn-primary--lg export-private-key__button', () => hideModal(), this.context.t('done'))
: this.renderButton('btn-primary--lg export-private-key__button', () => this.exportAccountAndGetPrivateKey(this.state.password, address), this.props.t('confirm')) : this.renderButton('btn-primary--lg export-private-key__button', () => this.exportAccountAndGetPrivateKey(this.state.password, address), this.context.t('confirm'))
), ),
]) ])
@ -120,7 +126,7 @@ ExportPrivateKeyModal.prototype.render = function () {
h('div.account-modal-divider'), h('div.account-modal-divider'),
h('span.modal-body-title', this.props.t('showPrivateKeys')), h('span.modal-body-title', this.context.t('showPrivateKeys')),
h('div.private-key-password', {}, [ h('div.private-key-password', {}, [
this.renderPasswordLabel(privateKey), this.renderPasswordLabel(privateKey),
@ -130,7 +136,7 @@ ExportPrivateKeyModal.prototype.render = function () {
!warning ? null : h('span.private-key-password-error', warning), !warning ? null : h('span.private-key-password-error', warning),
]), ]),
h('div.private-key-password-warning', this.props.t('privateKeyWarning')), h('div.private-key-password-warning', this.context.t('privateKeyWarning')),
this.renderButtons(privateKey, this.state.password, address, hideModal), this.renderButtons(privateKey, this.state.password, address, hideModal),

@ -1,7 +1,8 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('../../metamask-connect') const connect = require('react-redux').connect
const actions = require('../../actions') const actions = require('../../actions')
const Identicon = require('../identicon') const Identicon = require('../identicon')
@ -31,8 +32,13 @@ function HideTokenConfirmationModal () {
this.state = {} this.state = {}
} }
HideTokenConfirmationModal.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps, mapDispatchToProps)(HideTokenConfirmationModal) module.exports = connect(mapStateToProps, mapDispatchToProps)(HideTokenConfirmationModal)
HideTokenConfirmationModal.prototype.render = function () { HideTokenConfirmationModal.prototype.render = function () {
const { token, network, hideToken, hideModal } = this.props const { token, network, hideToken, hideModal } = this.props
const { symbol, address } = token const { symbol, address } = token
@ -41,7 +47,7 @@ HideTokenConfirmationModal.prototype.render = function () {
h('div.hide-token-confirmation__container', { h('div.hide-token-confirmation__container', {
}, [ }, [
h('div.hide-token-confirmation__title', {}, [ h('div.hide-token-confirmation__title', {}, [
this.props.t('hideTokenPrompt'), this.context.t('hideTokenPrompt'),
]), ]),
h(Identicon, { h(Identicon, {
@ -54,19 +60,19 @@ HideTokenConfirmationModal.prototype.render = function () {
h('div.hide-token-confirmation__symbol', {}, symbol), h('div.hide-token-confirmation__symbol', {}, symbol),
h('div.hide-token-confirmation__copy', {}, [ h('div.hide-token-confirmation__copy', {}, [
this.props.t('readdToken'), this.context.t('readdToken'),
]), ]),
h('div.hide-token-confirmation__buttons', {}, [ h('div.hide-token-confirmation__buttons', {}, [
h('button.btn-cancel.hide-token-confirmation__button.allcaps', { h('button.btn-cancel.hide-token-confirmation__button.allcaps', {
onClick: () => hideModal(), onClick: () => hideModal(),
}, [ }, [
this.props.t('cancel'), this.context.t('cancel'),
]), ]),
h('button.btn-clear.hide-token-confirmation__button.allcaps', { h('button.btn-clear.hide-token-confirmation__button.allcaps', {
onClick: () => hideToken(address), onClick: () => hideToken(address),
}, [ }, [
this.props.t('hide'), this.context.t('hide'),
]), ]),
]), ]),
]), ]),

@ -1,7 +1,7 @@
const { Component } = require('react') const { Component } = require('react')
const PropTypes = require('prop-types') const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const connect = require('../../metamask-connect') const connect = require('react-redux').connect
const actions = require('../../actions') const actions = require('../../actions')
class NewAccountModal extends Component { class NewAccountModal extends Component {
@ -11,7 +11,7 @@ class NewAccountModal extends Component {
const newAccountNumber = numberOfExistingAccounts + 1 const newAccountNumber = numberOfExistingAccounts + 1
this.state = { this.state = {
newAccountName: `${props.t('account')} ${newAccountNumber}`, newAccountName: `${this.context.t('account')} ${newAccountNumber}`,
} }
} }
@ -22,7 +22,7 @@ class NewAccountModal extends Component {
h('div.new-account-modal-wrapper', { h('div.new-account-modal-wrapper', {
}, [ }, [
h('div.new-account-modal-header', {}, [ h('div.new-account-modal-header', {}, [
this.props.t('newAccount'), this.context.t('newAccount'),
]), ]),
h('div.modal-close-x', { h('div.modal-close-x', {
@ -30,19 +30,19 @@ class NewAccountModal extends Component {
}), }),
h('div.new-account-modal-content', {}, [ h('div.new-account-modal-content', {}, [
this.props.t('accountName'), this.context.t('accountName'),
]), ]),
h('div.new-account-input-wrapper', {}, [ h('div.new-account-input-wrapper', {}, [
h('input.new-account-input', { h('input.new-account-input', {
value: this.state.newAccountName, value: this.state.newAccountName,
placeholder: this.props.t('sampleAccountName'), placeholder: this.context.t('sampleAccountName'),
onChange: event => this.setState({ newAccountName: event.target.value }), onChange: event => this.setState({ newAccountName: event.target.value }),
}, []), }, []),
]), ]),
h('div.new-account-modal-content.after-input', {}, [ h('div.new-account-modal-content.after-input', {}, [
this.props.t('or'), this.context.t('or'),
]), ]),
h('div.new-account-modal-content.after-input.pointer', { h('div.new-account-modal-content.after-input.pointer', {
@ -50,13 +50,13 @@ class NewAccountModal extends Component {
this.props.hideModal() this.props.hideModal()
this.props.showImportPage() this.props.showImportPage()
}, },
}, this.props.t('importAnAccount')), }, this.context.t('importAnAccount')),
h('div.new-account-modal-content.button.allcaps', {}, [ h('div.new-account-modal-content.button.allcaps', {}, [
h('button.btn-clear', { h('button.btn-clear', {
onClick: () => this.props.createAccount(newAccountName), onClick: () => this.props.createAccount(newAccountName),
}, [ }, [
this.props.t('save'), this.context.t('save'),
]), ]),
]), ]),
]), ]),
@ -104,4 +104,9 @@ const mapDispatchToProps = dispatch => {
} }
} }
NewAccountModal.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps, mapDispatchToProps)(NewAccountModal) module.exports = connect(mapStateToProps, mapDispatchToProps)(NewAccountModal)

@ -1,7 +1,7 @@
const { Component } = require('react') const { Component } = require('react')
const PropTypes = require('prop-types') const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const connect = require('../../metamask-connect') const connect = require('react-redux').connect
const actions = require('../../actions') const actions = require('../../actions')
class NotificationModal extends Component { class NotificationModal extends Component {
@ -22,12 +22,12 @@ class NotificationModal extends Component {
}, [ }, [
h('div.notification-modal__header', {}, [ h('div.notification-modal__header', {}, [
this.props.t(header), this.context.t(header),
]), ]),
h('div.notification-modal__message-wrapper', {}, [ h('div.notification-modal__message-wrapper', {}, [
h('div.notification-modal__message', {}, [ h('div.notification-modal__message', {}, [
this.props.t(message), this.context.t(message),
]), ]),
]), ]),
@ -73,4 +73,9 @@ const mapDispatchToProps = dispatch => {
} }
} }
NotificationModal.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(null, mapDispatchToProps)(NotificationModal) module.exports = connect(null, mapDispatchToProps)(NotificationModal)

@ -1,7 +1,7 @@
const { Component } = require('react') const { Component } = require('react')
const PropTypes = require('prop-types') const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const connect = require('../../../metamask-connect') const connect = require('react-redux').connect
const actions = require('../../../actions') const actions = require('../../../actions')
const NotifcationModal = require('../notification-modal') const NotifcationModal = require('../notification-modal')

@ -1,7 +1,7 @@
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('../../metamask-connect') const connect = require('react-redux').connect
const actions = require('../../actions') const actions = require('../../actions')
const QrView = require('../qr-code') const QrView = require('../qr-code')
const AccountModalContainer = require('./account-modal-container') const AccountModalContainer = require('./account-modal-container')

@ -1,7 +1,7 @@
const { Component } = require('react') const { Component } = require('react')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const PropTypes = require('prop-types') const PropTypes = require('prop-types')
const connect = require('../metamask-connect') const connect = require('react-redux').connect
const NetworkDropdownIcon = require('./dropdowns/components/network-dropdown-icon') const NetworkDropdownIcon = require('./dropdowns/components/network-dropdown-icon')
const networkToColorHash = { const networkToColorHash = {
@ -30,7 +30,7 @@ class NetworkDisplay extends Component {
const { provider: { type } } = this.props const { provider: { type } } = this.props
return h('.network-display__container', [ return h('.network-display__container', [
this.renderNetworkIcon(), this.renderNetworkIcon(),
h('.network-name', this.props.t(type)), h('.network-name', this.context.t(type)),
]) ])
} }
} }
@ -48,4 +48,9 @@ const mapStateToProps = ({ metamask: { network, provider } }) => {
} }
} }
NetworkDisplay.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps)(NetworkDisplay) module.exports = connect(mapStateToProps)(NetworkDisplay)

@ -1,12 +1,18 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const connect = require('../metamask-connect') const connect = require('react-redux').connect
const classnames = require('classnames') const classnames = require('classnames')
const inherits = require('util').inherits const inherits = require('util').inherits
const NetworkDropdownIcon = require('./dropdowns/components/network-dropdown-icon') const NetworkDropdownIcon = require('./dropdowns/components/network-dropdown-icon')
Network.contextTypes = {
t: PropTypes.func,
}
module.exports = connect()(Network) module.exports = connect()(Network)
inherits(Network, Component) inherits(Network, Component)
function Network () { function Network () {
@ -15,6 +21,7 @@ function Network () {
Network.prototype.render = function () { Network.prototype.render = function () {
const props = this.props const props = this.props
const context = this.context
const networkNumber = props.network const networkNumber = props.network
let providerName let providerName
try { try {
@ -34,7 +41,7 @@ Network.prototype.render = function () {
onClick: (event) => this.props.onClick(event), onClick: (event) => this.props.onClick(event),
}, [ }, [
h('img', { h('img', {
title: props.t('attemptingConnect'), title: context.t('attemptingConnect'),
style: { style: {
width: '27px', width: '27px',
}, },
@ -42,22 +49,22 @@ Network.prototype.render = function () {
}), }),
]) ])
} else if (providerName === 'mainnet') { } else if (providerName === 'mainnet') {
hoverText = props.t('mainnet') hoverText = context.t('mainnet')
iconName = 'ethereum-network' iconName = 'ethereum-network'
} else if (providerName === 'ropsten') { } else if (providerName === 'ropsten') {
hoverText = props.t('ropsten') hoverText = context.t('ropsten')
iconName = 'ropsten-test-network' iconName = 'ropsten-test-network'
} else if (parseInt(networkNumber) === 3) { } else if (parseInt(networkNumber) === 3) {
hoverText = props.t('ropsten') hoverText = context.t('ropsten')
iconName = 'ropsten-test-network' iconName = 'ropsten-test-network'
} else if (providerName === 'kovan') { } else if (providerName === 'kovan') {
hoverText = props.t('kovan') hoverText = context.t('kovan')
iconName = 'kovan-test-network' iconName = 'kovan-test-network'
} else if (providerName === 'rinkeby') { } else if (providerName === 'rinkeby') {
hoverText = props.t('rinkeby') hoverText = context.t('rinkeby')
iconName = 'rinkeby-test-network' iconName = 'rinkeby-test-network'
} else { } else {
hoverText = props.t('unknownNetwork') hoverText = context.t('unknownNetwork')
iconName = 'unknown-private-network' iconName = 'unknown-private-network'
} }
@ -85,7 +92,7 @@ Network.prototype.render = function () {
backgroundColor: '#038789', // $blue-lagoon backgroundColor: '#038789', // $blue-lagoon
nonSelectBackgroundColor: '#15afb2', nonSelectBackgroundColor: '#15afb2',
}), }),
h('.network-name', props.t('mainnet')), h('.network-name', context.t('mainnet')),
h('i.fa.fa-chevron-down.fa-lg.network-caret'), h('i.fa.fa-chevron-down.fa-lg.network-caret'),
]) ])
case 'ropsten-test-network': case 'ropsten-test-network':
@ -94,7 +101,7 @@ Network.prototype.render = function () {
backgroundColor: '#e91550', // $crimson backgroundColor: '#e91550', // $crimson
nonSelectBackgroundColor: '#ec2c50', nonSelectBackgroundColor: '#ec2c50',
}), }),
h('.network-name', props.t('ropsten')), h('.network-name', context.t('ropsten')),
h('i.fa.fa-chevron-down.fa-lg.network-caret'), h('i.fa.fa-chevron-down.fa-lg.network-caret'),
]) ])
case 'kovan-test-network': case 'kovan-test-network':
@ -103,7 +110,7 @@ Network.prototype.render = function () {
backgroundColor: '#690496', // $purple backgroundColor: '#690496', // $purple
nonSelectBackgroundColor: '#b039f3', nonSelectBackgroundColor: '#b039f3',
}), }),
h('.network-name', props.t('kovan')), h('.network-name', context.t('kovan')),
h('i.fa.fa-chevron-down.fa-lg.network-caret'), h('i.fa.fa-chevron-down.fa-lg.network-caret'),
]) ])
case 'rinkeby-test-network': case 'rinkeby-test-network':
@ -112,7 +119,7 @@ Network.prototype.render = function () {
backgroundColor: '#ebb33f', // $tulip-tree backgroundColor: '#ebb33f', // $tulip-tree
nonSelectBackgroundColor: '#ecb23e', nonSelectBackgroundColor: '#ecb23e',
}), }),
h('.network-name', props.t('rinkeby')), h('.network-name', context.t('rinkeby')),
h('i.fa.fa-chevron-down.fa-lg.network-caret'), h('i.fa.fa-chevron-down.fa-lg.network-caret'),
]) ])
default: default:
@ -124,7 +131,7 @@ Network.prototype.render = function () {
}, },
}), }),
h('.network-name', props.t('privateNetwork')), h('.network-name', context.t('privateNetwork')),
h('i.fa.fa-chevron-down.fa-lg.network-caret'), h('i.fa.fa-chevron-down.fa-lg.network-caret'),
]) ])
} }

@ -1,13 +1,19 @@
const inherits = require('util').inherits const inherits = require('util').inherits
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const ReactMarkdown = require('react-markdown') const ReactMarkdown = require('react-markdown')
const linker = require('extension-link-enabler') const linker = require('extension-link-enabler')
const findDOMNode = require('react-dom').findDOMNode const findDOMNode = require('react-dom').findDOMNode
const connect = require('../metamask-connect') const connect = require('react-redux').connect
Notice.contextTypes = {
t: PropTypes.func,
}
module.exports = connect()(Notice) module.exports = connect()(Notice)
inherits(Notice, Component) inherits(Notice, Component)
function Notice () { function Notice () {
Component.call(this) Component.call(this)
@ -111,7 +117,7 @@ Notice.prototype.render = function () {
style: { style: {
marginTop: '18px', marginTop: '18px',
}, },
}, this.props.t('accept')), }, this.context.t('accept')),
]) ])
) )
} }

@ -1,12 +1,18 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('../metamask-connect') const connect = require('react-redux').connect
const AccountPanel = require('./account-panel') const AccountPanel = require('./account-panel')
PendingMsgDetails.contextTypes = {
t: PropTypes.func,
}
module.exports = connect()(PendingMsgDetails) module.exports = connect()(PendingMsgDetails)
inherits(PendingMsgDetails, Component) inherits(PendingMsgDetails, Component)
function PendingMsgDetails () { function PendingMsgDetails () {
Component.call(this) Component.call(this)
@ -40,7 +46,7 @@ PendingMsgDetails.prototype.render = function () {
// message data // message data
h('.tx-data.flex-column.flex-justify-center.flex-grow.select-none', [ h('.tx-data.flex-column.flex-justify-center.flex-grow.select-none', [
h('.flex-column.flex-space-between', [ h('.flex-column.flex-space-between', [
h('label.font-small.allcaps', this.props.t('message')), h('label.font-small.allcaps', this.context.t('message')),
h('span.font-small', msgParams.data), h('span.font-small', msgParams.data),
]), ]),
]), ]),

@ -1,11 +1,17 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const PendingTxDetails = require('./pending-msg-details') const PendingTxDetails = require('./pending-msg-details')
const connect = require('../metamask-connect') const connect = require('react-redux').connect
PendingMsg.contextTypes = {
t: PropTypes.func,
}
module.exports = connect()(PendingMsg) module.exports = connect()(PendingMsg)
inherits(PendingMsg, Component) inherits(PendingMsg, Component)
function PendingMsg () { function PendingMsg () {
Component.call(this) Component.call(this)
@ -30,14 +36,14 @@ PendingMsg.prototype.render = function () {
fontWeight: 'bold', fontWeight: 'bold',
textAlign: 'center', textAlign: 'center',
}, },
}, this.props.t('signMessage')), }, this.context.t('signMessage')),
h('.error', { h('.error', {
style: { style: {
margin: '10px', margin: '10px',
}, },
}, [ }, [
this.props.t('signNotice'), this.context.t('signNotice'),
h('a', { h('a', {
href: 'https://medium.com/metamask/the-new-secure-way-to-sign-data-in-your-browser-6af9dd2a1527', href: 'https://medium.com/metamask/the-new-secure-way-to-sign-data-in-your-browser-6af9dd2a1527',
style: { color: 'rgb(247, 134, 28)' }, style: { color: 'rgb(247, 134, 28)' },
@ -46,7 +52,7 @@ PendingMsg.prototype.render = function () {
const url = 'https://medium.com/metamask/the-new-secure-way-to-sign-data-in-your-browser-6af9dd2a1527' const url = 'https://medium.com/metamask/the-new-secure-way-to-sign-data-in-your-browser-6af9dd2a1527'
global.platform.openWindow({ url }) global.platform.openWindow({ url })
}, },
}, this.props.t('readMore')), }, this.context.t('readMore')),
]), ]),
// message details // message details
@ -56,10 +62,10 @@ PendingMsg.prototype.render = function () {
h('.flex-row.flex-space-around', [ h('.flex-row.flex-space-around', [
h('button', { h('button', {
onClick: state.cancelMessage, onClick: state.cancelMessage,
}, this.props.t('cancel')), }, this.context.t('cancel')),
h('button', { h('button', {
onClick: state.signMessage, onClick: state.signMessage,
}, this.props.t('sign')), }, this.context.t('sign')),
]), ]),
]) ])

@ -1,5 +1,5 @@
const { Component } = require('react') const { Component } = require('react')
const connect = require('../../metamask-connect') const connect = require('react-redux').connect
const h = require('react-hyperscript') const h = require('react-hyperscript')
const PropTypes = require('prop-types') const PropTypes = require('prop-types')
const actions = require('../../actions') const actions = require('../../actions')
@ -32,7 +32,7 @@ class ConfirmDeployContract extends Component {
if (valid && this.verifyGasParams()) { if (valid && this.verifyGasParams()) {
this.props.sendTransaction(txMeta, event) this.props.sendTransaction(txMeta, event)
} else { } else {
this.props.displayWarning(this.props.t('invalidGasParams')) this.props.displayWarning(this.context.t('invalidGasParams'))
this.setState({ submitting: false }) this.setState({ submitting: false })
} }
} }
@ -177,7 +177,7 @@ class ConfirmDeployContract extends Component {
return ( return (
h('section.flex-row.flex-center.confirm-screen-row', [ h('section.flex-row.flex-center.confirm-screen-row', [
h('span.confirm-screen-label.confirm-screen-section-column', [ this.props.t('gasFee') ]), h('span.confirm-screen-label.confirm-screen-section-column', [ this.context.t('gasFee') ]),
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', `${fiatGas} ${currentCurrency.toUpperCase()}`), h('div.confirm-screen-row-info', `${fiatGas} ${currentCurrency.toUpperCase()}`),
@ -216,8 +216,8 @@ class ConfirmDeployContract extends Component {
return ( return (
h('section.flex-row.flex-center.confirm-screen-row.confirm-screen-total-box ', [ h('section.flex-row.flex-center.confirm-screen-row.confirm-screen-total-box ', [
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
h('span.confirm-screen-label', [ this.props.t('total') + ' ' ]), h('span.confirm-screen-label', [ this.context.t('total') + ' ' ]),
h('div.confirm-screen-total-box__subtitle', [ this.props.t('amountPlusGas') ]), h('div.confirm-screen-total-box__subtitle', [ this.context.t('amountPlusGas') ]),
]), ]),
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
@ -247,11 +247,11 @@ class ConfirmDeployContract extends Component {
h('.page-container__header-row', [ h('.page-container__header-row', [
h('span.page-container__back-button', { h('span.page-container__back-button', {
onClick: () => backToAccountDetail(selectedAddress), onClick: () => backToAccountDetail(selectedAddress),
}, this.props.t('back')), }, this.context.t('back')),
window.METAMASK_UI_TYPE === 'notification' && h(NetworkDisplay), window.METAMASK_UI_TYPE === 'notification' && h(NetworkDisplay),
]), ]),
h('.page-container__title', this.props.t('confirmContract')), h('.page-container__title', this.context.t('confirmContract')),
h('.page-container__subtitle', this.props.t('pleaseReviewTransaction')), h('.page-container__subtitle', this.context.t('pleaseReviewTransaction')),
]), ]),
// Main Send token Card // Main Send token Card
h('.page-container__content', [ h('.page-container__content', [
@ -274,7 +274,7 @@ class ConfirmDeployContract extends Component {
h('div.confirm-screen-rows', [ h('div.confirm-screen-rows', [
h('section.flex-row.flex-center.confirm-screen-row', [ h('section.flex-row.flex-center.confirm-screen-row', [
h('span.confirm-screen-label.confirm-screen-section-column', [ this.props.t('from') ]), h('span.confirm-screen-label.confirm-screen-section-column', [ this.context.t('from') ]),
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', fromName), h('div.confirm-screen-row-info', fromName),
h('div.confirm-screen-row-detail', `...${fromAddress.slice(fromAddress.length - 4)}`), h('div.confirm-screen-row-detail', `...${fromAddress.slice(fromAddress.length - 4)}`),
@ -282,9 +282,9 @@ class ConfirmDeployContract extends Component {
]), ]),
h('section.flex-row.flex-center.confirm-screen-row', [ h('section.flex-row.flex-center.confirm-screen-row', [
h('span.confirm-screen-label.confirm-screen-section-column', [ this.props.t('to') ]), h('span.confirm-screen-label.confirm-screen-section-column', [ this.context.t('to') ]),
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', this.props.t('newContract')), h('div.confirm-screen-row-info', this.context.t('newContract')),
]), ]),
]), ]),
@ -302,12 +302,12 @@ class ConfirmDeployContract extends Component {
// Cancel Button // Cancel Button
h('button.btn-cancel.page-container__footer-button.allcaps', { h('button.btn-cancel.page-container__footer-button.allcaps', {
onClick: event => this.cancel(event, txMeta), onClick: event => this.cancel(event, txMeta),
}, this.props.t('cancel')), }, this.context.t('cancel')),
// Accept Button // Accept Button
h('button.btn-confirm.page-container__footer-button.allcaps', { h('button.btn-confirm.page-container__footer-button.allcaps', {
onClick: event => this.onSubmit(event), onClick: event => this.onSubmit(event),
}, this.props.t('confirm')), }, this.context.t('confirm')),
]), ]),
]), ]),
]) ])
@ -351,4 +351,8 @@ const mapDispatchToProps = dispatch => {
} }
} }
ConfirmDeployContract.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps, mapDispatchToProps)(ConfirmDeployContract) module.exports = connect(mapStateToProps, mapDispatchToProps)(ConfirmDeployContract)

@ -1,5 +1,6 @@
const Component = require('react').Component const Component = require('react').Component
const connect = require('../../metamask-connect') const PropTypes = require('prop-types')
const connect = require('react-redux').connect
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const actions = require('../../actions') const actions = require('../../actions')
@ -18,8 +19,13 @@ const NetworkDisplay = require('../network-display')
const { MIN_GAS_PRICE_HEX } = require('../send/send-constants') const { MIN_GAS_PRICE_HEX } = require('../send/send-constants')
ConfirmSendEther.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps, mapDispatchToProps)(ConfirmSendEther) module.exports = connect(mapStateToProps, mapDispatchToProps)(ConfirmSendEther)
function mapStateToProps (state) { function mapStateToProps (state) {
const { const {
conversionRate, conversionRate,
@ -196,7 +202,7 @@ ConfirmSendEther.prototype.getData = function () {
}, },
to: { to: {
address: txParams.to, address: txParams.to,
name: identities[txParams.to] ? identities[txParams.to].name : this.props.t('newRecipient'), name: identities[txParams.to] ? identities[txParams.to].name : this.context.t('newRecipient'),
}, },
memo: txParams.memo || '', memo: txParams.memo || '',
gasFeeInFIAT, gasFeeInFIAT,
@ -297,7 +303,7 @@ ConfirmSendEther.prototype.render = function () {
h('div.confirm-screen-rows', [ h('div.confirm-screen-rows', [
h('section.flex-row.flex-center.confirm-screen-row', [ h('section.flex-row.flex-center.confirm-screen-row', [
h('span.confirm-screen-label.confirm-screen-section-column', [ this.props.t('from') ]), h('span.confirm-screen-label.confirm-screen-section-column', [ this.context.t('from') ]),
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', fromName), h('div.confirm-screen-row-info', fromName),
h('div.confirm-screen-row-detail', `...${fromAddress.slice(fromAddress.length - 4)}`), h('div.confirm-screen-row-detail', `...${fromAddress.slice(fromAddress.length - 4)}`),
@ -305,7 +311,7 @@ ConfirmSendEther.prototype.render = function () {
]), ]),
h('section.flex-row.flex-center.confirm-screen-row', [ h('section.flex-row.flex-center.confirm-screen-row', [
h('span.confirm-screen-label.confirm-screen-section-column', [ this.props.t('to') ]), h('span.confirm-screen-label.confirm-screen-section-column', [ this.context.t('to') ]),
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', toName), h('div.confirm-screen-row-info', toName),
h('div.confirm-screen-row-detail', `...${toAddress.slice(toAddress.length - 4)}`), h('div.confirm-screen-row-detail', `...${toAddress.slice(toAddress.length - 4)}`),
@ -313,7 +319,7 @@ ConfirmSendEther.prototype.render = function () {
]), ]),
h('section.flex-row.flex-center.confirm-screen-row', [ h('section.flex-row.flex-center.confirm-screen-row', [
h('span.confirm-screen-label.confirm-screen-section-column', [ this.props.t('gasFee') ]), h('span.confirm-screen-label.confirm-screen-section-column', [ this.context.t('gasFee') ]),
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
h(GasFeeDisplay, { h(GasFeeDisplay, {
gasTotal: gasTotal || gasFeeInHex, gasTotal: gasTotal || gasFeeInHex,
@ -326,8 +332,8 @@ ConfirmSendEther.prototype.render = function () {
h('section.flex-row.flex-center.confirm-screen-row.confirm-screen-total-box ', [ h('section.flex-row.flex-center.confirm-screen-row.confirm-screen-total-box ', [
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
h('span.confirm-screen-label', [ this.props.t('total') + ' ' ]), h('span.confirm-screen-label', [ this.context.t('total') + ' ' ]),
h('div.confirm-screen-total-box__subtitle', [ this.props.t('amountPlusGas') ]), h('div.confirm-screen-total-box__subtitle', [ this.context.t('amountPlusGas') ]),
]), ]),
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
@ -428,10 +434,10 @@ ConfirmSendEther.prototype.render = function () {
clearSend() clearSend()
this.cancel(event, txMeta) this.cancel(event, txMeta)
}, },
}, this.props.t('cancel')), }, this.context.t('cancel')),
// Accept Button // Accept Button
h('button.btn-confirm.page-container__footer-button.allcaps', [this.props.t('confirm')]), h('button.btn-confirm.page-container__footer-button.allcaps', [this.context.t('confirm')]),
]), ]),
]), ]),
]) ])
@ -447,7 +453,7 @@ ConfirmSendEther.prototype.onSubmit = function (event) {
if (valid && this.verifyGasParams()) { if (valid && this.verifyGasParams()) {
this.props.sendTransaction(txMeta, event) this.props.sendTransaction(txMeta, event)
} else { } else {
this.props.dispatch(actions.displayWarning(this.props.t('invalidGasParams'))) this.props.dispatch(actions.displayWarning(this.context.t('invalidGasParams')))
this.setState({ submitting: false }) this.setState({ submitting: false })
} }
} }

@ -1,5 +1,6 @@
const Component = require('react').Component const Component = require('react').Component
const connect = require('../../metamask-connect') const PropTypes = require('prop-types')
const connect = require('react-redux').connect
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const tokenAbi = require('human-standard-token-abi') const tokenAbi = require('human-standard-token-abi')
@ -28,8 +29,13 @@ const {
getSelectedTokenContract, getSelectedTokenContract,
} = require('../../selectors') } = require('../../selectors')
ConfirmSendToken.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps, mapDispatchToProps)(ConfirmSendToken) module.exports = connect(mapStateToProps, mapDispatchToProps)(ConfirmSendToken)
function mapStateToProps (state, ownProps) { function mapStateToProps (state, ownProps) {
const { token: { symbol }, txData } = ownProps const { token: { symbol }, txData } = ownProps
const { txParams } = txData || {} const { txParams } = txData || {}
@ -168,7 +174,7 @@ ConfirmSendToken.prototype.getAmount = function () {
? +(sendTokenAmount * tokenExchangeRate * conversionRate).toFixed(2) ? +(sendTokenAmount * tokenExchangeRate * conversionRate).toFixed(2)
: null, : null,
token: typeof value === 'undefined' token: typeof value === 'undefined'
? this.props.t('unknown') ? this.context.t('unknown')
: +sendTokenAmount.toFixed(decimals), : +sendTokenAmount.toFixed(decimals),
} }
@ -240,7 +246,7 @@ ConfirmSendToken.prototype.getData = function () {
}, },
to: { to: {
address: value, address: value,
name: identities[value] ? identities[value].name : this.props.t('newRecipient'), name: identities[value] ? identities[value].name : this.context.t('newRecipient'),
}, },
memo: txParams.memo || '', memo: txParams.memo || '',
} }
@ -286,7 +292,7 @@ ConfirmSendToken.prototype.renderGasFee = function () {
return ( return (
h('section.flex-row.flex-center.confirm-screen-row', [ h('section.flex-row.flex-center.confirm-screen-row', [
h('span.confirm-screen-label.confirm-screen-section-column', [ this.props.t('gasFee') ]), h('span.confirm-screen-label.confirm-screen-section-column', [ this.context.t('gasFee') ]),
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
h(GasFeeDisplay, { h(GasFeeDisplay, {
gasTotal: gasTotal || gasFeeInHex, gasTotal: gasTotal || gasFeeInHex,
@ -308,8 +314,8 @@ ConfirmSendToken.prototype.renderTotalPlusGas = function () {
? ( ? (
h('section.flex-row.flex-center.confirm-screen-row.confirm-screen-total-box ', [ h('section.flex-row.flex-center.confirm-screen-row.confirm-screen-total-box ', [
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
h('span.confirm-screen-label', [ this.props.t('total') + ' ' ]), h('span.confirm-screen-label', [ this.context.t('total') + ' ' ]),
h('div.confirm-screen-total-box__subtitle', [ this.props.t('amountPlusGas') ]), h('div.confirm-screen-total-box__subtitle', [ this.context.t('amountPlusGas') ]),
]), ]),
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
@ -321,13 +327,13 @@ ConfirmSendToken.prototype.renderTotalPlusGas = function () {
: ( : (
h('section.flex-row.flex-center.confirm-screen-row.confirm-screen-total-box ', [ h('section.flex-row.flex-center.confirm-screen-row.confirm-screen-total-box ', [
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
h('span.confirm-screen-label', [ this.props.t('total') + ' ' ]), h('span.confirm-screen-label', [ this.context.t('total') + ' ' ]),
h('div.confirm-screen-total-box__subtitle', [ this.props.t('amountPlusGas') ]), h('div.confirm-screen-total-box__subtitle', [ this.context.t('amountPlusGas') ]),
]), ]),
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', `${tokenAmount} ${symbol}`), h('div.confirm-screen-row-info', `${tokenAmount} ${symbol}`),
h('div.confirm-screen-row-detail', `+ ${fiatGas} ${currentCurrency} ${this.props.t('gas')}`), h('div.confirm-screen-row-detail', `+ ${fiatGas} ${currentCurrency} ${this.context.t('gas')}`),
]), ]),
]) ])
) )
@ -350,10 +356,10 @@ ConfirmSendToken.prototype.render = function () {
this.inputs = [] this.inputs = []
const isTxReprice = Boolean(txMeta.lastGasPrice) const isTxReprice = Boolean(txMeta.lastGasPrice)
const title = isTxReprice ? this.props.t('reprice_title') : this.props.t('confirm') const title = isTxReprice ? this.context.t('reprice_title') : this.context.t('confirm')
const subtitle = isTxReprice const subtitle = isTxReprice
? this.props.t('reprice_subtitle') ? this.context.t('reprice_subtitle')
: this.props.t('pleaseReviewTransaction') : this.context.t('pleaseReviewTransaction')
return ( return (
h('div.confirm-screen-container.confirm-send-token', [ h('div.confirm-screen-container.confirm-send-token', [
@ -362,7 +368,7 @@ ConfirmSendToken.prototype.render = function () {
h('div.page-container__header', [ h('div.page-container__header', [
!txMeta.lastGasPrice && h('button.confirm-screen-back-button', { !txMeta.lastGasPrice && h('button.confirm-screen-back-button', {
onClick: () => editTransaction(txMeta), onClick: () => editTransaction(txMeta),
}, this.props.t('edit')), }, this.context.t('edit')),
h('div.page-container__title', title), h('div.page-container__title', title),
h('div.page-container__subtitle', subtitle), h('div.page-container__subtitle', subtitle),
]), ]),
@ -406,7 +412,7 @@ ConfirmSendToken.prototype.render = function () {
h('div.confirm-screen-rows', [ h('div.confirm-screen-rows', [
h('section.flex-row.flex-center.confirm-screen-row', [ h('section.flex-row.flex-center.confirm-screen-row', [
h('span.confirm-screen-label.confirm-screen-section-column', [ this.props.t('from') ]), h('span.confirm-screen-label.confirm-screen-section-column', [ this.context.t('from') ]),
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', fromName), h('div.confirm-screen-row-info', fromName),
h('div.confirm-screen-row-detail', `...${fromAddress.slice(fromAddress.length - 4)}`), h('div.confirm-screen-row-detail', `...${fromAddress.slice(fromAddress.length - 4)}`),
@ -414,7 +420,7 @@ ConfirmSendToken.prototype.render = function () {
]), ]),
toAddress && h('section.flex-row.flex-center.confirm-screen-row', [ toAddress && h('section.flex-row.flex-center.confirm-screen-row', [
h('span.confirm-screen-label.confirm-screen-section-column', [ this.props.t('to') ]), h('span.confirm-screen-label.confirm-screen-section-column', [ this.context.t('to') ]),
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', toName), h('div.confirm-screen-row-info', toName),
h('div.confirm-screen-row-detail', `...${toAddress.slice(toAddress.length - 4)}`), h('div.confirm-screen-row-detail', `...${toAddress.slice(toAddress.length - 4)}`),
@ -436,10 +442,10 @@ ConfirmSendToken.prototype.render = function () {
// Cancel Button // Cancel Button
h('button.btn-cancel.page-container__footer-button.allcaps', { h('button.btn-cancel.page-container__footer-button.allcaps', {
onClick: (event) => this.cancel(event, txMeta), onClick: (event) => this.cancel(event, txMeta),
}, this.props.t('cancel')), }, this.context.t('cancel')),
// Accept Button // Accept Button
h('button.btn-confirm.page-container__footer-button.allcaps', [this.props.t('confirm')]), h('button.btn-confirm.page-container__footer-button.allcaps', [this.context.t('confirm')]),
]), ]),
]), ]),
]), ]),
@ -456,7 +462,7 @@ ConfirmSendToken.prototype.onSubmit = function (event) {
if (valid && this.verifyGasParams()) { if (valid && this.verifyGasParams()) {
this.props.sendTransaction(txMeta, event) this.props.sendTransaction(txMeta, event)
} else { } else {
this.props.dispatch(actions.displayWarning(this.props.t('invalidGasParams'))) this.props.dispatch(actions.displayWarning(this.context.t('invalidGasParams')))
this.setState({ submitting: false }) this.setState({ submitting: false })
} }
} }

@ -1,5 +1,5 @@
const Component = require('react').Component const Component = require('react').Component
const connect = require('../../metamask-connect') const connect = require('react-redux').connect
const h = require('react-hyperscript') const h = require('react-hyperscript')
const clone = require('clone') const clone = require('clone')
const abi = require('human-standard-token-abi') const abi = require('human-standard-token-abi')

@ -2,7 +2,7 @@ const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const qrCode = require('qrcode-npm').qrcode const qrCode = require('qrcode-npm').qrcode
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('../metamask-connect') const connect = require('react-redux').connect
const isHexPrefixed = require('ethereumjs-util').isHexPrefixed const isHexPrefixed = require('ethereumjs-util').isHexPrefixed
const ReadOnlyInput = require('./readonly-input') const ReadOnlyInput = require('./readonly-input')

@ -1,7 +1,7 @@
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('../../metamask-connect') const connect = require('react-redux').connect
const Identicon = require('../identicon') const Identicon = require('../identicon')
const CurrencyDisplay = require('./currency-display') const CurrencyDisplay = require('./currency-display')
const { conversionRateSelector, getCurrentCurrency } = require('../../selectors') const { conversionRateSelector, getCurrentCurrency } = require('../../selectors')

@ -1,11 +1,17 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const CurrencyDisplay = require('./currency-display') const CurrencyDisplay = require('./currency-display')
const connect = require('../../metamask-connect') const connect = require('react-redux').connect
GasFeeDisplay.contextTypes = {
t: PropTypes.func,
}
module.exports = connect()(GasFeeDisplay) module.exports = connect()(GasFeeDisplay)
inherits(GasFeeDisplay, Component) inherits(GasFeeDisplay, Component)
function GasFeeDisplay () { function GasFeeDisplay () {
Component.call(this) Component.call(this)
@ -33,8 +39,8 @@ GasFeeDisplay.prototype.render = function () {
readOnly: true, readOnly: true,
}) })
: gasLoadingError : gasLoadingError
? h('div.currency-display.currency-display--message', this.props.t('setGasPrice')) ? h('div.currency-display.currency-display--message', this.context.t('setGasPrice'))
: h('div.currency-display', this.props.t('loading')), : h('div.currency-display', this.context.t('loading')),
h('button.sliders-icon-container', { h('button.sliders-icon-container', {
onClick, onClick,

@ -1,11 +1,17 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const InputNumber = require('../input-number.js') const InputNumber = require('../input-number.js')
const connect = require('../../metamask-connect') const connect = require('react-redux').connect
GasTooltip.contextTypes = {
t: PropTypes.func,
}
module.exports = connect()(GasTooltip) module.exports = connect()(GasTooltip)
inherits(GasTooltip, Component) inherits(GasTooltip, Component)
function GasTooltip () { function GasTooltip () {
Component.call(this) Component.call(this)
@ -82,7 +88,7 @@ GasTooltip.prototype.render = function () {
'marginTop': '81px', 'marginTop': '81px',
}, },
}, [ }, [
h('span.gas-tooltip-label', {}, [this.props.t('gasLimit')]), h('span.gas-tooltip-label', {}, [this.context.t('gasLimit')]),
h('i.fa.fa-info-circle'), h('i.fa.fa-info-circle'),
]), ]),
h(InputNumber, { h(InputNumber, {

@ -1,4 +1,4 @@
const connect = require('../../metamask-connect') const connect = require('react-redux').connect
const actions = require('../../actions') const actions = require('../../actions')
const abi = require('ethereumjs-abi') const abi = require('ethereumjs-abi')
const SendEther = require('../../send-v2') const SendEther = require('../../send-v2')

@ -1,11 +1,17 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const AccountListItem = require('./account-list-item') const AccountListItem = require('./account-list-item')
const connect = require('../../metamask-connect') const connect = require('react-redux').connect
ToAutoComplete.contextTypes = {
t: PropTypes.func,
}
module.exports = connect()(ToAutoComplete) module.exports = connect()(ToAutoComplete)
inherits(ToAutoComplete, Component) inherits(ToAutoComplete, Component)
function ToAutoComplete () { function ToAutoComplete () {
Component.call(this) Component.call(this)
@ -93,7 +99,7 @@ ToAutoComplete.prototype.render = function () {
return h('div.send-v2__to-autocomplete', {}, [ return h('div.send-v2__to-autocomplete', {}, [
h('input.send-v2__to-autocomplete__input', { h('input.send-v2__to-autocomplete__input', {
placeholder: this.props.t('recipientAddress'), placeholder: this.context.t('recipientAddress'),
className: inError ? `send-v2__error-border` : '', className: inError ? `send-v2__error-border` : '',
value: to, value: to,
onChange: event => onChange(event.target.value), onChange: event => onChange(event.target.value),

@ -1,6 +1,6 @@
const { Component } = require('react') const { Component } = require('react')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const connect = require('../metamask-connect') const connect = require('react-redux').connect
const PropTypes = require('prop-types') const PropTypes = require('prop-types')
const Identicon = require('./identicon') const Identicon = require('./identicon')
@ -21,7 +21,7 @@ class SenderToRecipient extends Component {
this.renderRecipientIcon(), this.renderRecipientIcon(),
h( h(
'.sender-to-recipient__name.sender-to-recipient__recipient-name', '.sender-to-recipient__name.sender-to-recipient__recipient-name',
recipientName || this.props.t('newContract') recipientName || this.context.t('newContract')
), ),
]) ])
) )
@ -64,4 +64,9 @@ SenderToRecipient.propTypes = {
t: PropTypes.func, t: PropTypes.func,
} }
SenderToRecipient.contextTypes = {
t: PropTypes.func,
}
module.exports = connect()(SenderToRecipient) module.exports = connect()(SenderToRecipient)

@ -1,7 +1,8 @@
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const PropTypes = require('prop-types')
const Component = require('react').Component const Component = require('react').Component
const connect = require('../metamask-connect') const connect = require('react-redux').connect
const classnames = require('classnames') const classnames = require('classnames')
const { qrcode } = require('qrcode-npm') const { qrcode } = require('qrcode-npm')
const { shapeShiftSubview, pairUpdate, buyWithShapeShift } = require('../actions') const { shapeShiftSubview, pairUpdate, buyWithShapeShift } = require('../actions')
@ -32,8 +33,13 @@ function mapDispatchToProps (dispatch) {
} }
} }
ShapeshiftForm.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps, mapDispatchToProps)(ShapeshiftForm) module.exports = connect(mapStateToProps, mapDispatchToProps)(ShapeshiftForm)
inherits(ShapeshiftForm, Component) inherits(ShapeshiftForm, Component)
function ShapeshiftForm () { function ShapeshiftForm () {
Component.call(this) Component.call(this)
@ -93,7 +99,7 @@ ShapeshiftForm.prototype.onBuyWithShapeShift = function () {
})) }))
.catch(() => this.setState({ .catch(() => this.setState({
showQrCode: false, showQrCode: false,
errorMessage: this.props.t('invalidRequest'), errorMessage: this.context.t('invalidRequest'),
isLoading: false, isLoading: false,
})) }))
} }
@ -125,10 +131,10 @@ ShapeshiftForm.prototype.renderMarketInfo = function () {
return h('div.shapeshift-form__metadata', {}, [ return h('div.shapeshift-form__metadata', {}, [
this.renderMetadata(this.props.t('status'), limit ? this.props.t('available') : this.props.t('unavailable')), this.renderMetadata(this.context.t('status'), limit ? this.context.t('available') : this.context.t('unavailable')),
this.renderMetadata(this.props.t('limit'), limit), this.renderMetadata(this.context.t('limit'), limit),
this.renderMetadata(this.props.t('exchangeRate'), rate), this.renderMetadata(this.context.t('exchangeRate'), rate),
this.renderMetadata(this.props.t('min'), minimum), this.renderMetadata(this.context.t('min'), minimum),
]) ])
} }
@ -142,7 +148,7 @@ ShapeshiftForm.prototype.renderQrCode = function () {
return h('div.shapeshift-form', {}, [ return h('div.shapeshift-form', {}, [
h('div.shapeshift-form__deposit-instruction', [ h('div.shapeshift-form__deposit-instruction', [
this.props.t('depositCoin', [depositCoin.toUpperCase()]), this.context.t('depositCoin', [depositCoin.toUpperCase()]),
]), ]),
h('div', depositAddress), h('div', depositAddress),
@ -179,7 +185,7 @@ ShapeshiftForm.prototype.render = function () {
h('div.shapeshift-form__selector', [ h('div.shapeshift-form__selector', [
h('div.shapeshift-form__selector-label', this.props.t('deposit')), h('div.shapeshift-form__selector-label', this.context.t('deposit')),
h(SimpleDropdown, { h(SimpleDropdown, {
selectedOption: this.state.depositCoin, selectedOption: this.state.depositCoin,
@ -199,7 +205,7 @@ ShapeshiftForm.prototype.render = function () {
h('div.shapeshift-form__selector', [ h('div.shapeshift-form__selector', [
h('div.shapeshift-form__selector-label', [ h('div.shapeshift-form__selector-label', [
this.props.t('receive'), this.context.t('receive'),
]), ]),
h('div.shapeshift-form__selector-input', ['ETH']), h('div.shapeshift-form__selector-input', ['ETH']),
@ -217,7 +223,7 @@ ShapeshiftForm.prototype.render = function () {
}, [ }, [
h('div.shapeshift-form__address-input-label', [ h('div.shapeshift-form__address-input-label', [
this.props.t('refundAddress'), this.context.t('refundAddress'),
]), ]),
h('input.shapeshift-form__address-input', { h('input.shapeshift-form__address-input', {
@ -239,7 +245,7 @@ ShapeshiftForm.prototype.render = function () {
className: btnClass, className: btnClass,
disabled: !token, disabled: !token,
onClick: () => this.onBuyWithShapeShift(), onClick: () => this.onBuyWithShapeShift(),
}, [this.props.t('buy')]), }, [this.context.t('buy')]),
]) ])
} }

@ -1,7 +1,8 @@
const inherits = require('util').inherits const inherits = require('util').inherits
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const connect = require('../metamask-connect') const connect = require('react-redux').connect
const vreme = new (require('vreme'))() const vreme = new (require('vreme'))()
const explorerLink = require('etherscan-link').createExplorerLink const explorerLink = require('etherscan-link').createExplorerLink
const actions = require('../actions') const actions = require('../actions')
@ -12,8 +13,13 @@ const EthBalance = require('./eth-balance')
const Tooltip = require('./tooltip') const Tooltip = require('./tooltip')
ShiftListItem.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps)(ShiftListItem) module.exports = connect(mapStateToProps)(ShiftListItem)
function mapStateToProps (state) { function mapStateToProps (state) {
return { return {
selectedAddress: state.metamask.selectedAddress, selectedAddress: state.metamask.selectedAddress,
@ -75,7 +81,7 @@ ShiftListItem.prototype.renderUtilComponents = function () {
value: this.props.depositAddress, value: this.props.depositAddress,
}), }),
h(Tooltip, { h(Tooltip, {
title: this.props.t('qrCode'), title: this.context.t('qrCode'),
}, [ }, [
h('i.fa.fa-qrcode.pointer.pop-hover', { h('i.fa.fa-qrcode.pointer.pop-hover', {
onClick: () => props.dispatch(actions.reshowQrCode(props.depositAddress, props.depositType)), onClick: () => props.dispatch(actions.reshowQrCode(props.depositAddress, props.depositType)),
@ -135,8 +141,8 @@ ShiftListItem.prototype.renderInfo = function () {
color: '#ABA9AA', color: '#ABA9AA',
width: '100%', width: '100%',
}, },
}, this.props.t('toETHviaShapeShift', [props.depositType])), }, this.context.t('toETHviaShapeShift', [props.depositType])),
h('div', this.props.t('noDeposits')), h('div', this.context.t('noDeposits')),
h('div', { h('div', {
style: { style: {
fontSize: 'x-small', fontSize: 'x-small',
@ -158,8 +164,8 @@ ShiftListItem.prototype.renderInfo = function () {
color: '#ABA9AA', color: '#ABA9AA',
width: '100%', width: '100%',
}, },
}, this.props.t('toETHviaShapeShift', [props.depositType])), }, this.context.t('toETHviaShapeShift', [props.depositType])),
h('div', this.props.t('conversionProgress')), h('div', this.context.t('conversionProgress')),
h('div', { h('div', {
style: { style: {
fontSize: 'x-small', fontSize: 'x-small',
@ -184,7 +190,7 @@ ShiftListItem.prototype.renderInfo = function () {
color: '#ABA9AA', color: '#ABA9AA',
width: '100%', width: '100%',
}, },
}, this.props.t('fromShapeShift')), }, this.context.t('fromShapeShift')),
h('div', formatDate(props.time)), h('div', formatDate(props.time)),
h('div', { h('div', {
style: { style: {
@ -196,7 +202,7 @@ ShiftListItem.prototype.renderInfo = function () {
]) ])
case 'failed': case 'failed':
return h('span.error', '(' + this.props.t('failed') + ')') return h('span.error', '(' + this.context.t('failed') + ')')
default: default:
return '' return ''
} }

@ -1,8 +1,9 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const Identicon = require('./identicon') const Identicon = require('./identicon')
const connect = require('../metamask-connect') const connect = require('react-redux').connect
const ethUtil = require('ethereumjs-util') const ethUtil = require('ethereumjs-util')
const classnames = require('classnames') const classnames = require('classnames')
@ -37,8 +38,13 @@ function mapDispatchToProps (dispatch) {
} }
} }
SignatureRequest.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps, mapDispatchToProps)(SignatureRequest) module.exports = connect(mapStateToProps, mapDispatchToProps)(SignatureRequest)
inherits(SignatureRequest, Component) inherits(SignatureRequest, Component)
function SignatureRequest (props) { function SignatureRequest (props) {
Component.call(this) Component.call(this)
@ -54,7 +60,7 @@ SignatureRequest.prototype.renderHeader = function () {
h('div.request-signature__header-background'), h('div.request-signature__header-background'),
h('div.request-signature__header__text', this.props.t('sigRequest')), h('div.request-signature__header__text', this.context.t('sigRequest')),
h('div.request-signature__header__tip-container', [ h('div.request-signature__header__tip-container', [
h('div.request-signature__header__tip'), h('div.request-signature__header__tip'),
@ -75,7 +81,7 @@ SignatureRequest.prototype.renderAccountDropdown = function () {
return h('div.request-signature__account', [ return h('div.request-signature__account', [
h('div.request-signature__account-text', [this.props.t('account') + ':']), h('div.request-signature__account-text', [this.context.t('account') + ':']),
h(AccountDropdownMini, { h(AccountDropdownMini, {
selectedAccount, selectedAccount,
@ -102,7 +108,7 @@ SignatureRequest.prototype.renderBalance = function () {
return h('div.request-signature__balance', [ return h('div.request-signature__balance', [
h('div.request-signature__balance-text', [this.props.t('balance')]), h('div.request-signature__balance-text', [this.context.t('balance')]),
h('div.request-signature__balance-value', `${balanceInEther} ETH`), h('div.request-signature__balance-value', `${balanceInEther} ETH`),
@ -136,7 +142,7 @@ SignatureRequest.prototype.renderRequestInfo = function () {
return h('div.request-signature__request-info', [ return h('div.request-signature__request-info', [
h('div.request-signature__headline', [ h('div.request-signature__headline', [
this.props.t('yourSigRequested'), this.context.t('yourSigRequested'),
]), ]),
]) ])
@ -154,18 +160,18 @@ SignatureRequest.prototype.msgHexToText = function (hex) {
SignatureRequest.prototype.renderBody = function () { SignatureRequest.prototype.renderBody = function () {
let rows let rows
let notice = this.props.t('youSign') + ':' let notice = this.context.t('youSign') + ':'
const { txData } = this.props const { txData } = this.props
const { type, msgParams: { data } } = txData const { type, msgParams: { data } } = txData
if (type === 'personal_sign') { if (type === 'personal_sign') {
rows = [{ name: this.props.t('message'), value: this.msgHexToText(data) }] rows = [{ name: this.context.t('message'), value: this.msgHexToText(data) }]
} else if (type === 'eth_signTypedData') { } else if (type === 'eth_signTypedData') {
rows = data rows = data
} else if (type === 'eth_sign') { } else if (type === 'eth_sign') {
rows = [{ name: this.props.t('message'), value: data }] rows = [{ name: this.context.t('message'), value: data }]
notice = this.props.t('signNotice') notice = this.context.t('signNotice')
} }
return h('div.request-signature__body', {}, [ return h('div.request-signature__body', {}, [
@ -224,10 +230,10 @@ SignatureRequest.prototype.renderFooter = function () {
return h('div.request-signature__footer', [ return h('div.request-signature__footer', [
h('button.btn-secondary--lg.request-signature__footer__cancel-button', { h('button.btn-secondary--lg.request-signature__footer__cancel-button', {
onClick: cancel, onClick: cancel,
}, this.props.t('cancel')), }, this.context.t('cancel')),
h('button.btn-primary--lg', { h('button.btn-primary--lg', {
onClick: sign, onClick: sign,
}, this.props.t('sign')), }, this.context.t('sign')),
]) ])
} }

@ -2,7 +2,7 @@ const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const TokenTracker = require('eth-token-tracker') const TokenTracker = require('eth-token-tracker')
const connect = require('../metamask-connect') const connect = require('react-redux').connect
const selectors = require('../selectors') const selectors = require('../selectors')
function mapStateToProps (state) { function mapStateToProps (state) {

@ -1,7 +1,7 @@
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('../metamask-connect') const connect = require('react-redux').connect
const Identicon = require('./identicon') const Identicon = require('./identicon')
const prefixForNetwork = require('../../lib/etherscan-prefix-for-network') const prefixForNetwork = require('../../lib/etherscan-prefix-for-network')
const selectors = require('../selectors') const selectors = require('../selectors')

@ -1,9 +1,10 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const TokenTracker = require('eth-token-tracker') const TokenTracker = require('eth-token-tracker')
const TokenCell = require('./token-cell.js') const TokenCell = require('./token-cell.js')
const connect = require('../metamask-connect') const connect = require('react-redux').connect
const selectors = require('../selectors') const selectors = require('../selectors')
function mapStateToProps (state) { function mapStateToProps (state) {
@ -24,8 +25,13 @@ for (const address in contracts) {
} }
} }
TokenList.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps)(TokenList) module.exports = connect(mapStateToProps)(TokenList)
inherits(TokenList, Component) inherits(TokenList, Component)
function TokenList () { function TokenList () {
this.state = { this.state = {
@ -42,7 +48,7 @@ TokenList.prototype.render = function () {
const { tokens, isLoading, error } = state const { tokens, isLoading, error } = state
if (isLoading) { if (isLoading) {
return this.message(this.props.t('loadingTokens')) return this.message(this.context.t('loadingTokens'))
} }
if (error) { if (error) {
@ -52,7 +58,7 @@ TokenList.prototype.render = function () {
padding: '80px', padding: '80px',
}, },
}, [ }, [
this.props.t('troubleTokenBalances'), this.context.t('troubleTokenBalances'),
h('span.hotFix', { h('span.hotFix', {
style: { style: {
color: 'rgba(247, 134, 28, 1)', color: 'rgba(247, 134, 28, 1)',
@ -63,7 +69,7 @@ TokenList.prototype.render = function () {
url: `https://ethplorer.io/address/${userAddress}`, url: `https://ethplorer.io/address/${userAddress}`,
}) })
}, },
}, this.props.t('here')), }, this.context.t('here')),
]) ])
} }

@ -1,6 +1,7 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const connect = require('../metamask-connect') const connect = require('react-redux').connect
const inherits = require('util').inherits const inherits = require('util').inherits
const classnames = require('classnames') const classnames = require('classnames')
const abi = require('human-standard-token-abi') const abi = require('human-standard-token-abi')
@ -15,8 +16,13 @@ const { calcTokenAmount } = require('../token-util')
const { getCurrentCurrency } = require('../selectors') const { getCurrentCurrency } = require('../selectors')
TxListItem.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps, mapDispatchToProps)(TxListItem) module.exports = connect(mapStateToProps, mapDispatchToProps)(TxListItem)
function mapStateToProps (state) { function mapStateToProps (state) {
return { return {
tokens: state.metamask.tokens, tokens: state.metamask.tokens,
@ -74,7 +80,7 @@ TxListItem.prototype.getAddressText = function () {
default: default:
return address return address
? `${address.slice(0, 10)}...${address.slice(-4)}` ? `${address.slice(0, 10)}...${address.slice(-4)}`
: this.props.t('contractDeployment') : this.context.t('contractDeployment')
} }
} }
@ -306,21 +312,21 @@ TxListItem.prototype.txStatusIndicator = function () {
let name let name
if (transactionStatus === 'unapproved') { if (transactionStatus === 'unapproved') {
name = this.props.t('unapproved') name = this.context.t('unapproved')
} else if (transactionStatus === 'rejected') { } else if (transactionStatus === 'rejected') {
name = this.props.t('rejected') name = this.context.t('rejected')
} else if (transactionStatus === 'approved') { } else if (transactionStatus === 'approved') {
name = this.props.t('approved') name = this.context.t('approved')
} else if (transactionStatus === 'signed') { } else if (transactionStatus === 'signed') {
name = this.props.t('signed') name = this.context.t('signed')
} else if (transactionStatus === 'submitted') { } else if (transactionStatus === 'submitted') {
name = this.props.t('submitted') name = this.context.t('submitted')
} else if (transactionStatus === 'confirmed') { } else if (transactionStatus === 'confirmed') {
name = this.props.t('confirmed') name = this.context.t('confirmed')
} else if (transactionStatus === 'failed') { } else if (transactionStatus === 'failed') {
name = this.props.t('failed') name = this.context.t('failed')
} else if (transactionStatus === 'dropped') { } else if (transactionStatus === 'dropped') {
name = this.props.t('dropped') name = this.context.t('dropped')
} }
return name return name
} }

@ -1,5 +1,6 @@
const Component = require('react').Component const Component = require('react').Component
const connect = require('../metamask-connect') const PropTypes = require('prop-types')
const connect = require('react-redux').connect
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const prefixForNetwork = require('../../lib/etherscan-prefix-for-network') const prefixForNetwork = require('../../lib/etherscan-prefix-for-network')
@ -11,8 +12,13 @@ const { showConfTxPage } = require('../actions')
const classnames = require('classnames') const classnames = require('classnames')
const { tokenInfoGetter } = require('../token-util') const { tokenInfoGetter } = require('../token-util')
TxList.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps, mapDispatchToProps)(TxList) module.exports = connect(mapStateToProps, mapDispatchToProps)(TxList)
function mapStateToProps (state) { function mapStateToProps (state) {
return { return {
txsToRender: selectors.transactionsSelector(state), txsToRender: selectors.transactionsSelector(state),
@ -39,7 +45,7 @@ TxList.prototype.render = function () {
return h('div.flex-column', [ return h('div.flex-column', [
h('div.flex-row.tx-list-header-wrapper', [ h('div.flex-row.tx-list-header-wrapper', [
h('div.flex-row.tx-list-header', [ h('div.flex-row.tx-list-header', [
h('div', this.props.t('transactions')), h('div', this.context.t('transactions')),
]), ]),
]), ]),
h('div.flex-column.tx-list-container', {}, [ h('div.flex-column.tx-list-container', {}, [
@ -56,7 +62,7 @@ TxList.prototype.renderTransaction = function () {
: [h( : [h(
'div.tx-list-item.tx-list-item--empty', 'div.tx-list-item.tx-list-item--empty',
{ key: 'tx-list-none' }, { key: 'tx-list-none' },
[ this.props.t('noTransactions') ], [ this.context.t('noTransactions') ],
)] )]
} }
@ -110,7 +116,7 @@ TxList.prototype.renderTransactionListItem = function (transaction, conversionRa
if (isUnapproved) { if (isUnapproved) {
opts.onClick = () => showConfTxPage({ id: transactionId }) opts.onClick = () => showConfTxPage({ id: transactionId })
opts.transactionStatus = this.props.t('notStarted') opts.transactionStatus = this.context.t('notStarted')
} else if (transactionHash) { } else if (transactionHash) {
opts.onClick = () => this.view(transactionHash, transactionNetworkId) opts.onClick = () => this.view(transactionHash, transactionNetworkId)
} }

@ -1,5 +1,6 @@
const Component = require('react').Component const Component = require('react').Component
const connect = require('../metamask-connect') const PropTypes = require('prop-types')
const connect = require('react-redux').connect
const h = require('react-hyperscript') const h = require('react-hyperscript')
const ethUtil = require('ethereumjs-util') const ethUtil = require('ethereumjs-util')
const inherits = require('util').inherits const inherits = require('util').inherits
@ -10,8 +11,13 @@ const BalanceComponent = require('./balance-component')
const TxList = require('./tx-list') const TxList = require('./tx-list')
const Identicon = require('./identicon') const Identicon = require('./identicon')
TxView.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps, mapDispatchToProps)(TxView) module.exports = connect(mapStateToProps, mapDispatchToProps)(TxView)
function mapStateToProps (state) { function mapStateToProps (state) {
const sidebarOpen = state.appState.sidebarOpen const sidebarOpen = state.appState.sidebarOpen
const isMascara = state.appState.isMascara const isMascara = state.appState.isMascara
@ -72,21 +78,21 @@ TxView.prototype.renderButtons = function () {
onClick: () => showModal({ onClick: () => showModal({
name: 'DEPOSIT_ETHER', name: 'DEPOSIT_ETHER',
}), }),
}, this.props.t('deposit')), }, this.context.t('deposit')),
h('button.btn-primary.hero-balance-button', { h('button.btn-primary.hero-balance-button', {
style: { style: {
marginLeft: '0.8em', marginLeft: '0.8em',
}, },
onClick: showSendPage, onClick: showSendPage,
}, this.props.t('send')), }, this.context.t('send')),
]) ])
) )
: ( : (
h('div.flex-row.flex-center.hero-balance-buttons', [ h('div.flex-row.flex-center.hero-balance-buttons', [
h('button.btn-primary.hero-balance-button', { h('button.btn-primary.hero-balance-button', {
onClick: showSendTokenPage, onClick: showSendTokenPage,
}, this.props.t('send')), }, this.context.t('send')),
]) ])
) )
} }

@ -1,5 +1,6 @@
const Component = require('react').Component const Component = require('react').Component
const connect = require('../metamask-connect') const PropTypes = require('prop-types')
const connect = require('react-redux').connect
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const classnames = require('classnames') const classnames = require('classnames')
@ -12,8 +13,13 @@ const BalanceComponent = require('./balance-component')
const TokenList = require('./token-list') const TokenList = require('./token-list')
const selectors = require('../selectors') const selectors = require('../selectors')
WalletView.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps, mapDispatchToProps)(WalletView) module.exports = connect(mapStateToProps, mapDispatchToProps)(WalletView)
function mapStateToProps (state) { function mapStateToProps (state) {
return { return {
@ -116,7 +122,7 @@ WalletView.prototype.render = function () {
onClick: hideSidebar, onClick: hideSidebar,
}), }),
h('div.wallet-view__keyring-label.allcaps', isLoose ? this.props.t('imported') : ''), h('div.wallet-view__keyring-label.allcaps', isLoose ? this.context.t('imported') : ''),
h('div.flex-column.flex-center.wallet-view__name-container', { h('div.flex-column.flex-center.wallet-view__name-container', {
style: { margin: '0 auto' }, style: { margin: '0 auto' },
@ -133,13 +139,13 @@ WalletView.prototype.render = function () {
selectedIdentity.name, selectedIdentity.name,
]), ]),
h('button.btn-clear.wallet-view__details-button.allcaps', this.props.t('details')), h('button.btn-clear.wallet-view__details-button.allcaps', this.context.t('details')),
]), ]),
]), ]),
h(Tooltip, { h(Tooltip, {
position: 'bottom', position: 'bottom',
title: this.state.hasCopied ? this.props.t('copiedExclamation') : this.props.t('copyToClipboard'), title: this.state.hasCopied ? this.context.t('copiedExclamation') : this.context.t('copyToClipboard'),
wrapperClassName: 'wallet-view__tooltip', wrapperClassName: 'wallet-view__tooltip',
}, [ }, [
h('button.wallet-view__address', { h('button.wallet-view__address', {
@ -172,7 +178,7 @@ WalletView.prototype.render = function () {
showAddTokenPage() showAddTokenPage()
hideSidebar() hideSidebar()
}, },
}, this.props.t('addToken')), }, this.context.t('addToken')),
]) ])
} }

@ -1,7 +1,7 @@
const inherits = require('util').inherits const inherits = require('util').inherits
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const connect = require('./metamask-connect') const connect = require('react-redux').connect
const actions = require('./actions') const actions = require('./actions')
const txHelper = require('../lib/tx-helper') const txHelper = require('../lib/tx-helper')

@ -1,7 +1,8 @@
const inherits = require('util').inherits const inherits = require('util').inherits
const EventEmitter = require('events').EventEmitter const EventEmitter = require('events').EventEmitter
const Component = require('react').Component const Component = require('react').Component
const connect = require('../metamask-connect') const PropTypes = require('prop-types')
const connect = require('react-redux').connect
const h = require('react-hyperscript') const h = require('react-hyperscript')
const Mascot = require('../components/mascot') const Mascot = require('../components/mascot')
const actions = require('../actions') const actions = require('../actions')
@ -12,8 +13,13 @@ const { OLD_UI_NETWORK_TYPE } = require('../../../app/scripts/config').enums
let isSubmitting = false let isSubmitting = false
InitializeMenuScreen.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps)(InitializeMenuScreen) module.exports = connect(mapStateToProps)(InitializeMenuScreen)
inherits(InitializeMenuScreen, Component) inherits(InitializeMenuScreen, Component)
function InitializeMenuScreen () { function InitializeMenuScreen () {
Component.call(this) Component.call(this)
@ -59,7 +65,7 @@ InitializeMenuScreen.prototype.renderMenu = function (state) {
color: '#7F8082', color: '#7F8082',
marginBottom: 10, marginBottom: 10,
}, },
}, this.props.t('appName')), }, this.context.t('appName')),
h('div', [ h('div', [
@ -69,10 +75,10 @@ InitializeMenuScreen.prototype.renderMenu = function (state) {
color: '#7F8082', color: '#7F8082',
display: 'inline', display: 'inline',
}, },
}, this.props.t('encryptNewDen')), }, this.context.t('encryptNewDen')),
h(Tooltip, { h(Tooltip, {
title: this.props.t('denExplainer'), title: this.context.t('denExplainer'),
}, [ }, [
h('i.fa.fa-question-circle.pointer', { h('i.fa.fa-question-circle.pointer', {
style: { style: {
@ -92,7 +98,7 @@ InitializeMenuScreen.prototype.renderMenu = function (state) {
h('input.large-input.letter-spacey', { h('input.large-input.letter-spacey', {
type: 'password', type: 'password',
id: 'password-box', id: 'password-box',
placeholder: this.props.t('newPassword'), placeholder: this.context.t('newPassword'),
onInput: this.inputChanged.bind(this), onInput: this.inputChanged.bind(this),
style: { style: {
width: 260, width: 260,
@ -104,7 +110,7 @@ InitializeMenuScreen.prototype.renderMenu = function (state) {
h('input.large-input.letter-spacey', { h('input.large-input.letter-spacey', {
type: 'password', type: 'password',
id: 'password-box-confirm', id: 'password-box-confirm',
placeholder: this.props.t('confirmPassword'), placeholder: this.context.t('confirmPassword'),
onKeyPress: this.createVaultOnEnter.bind(this), onKeyPress: this.createVaultOnEnter.bind(this),
onInput: this.inputChanged.bind(this), onInput: this.inputChanged.bind(this),
style: { style: {
@ -119,7 +125,7 @@ InitializeMenuScreen.prototype.renderMenu = function (state) {
style: { style: {
margin: 12, margin: 12,
}, },
}, this.props.t('createDen')), }, this.context.t('createDen')),
h('.flex-row.flex-center.flex-grow', [ h('.flex-row.flex-center.flex-grow', [
h('p.pointer', { h('p.pointer', {
@ -129,7 +135,7 @@ InitializeMenuScreen.prototype.renderMenu = function (state) {
color: 'rgb(247, 134, 28)', color: 'rgb(247, 134, 28)',
textDecoration: 'underline', textDecoration: 'underline',
}, },
}, this.props.t('importDen')), }, this.context.t('importDen')),
]), ]),
h('.flex-row.flex-center.flex-grow', [ h('.flex-row.flex-center.flex-grow', [
@ -178,12 +184,12 @@ InitializeMenuScreen.prototype.createNewVaultAndKeychain = function () {
var passwordConfirm = passwordConfirmBox.value var passwordConfirm = passwordConfirmBox.value
if (password.length < 8) { if (password.length < 8) {
this.warning = this.props.t('passwordShort') this.warning = this.context.t('passwordShort')
this.props.dispatch(actions.displayWarning(this.warning)) this.props.dispatch(actions.displayWarning(this.warning))
return return
} }
if (password !== passwordConfirm) { if (password !== passwordConfirm) {
this.warning = this.props.t('passwordMismatch') this.warning = this.context.t('passwordMismatch')
this.props.dispatch(actions.displayWarning(this.warning)) this.props.dispatch(actions.displayWarning(this.warning))
return return
} }

@ -0,0 +1,37 @@
const { Component } = require('react')
const connect = require('react-redux').connect
const h = require('react-hyperscript')
const PropTypes = require('prop-types')
const t = require('../i18n-helper').getMessage
class I18nProvider extends Component {
getChildContext() {
const { localeMessages } = this.props
return {
t: t.bind(null, localeMessages),
}
}
render() {
return h('div', [ this.props.children ])
}
}
I18nProvider.propTypes = {
localeMessages: PropTypes.object,
children: PropTypes.object,
}
I18nProvider.childContextTypes = {
t: PropTypes.func,
}
const mapStateToProps = state => {
const { localeMessages } = state
return {
localeMessages,
}
}
module.exports = connect(mapStateToProps)(I18nProvider)

@ -1,6 +1,6 @@
const inherits = require('util').inherits const inherits = require('util').inherits
const Component = require('react').Component const Component = require('react').Component
const connect = require('../../metamask-connect') const connect = require('react-redux').connect
const h = require('react-hyperscript') const h = require('react-hyperscript')
const actions = require('../../actions') const actions = require('../../actions')
const exportAsFile = require('../../util').exportAsFile const exportAsFile = require('../../util').exportAsFile

@ -1,12 +1,17 @@
const inherits = require('util').inherits const inherits = require('util').inherits
const Component = require('react').Component const Component = require('react').Component
const connect = require('../../../metamask-connect') const PropTypes = require('prop-types')
const connect = require('react-redux').connect
const h = require('react-hyperscript') const h = require('react-hyperscript')
const actions = require('../../../actions') const actions = require('../../../actions')
RevealSeedConfirmation.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps)(RevealSeedConfirmation) module.exports = connect(mapStateToProps)(RevealSeedConfirmation)
inherits(RevealSeedConfirmation, Component) inherits(RevealSeedConfirmation, Component)
function RevealSeedConfirmation () { function RevealSeedConfirmation () {
Component.call(this) Component.call(this)
@ -49,13 +54,13 @@ RevealSeedConfirmation.prototype.render = function () {
}, },
}, [ }, [
h('h4', this.props.t('revealSeedWordsWarning')), h('h4', this.context.t('revealSeedWordsWarning')),
// confirmation // confirmation
h('input.large-input.letter-spacey', { h('input.large-input.letter-spacey', {
type: 'password', type: 'password',
id: 'password-box', id: 'password-box',
placeholder: this.props.t('enterPasswordConfirm'), placeholder: this.context.t('enterPasswordConfirm'),
onKeyPress: this.checkConfirmation.bind(this), onKeyPress: this.checkConfirmation.bind(this),
style: { style: {
width: 260, width: 260,
@ -91,7 +96,7 @@ RevealSeedConfirmation.prototype.render = function () {
), ),
props.inProgress && ( props.inProgress && (
h('span.in-progress-notification', this.props.t('generatingSeed')) h('span.in-progress-notification', this.context.t('generatingSeed'))
), ),
]), ]),
]) ])

@ -1,11 +1,17 @@
const inherits = require('util').inherits const inherits = require('util').inherits
const PropTypes = require('prop-types')
const PersistentForm = require('../../../lib/persistent-form') const PersistentForm = require('../../../lib/persistent-form')
const connect = require('../../metamask-connect') const connect = require('react-redux').connect
const h = require('react-hyperscript') const h = require('react-hyperscript')
const actions = require('../../actions') const actions = require('../../actions')
RestoreVaultScreen.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps)(RestoreVaultScreen) module.exports = connect(mapStateToProps)(RestoreVaultScreen)
inherits(RestoreVaultScreen, PersistentForm) inherits(RestoreVaultScreen, PersistentForm)
function RestoreVaultScreen () { function RestoreVaultScreen () {
PersistentForm.call(this) PersistentForm.call(this)
@ -36,23 +42,23 @@ RestoreVaultScreen.prototype.render = function () {
padding: 6, padding: 6,
}, },
}, [ }, [
this.props.t('restoreVault'), this.context.t('restoreVault'),
]), ]),
// wallet seed entry // wallet seed entry
h('h3', this.props.t('walletSeed')), h('h3', this.context.t('walletSeed')),
h('textarea.twelve-word-phrase.letter-spacey', { h('textarea.twelve-word-phrase.letter-spacey', {
dataset: { dataset: {
persistentFormId: 'wallet-seed', persistentFormId: 'wallet-seed',
}, },
placeholder: this.props.t('secretPhrase'), placeholder: this.context.t('secretPhrase'),
}), }),
// password // password
h('input.large-input.letter-spacey', { h('input.large-input.letter-spacey', {
type: 'password', type: 'password',
id: 'password-box', id: 'password-box',
placeholder: this.props.t('newPassword8Chars'), placeholder: this.context.t('newPassword8Chars'),
dataset: { dataset: {
persistentFormId: 'password', persistentFormId: 'password',
}, },
@ -66,7 +72,7 @@ RestoreVaultScreen.prototype.render = function () {
h('input.large-input.letter-spacey', { h('input.large-input.letter-spacey', {
type: 'password', type: 'password',
id: 'password-box-confirm', id: 'password-box-confirm',
placeholder: this.props.t('confirmPassword'), placeholder: this.context.t('confirmPassword'),
onKeyPress: this.createOnEnter.bind(this), onKeyPress: this.createOnEnter.bind(this),
dataset: { dataset: {
persistentFormId: 'password-confirmation', persistentFormId: 'password-confirmation',
@ -96,7 +102,7 @@ RestoreVaultScreen.prototype.render = function () {
style: { style: {
textTransform: 'uppercase', textTransform: 'uppercase',
}, },
}, this.props.t('cancel')), }, this.context.t('cancel')),
// submit // submit
h('button.primary', { h('button.primary', {
@ -104,7 +110,7 @@ RestoreVaultScreen.prototype.render = function () {
style: { style: {
textTransform: 'uppercase', textTransform: 'uppercase',
}, },
}, this.props.t('ok')), }, this.context.t('ok')),
]), ]),
]) ])
) )
@ -135,13 +141,13 @@ RestoreVaultScreen.prototype.createNewVaultAndRestore = function () {
var passwordConfirmBox = document.getElementById('password-box-confirm') var passwordConfirmBox = document.getElementById('password-box-confirm')
var passwordConfirm = passwordConfirmBox.value var passwordConfirm = passwordConfirmBox.value
if (password.length < 8) { if (password.length < 8) {
this.warning = this.props.t('passwordNotLongEnough') this.warning = this.context.t('passwordNotLongEnough')
this.props.dispatch(actions.displayWarning(this.warning)) this.props.dispatch(actions.displayWarning(this.warning))
return return
} }
if (password !== passwordConfirm) { if (password !== passwordConfirm) {
this.warning = this.props.t('passwordsDontMatch') this.warning = this.context.t('passwordsDontMatch')
this.props.dispatch(actions.displayWarning(this.warning)) this.props.dispatch(actions.displayWarning(this.warning))
return return
} }
@ -151,18 +157,18 @@ RestoreVaultScreen.prototype.createNewVaultAndRestore = function () {
// true if the string has more than a space between words. // true if the string has more than a space between words.
if (seed.split(' ').length > 1) { if (seed.split(' ').length > 1) {
this.warning = this.props.t('spaceBetween') this.warning = this.context.t('spaceBetween')
this.props.dispatch(actions.displayWarning(this.warning)) this.props.dispatch(actions.displayWarning(this.warning))
return return
} }
// true if seed contains a character that is not between a-z or a space // true if seed contains a character that is not between a-z or a space
if (!seed.match(/^[a-z ]+$/)) { if (!seed.match(/^[a-z ]+$/)) {
this.warning = this.props.t('loweCaseWords') this.warning = this.context.t('loweCaseWords')
this.props.dispatch(actions.displayWarning(this.warning)) this.props.dispatch(actions.displayWarning(this.warning))
return return
} }
if (seed.split(' ').length !== 12) { if (seed.split(' ').length !== 12) {
this.warning = this.props.t('seedPhraseReq') this.warning = this.context.t('seedPhraseReq')
this.props.dispatch(actions.displayWarning(this.warning)) this.props.dispatch(actions.displayWarning(this.warning))
return return
} }

@ -1,7 +1,7 @@
const inherits = require('util').inherits const inherits = require('util').inherits
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const connect = require('./metamask-connect') const connect = require('react-redux').connect
module.exports = connect(mapStateToProps)(NewKeychain) module.exports = connect(mapStateToProps)(NewKeychain)

@ -3,6 +3,7 @@ const Component = require('react').Component
const Provider = require('react-redux').Provider const Provider = require('react-redux').Provider
const h = require('react-hyperscript') const h = require('react-hyperscript')
const SelectedApp = require('./select-app') const SelectedApp = require('./select-app')
const I18nProvider = require('./i18n-provider')
module.exports = Root module.exports = Root
@ -15,7 +16,7 @@ Root.prototype.render = function () {
h(Provider, { h(Provider, {
store: this.props.store, store: this.props.store,
}, [ }, [
h(SelectedApp), h(I18nProvider, [ h(SelectedApp) ]),
]) ])
) )

@ -1,6 +1,6 @@
const inherits = require('util').inherits const inherits = require('util').inherits
const Component = require('react').Component const Component = require('react').Component
const connect = require('./metamask-connect') const connect = require('react-redux').connect
const h = require('react-hyperscript') const h = require('react-hyperscript')
const App = require('./app') const App = require('./app')
const OldApp = require('../../old-ui/app/app') const OldApp = require('../../old-ui/app/app')

@ -1,4 +1,5 @@
const { inherits } = require('util') const { inherits } = require('util')
const PropTypes = require('prop-types')
const PersistentForm = require('../lib/persistent-form') const PersistentForm = require('../lib/persistent-form')
const h = require('react-hyperscript') const h = require('react-hyperscript')
@ -29,6 +30,10 @@ const {
} = require('./components/send/send-utils') } = require('./components/send/send-utils')
const { isValidAddress } = require('./util') const { isValidAddress } = require('./util')
SendTransactionScreen.contextTypes = {
t: PropTypes.func,
}
module.exports = SendTransactionScreen module.exports = SendTransactionScreen
inherits(SendTransactionScreen, PersistentForm) inherits(SendTransactionScreen, PersistentForm)
@ -188,9 +193,9 @@ SendTransactionScreen.prototype.renderHeader = function () {
return h('div.page-container__header', [ return h('div.page-container__header', [
h('div.page-container__title', selectedToken ? this.props.t('sendTokens') : this.props.t('sendETH')), h('div.page-container__title', selectedToken ? this.context.t('sendTokens') : this.context.t('sendETH')),
h('div.page-container__subtitle', this.props.t('onlySendToEtherAddress')), h('div.page-container__subtitle', this.context.t('onlySendToEtherAddress')),
h('div.page-container__header-close', { h('div.page-container__header-close', {
onClick: () => { onClick: () => {
@ -261,11 +266,11 @@ SendTransactionScreen.prototype.handleToChange = function (to, nickname = '') {
let toError = null let toError = null
if (!to) { if (!to) {
toError = this.props.t('required') toError = this.context.t('required')
} else if (!isValidAddress(to)) { } else if (!isValidAddress(to)) {
toError = this.props.t('invalidAddressRecipient') toError = this.context.t('invalidAddressRecipient')
} else if (to === from) { } else if (to === from) {
toError = this.props.t('fromToSame') toError = this.context.t('fromToSame')
} }
updateSendTo(to, nickname) updateSendTo(to, nickname)
@ -281,9 +286,9 @@ SendTransactionScreen.prototype.renderToRow = function () {
h('div.send-v2__form-label', [ h('div.send-v2__form-label', [
this.props.t('to'), this.context.t('to'),
this.renderErrorMessage(this.props.t('to')), this.renderErrorMessage(this.context.t('to')),
]), ]),
@ -384,11 +389,11 @@ SendTransactionScreen.prototype.validateAmount = function (value) {
) )
if (conversionRate && !sufficientBalance) { if (conversionRate && !sufficientBalance) {
amountError = this.props.t('insufficientFunds') amountError = this.context.t('insufficientFunds')
} else if (verifyTokenBalance && !sufficientTokens) { } else if (verifyTokenBalance && !sufficientTokens) {
amountError = this.props.t('insufficientTokens') amountError = this.context.t('insufficientTokens')
} else if (amountLessThanZero) { } else if (amountLessThanZero) {
amountError = this.props.t('negativeETH') amountError = this.context.t('negativeETH')
} }
updateSendErrors({ amount: amountError }) updateSendErrors({ amount: amountError })
@ -418,7 +423,7 @@ SendTransactionScreen.prototype.renderAmountRow = function () {
setMaxModeTo(true) setMaxModeTo(true)
this.setAmountToMax() this.setAmountToMax()
}, },
}, [ !maxModeOn ? this.props.t('max') : '' ]), }, [ !maxModeOn ? this.context.t('max') : '' ]),
]), ]),
h('div.send-v2__form-field', [ h('div.send-v2__form-field', [
@ -447,7 +452,7 @@ SendTransactionScreen.prototype.renderGasRow = function () {
return h('div.send-v2__form-row', [ return h('div.send-v2__form-row', [
h('div.send-v2__form-label', h('gasFee')), h('div.send-v2__form-label', this.context.t('gasFee')),
h('div.send-v2__form-field', [ h('div.send-v2__form-field', [
@ -517,11 +522,11 @@ SendTransactionScreen.prototype.renderFooter = function () {
clearSend() clearSend()
goHome() goHome()
}, },
}, this.props.t('cancel')), }, this.context.t('cancel')),
h('button.btn-primary--lg.page-container__footer-button', { h('button.btn-primary--lg.page-container__footer-button', {
disabled: !noErrors || !gasTotal || missingTokenBalance, disabled: !noErrors || !gasTotal || missingTokenBalance,
onClick: event => this.onSubmit(event), onClick: event => this.onSubmit(event),
}, this.props.t('next')), }, this.context.t('next')),
]) ])
} }

@ -1,7 +1,7 @@
const { Component } = require('react') const { Component } = require('react')
const PropTypes = require('prop-types') const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const connect = require('./metamask-connect') const connect = require('react-redux').connect
const actions = require('./actions') const actions = require('./actions')
const infuraCurrencies = require('./infura-conversion.json') const infuraCurrencies = require('./infura-conversion.json')
const validUrl = require('valid-url') const validUrl = require('valid-url')
@ -55,8 +55,8 @@ class Settings extends Component {
return h('div.settings__tabs', [ return h('div.settings__tabs', [
h(TabBar, { h(TabBar, {
tabs: [ tabs: [
{ content: this.props.t('settings'), key: 'settings' }, { content: this.context.t('settings'), key: 'settings' },
{ content: this.props.t('info'), key: 'info' }, { content: this.context.t('info'), key: 'info' },
], ],
defaultTab: activeTab, defaultTab: activeTab,
tabSelected: key => this.setState({ activeTab: key }), tabSelected: key => this.setState({ activeTab: key }),
@ -69,7 +69,7 @@ class Settings extends Component {
return h('div.settings__content-row', [ return h('div.settings__content-row', [
h('div.settings__content-item', [ 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', [
h('div.settings__content-item-col', [ h('div.settings__content-item-col', [
@ -89,13 +89,13 @@ class Settings extends Component {
return h('div.settings__content-row', [ return h('div.settings__content-row', [
h('div.settings__content-item', [ 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('span.settings__content-description', `Updated ${Date(conversionDate)}`),
]), ]),
h('div.settings__content-item', [ h('div.settings__content-item', [
h('div.settings__content-item-col', [ h('div.settings__content-item-col', [
h(SimpleDropdown, { h(SimpleDropdown, {
placeholder: this.props.t('selectCurrency'), placeholder: this.context.t('selectCurrency'),
options: getInfuraCurrencyOptions(), options: getInfuraCurrencyOptions(),
selectedOption: currentCurrency, selectedOption: currentCurrency,
onSelect: newCurrency => setCurrentCurrency(newCurrency), onSelect: newCurrency => setCurrentCurrency(newCurrency),
@ -136,31 +136,31 @@ class Settings extends Component {
switch (provider.type) { switch (provider.type) {
case 'mainnet': case 'mainnet':
title = this.props.t('currentNetwork') title = this.context.t('currentNetwork')
value = this.props.t('mainnet') value = this.context.t('mainnet')
color = '#038789' color = '#038789'
break break
case 'ropsten': case 'ropsten':
title = this.props.t('currentNetwork') title = this.context.t('currentNetwork')
value = this.props.t('ropsten') value = this.context.t('ropsten')
color = '#e91550' color = '#e91550'
break break
case 'kovan': case 'kovan':
title = this.props.t('currentNetwork') title = this.context.t('currentNetwork')
value = this.props.t('kovan') value = this.context.t('kovan')
color = '#690496' color = '#690496'
break break
case 'rinkeby': case 'rinkeby':
title = this.props.t('currentNetwork') title = this.context.t('currentNetwork')
value = this.props.t('rinkeby') value = this.context.t('rinkeby')
color = '#ebb33f' color = '#ebb33f'
break break
default: default:
title = this.props.t('currentRpc') title = this.context.t('currentRpc')
value = provider.rpcTarget value = provider.rpcTarget
} }
@ -181,12 +181,12 @@ class Settings extends Component {
return ( return (
h('div.settings__content-row', [ h('div.settings__content-row', [
h('div.settings__content-item', [ 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', [
h('div.settings__content-item-col', [ h('div.settings__content-item-col', [
h('input.settings__input', { h('input.settings__input', {
placeholder: this.props.t('newRPC'), placeholder: this.context.t('newRPC'),
onChange: event => this.setState({ newRpc: event.target.value }), onChange: event => this.setState({ newRpc: event.target.value }),
onKeyPress: event => { onKeyPress: event => {
if (event.key === 'Enter') { if (event.key === 'Enter') {
@ -199,7 +199,7 @@ class Settings extends Component {
event.preventDefault() event.preventDefault()
this.validateRpc(this.state.newRpc) 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}` const appendedRpc = `http://${newRpc}`
if (validUrl.isWebUri(appendedRpc)) { if (validUrl.isWebUri(appendedRpc)) {
displayWarning(this.props.t('uriErrorMsg')) displayWarning(this.context.t('uriErrorMsg'))
} else { } else {
displayWarning(this.props.t('invalidRPC')) displayWarning(this.context.t('invalidRPC'))
} }
} }
} }
@ -226,10 +226,10 @@ class Settings extends Component {
return ( return (
h('div.settings__content-row', [ h('div.settings__content-row', [
h('div.settings__content-item', [ h('div.settings__content-item', [
h('div', this.props.t('stateLogs')), h('div', this.context.t('stateLogs')),
h( h(
'div.settings__content-description', 'div.settings__content-description',
this.props.t('stateLogsDescription') this.context.t('stateLogsDescription')
), ),
]), ]),
h('div.settings__content-item', [ h('div.settings__content-item', [
@ -238,13 +238,13 @@ class Settings extends Component {
onClick (event) { onClick (event) {
window.logStateString((err, result) => { window.logStateString((err, result) => {
if (err) { if (err) {
this.state.dispatch(actions.displayWarning(this.props.t('stateLogError'))) this.state.dispatch(actions.displayWarning(this.context.t('stateLogError')))
} else { } else {
exportAsFile('MetaMask State Logs.json', result) exportAsFile('MetaMask State Logs.json', result)
} }
}) })
}, },
}, this.props.t('downloadStateLogs')), }, this.context.t('downloadStateLogs')),
]), ]),
]), ]),
]) ])
@ -256,7 +256,7 @@ class Settings extends Component {
return ( return (
h('div.settings__content-row', [ 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', [
h('div.settings__content-item-col', [ h('div.settings__content-item-col', [
h('button.btn-primary--lg.settings__button--red', { h('button.btn-primary--lg.settings__button--red', {
@ -264,7 +264,7 @@ class Settings extends Component {
event.preventDefault() event.preventDefault()
revealSeedConfirmation() revealSeedConfirmation()
}, },
}, this.props.t('revealSeedWords')), }, this.context.t('revealSeedWords')),
]), ]),
]), ]),
]) ])
@ -276,7 +276,7 @@ class Settings extends Component {
return ( return (
h('div.settings__content-row', [ 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', [
h('div.settings__content-item-col', [ h('div.settings__content-item-col', [
h('button.btn-primary--lg.settings__button--orange', { h('button.btn-primary--lg.settings__button--orange', {
@ -284,7 +284,7 @@ class Settings extends Component {
event.preventDefault() event.preventDefault()
setFeatureFlagToBeta() setFeatureFlagToBeta()
}, },
}, this.props.t('useOldUI')), }, this.context.t('useOldUI')),
]), ]),
]), ]),
]) ])
@ -295,7 +295,7 @@ class Settings extends Component {
const { showResetAccountConfirmationModal } = this.props const { showResetAccountConfirmationModal } = this.props
return h('div.settings__content-row', [ 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', [
h('div.settings__content-item-col', [ h('div.settings__content-item-col', [
h('button.btn-primary--lg.settings__button--orange', { h('button.btn-primary--lg.settings__button--orange', {
@ -303,7 +303,7 @@ class Settings extends Component {
event.preventDefault() event.preventDefault()
showResetAccountConfirmationModal() showResetAccountConfirmationModal()
}, },
}, this.props.t('resetAccount')), }, this.context.t('resetAccount')),
]), ]),
]), ]),
]) ])
@ -339,13 +339,13 @@ class Settings extends Component {
renderInfoLinks () { renderInfoLinks () {
return ( return (
h('div.settings__content-item.settings__content-item--without-height', [ 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('div.settings__info-link-item', [
h('a', { h('a', {
href: 'https://metamask.io/privacy.html', href: 'https://metamask.io/privacy.html',
target: '_blank', 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', [ h('div.settings__info-link-item', [
@ -353,7 +353,7 @@ class Settings extends Component {
href: 'https://metamask.io/terms.html', href: 'https://metamask.io/terms.html',
target: '_blank', 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', [ h('div.settings__info-link-item', [
@ -361,7 +361,7 @@ class Settings extends Component {
href: 'https://metamask.io/attributions.html', href: 'https://metamask.io/attributions.html',
target: '_blank', 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'), h('hr.settings__info-separator'),
@ -370,7 +370,7 @@ class Settings extends Component {
href: 'https://support.metamask.io', href: 'https://support.metamask.io',
target: '_blank', 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', [ h('div.settings__info-link-item', [
@ -378,7 +378,7 @@ class Settings extends Component {
href: 'https://metamask.io/', href: 'https://metamask.io/',
target: '_blank', 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', [ h('div.settings__info-link-item', [
@ -386,7 +386,7 @@ class Settings extends Component {
target: '_blank', target: '_blank',
href: 'mailto:help@metamask.io?subject=Feedback', 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-item', [
h( h(
'div.settings__info-about', '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) module.exports = connect(mapStateToProps, mapDispatchToProps)(Settings)

@ -1,7 +1,8 @@
const inherits = require('util').inherits const inherits = require('util').inherits
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const connect = require('./metamask-connect') const connect = require('react-redux').connect
const actions = require('./actions') const actions = require('./actions')
const getCaretCoordinates = require('textarea-caret') const getCaretCoordinates = require('textarea-caret')
const EventEmitter = require('events').EventEmitter const EventEmitter = require('events').EventEmitter
@ -10,8 +11,13 @@ const environmentType = require('../../app/scripts/lib/environment-type')
const Mascot = require('./components/mascot') const Mascot = require('./components/mascot')
UnlockScreen.contextTypes = {
t: PropTypes.func,
}
module.exports = connect(mapStateToProps)(UnlockScreen) module.exports = connect(mapStateToProps)(UnlockScreen)
inherits(UnlockScreen, Component) inherits(UnlockScreen, Component)
function UnlockScreen () { function UnlockScreen () {
Component.call(this) Component.call(this)
@ -40,7 +46,7 @@ UnlockScreen.prototype.render = function () {
textTransform: 'uppercase', textTransform: 'uppercase',
color: '#7F8082', color: '#7F8082',
}, },
}, this.props.t('appName')), }, this.context.t('appName')),
h('input.large-input', { h('input.large-input', {
type: 'password', type: 'password',
@ -66,7 +72,7 @@ UnlockScreen.prototype.render = function () {
style: { style: {
margin: 10, margin: 10,
}, },
}, this.props.t('login')), }, this.context.t('login')),
h('p.pointer', { h('p.pointer', {
onClick: () => { onClick: () => {
@ -80,7 +86,7 @@ UnlockScreen.prototype.render = function () {
color: 'rgb(247, 134, 28)', color: 'rgb(247, 134, 28)',
textDecoration: 'underline', textDecoration: 'underline',
}, },
}, this.props.t('restoreFromSeed')), }, this.context.t('restoreFromSeed')),
h('p.pointer', { h('p.pointer', {
onClick: () => { onClick: () => {
@ -93,7 +99,7 @@ UnlockScreen.prototype.render = function () {
textDecoration: 'underline', textDecoration: 'underline',
marginTop: '32px', marginTop: '32px',
}, },
}, this.props.t('classicInterface')), }, this.context.t('classicInterface')),
]) ])
) )
} }

Loading…
Cancel
Save