Fix references to undefined 'this.props'

feature/default_network_editable
Dan 7 years ago
parent 3c144302d6
commit 18f8583529
  1. 22
      ui/app/accounts/import/index.js
  2. 26
      ui/app/components/modals/deposit-ether-modal.js

@ -9,26 +9,24 @@ const JsonImportView = require('./json.js')
const PrivateKeyImportView = require('./private-key.js')
module.exports = connect(mapStateToProps)(AccountImportSubview)
function mapStateToProps (state) {
return {
menuItems: [
this.props.t('privateKey'),
this.props.t('jsonFile'),
],
}
}
module.exports = connect()(AccountImportSubview)
inherits(AccountImportSubview, Component)
function AccountImportSubview () {
Component.call(this)
}
AccountImportSubview.prototype.getMenuItemTexts = function () {
return [
this.props.t('privateKey'),
this.props.t('jsonFile'),
]
}
AccountImportSubview.prototype.render = function () {
const props = this.props
const state = this.state || {}
const { menuItems } = props
const menuItems = this.getMenuItemTexts()
const { type } = state
return (
@ -80,7 +78,7 @@ AccountImportSubview.prototype.renderImportView = function () {
const props = this.props
const state = this.state || {}
const { type } = state
const { menuItems } = props
const menuItems = this.getMenuItemTexts()
const current = type || menuItems[0]
switch (current) {

@ -14,10 +14,6 @@ let SHAPESHIFT_ROW_TITLE
let SHAPESHIFT_ROW_TEXT
let FAUCET_ROW_TITLE
const facuetRowText = (networkName) => {
return this.props.t('getEtherFromFaucet', [networkName])
}
function mapStateToProps (state) {
return {
network: state.metamask.network,
@ -44,17 +40,17 @@ function mapDispatchToProps (dispatch) {
}
inherits(DepositEtherModal, Component)
function DepositEtherModal () {
function DepositEtherModal (props) {
Component.call(this)
// need to set after i18n locale has loaded
DIRECT_DEPOSIT_ROW_TITLE = this.props.t('directDepositEther')
DIRECT_DEPOSIT_ROW_TEXT = this.props.t('directDepositEtherExplainer')
COINBASE_ROW_TITLE = this.props.t('buyCoinbase')
COINBASE_ROW_TEXT = this.props.t('buyCoinbaseExplainer')
SHAPESHIFT_ROW_TITLE = this.props.t('depositShapeShift')
SHAPESHIFT_ROW_TEXT = this.props.t('depositShapeShiftExplainer')
FAUCET_ROW_TITLE = this.props.t('testFaucet')
DIRECT_DEPOSIT_ROW_TITLE = props.t('directDepositEther')
DIRECT_DEPOSIT_ROW_TEXT = props.t('directDepositEtherExplainer')
COINBASE_ROW_TITLE = props.t('buyCoinbase')
COINBASE_ROW_TEXT = props.t('buyCoinbaseExplainer')
SHAPESHIFT_ROW_TITLE = props.t('depositShapeShift')
SHAPESHIFT_ROW_TEXT = props.t('depositShapeShiftExplainer')
FAUCET_ROW_TITLE = props.t('testFaucet')
this.state = {
buyingWithShapeshift: false,
@ -63,6 +59,10 @@ function DepositEtherModal () {
module.exports = connect(mapStateToProps, mapDispatchToProps)(DepositEtherModal)
DepositEtherModal.prototype.facuetRowText = function (networkName) {
return this.props.t('getEtherFromFaucet', [networkName])
}
DepositEtherModal.prototype.renderRow = function ({
logo,
title,
@ -156,7 +156,7 @@ DepositEtherModal.prototype.render = function () {
this.renderRow({
logo: h('i.fa.fa-tint.fa-2x'),
title: FAUCET_ROW_TITLE,
text: facuetRowText(networkName),
text: this.facuetRowText(networkName),
buttonLabel: this.props.t('getEther'),
onButtonClick: () => toFaucet(network),
hide: !isTestNetwork || buyingWithShapeshift,

Loading…
Cancel
Save