mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-26 20:39:08 +01:00
Deposit button shows link to faucet on testnet networks.
This commit is contained in:
parent
08d9ecc045
commit
544166437a
@ -3,6 +3,7 @@ const h = require('react-hyperscript')
|
|||||||
const inherits = require('util').inherits
|
const inherits = require('util').inherits
|
||||||
const connect = require('react-redux').connect
|
const connect = require('react-redux').connect
|
||||||
const actions = require('../../actions')
|
const actions = require('../../actions')
|
||||||
|
const networkNames = require('../../../../app/scripts/config.js').networkNames
|
||||||
|
|
||||||
function mapStateToProps (state) {
|
function mapStateToProps (state) {
|
||||||
return {
|
return {
|
||||||
@ -22,6 +23,7 @@ function mapDispatchToProps (dispatch) {
|
|||||||
showAccountDetailModal: () => {
|
showAccountDetailModal: () => {
|
||||||
dispatch(actions.showModal({ name: 'ACCOUNT_DETAILS' }))
|
dispatch(actions.showModal({ name: 'ACCOUNT_DETAILS' }))
|
||||||
},
|
},
|
||||||
|
toFaucet: network => dispatch(actions.buyEth({ network })),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,7 +34,20 @@ function BuyOptions () {
|
|||||||
|
|
||||||
module.exports = connect(mapStateToProps, mapDispatchToProps)(BuyOptions)
|
module.exports = connect(mapStateToProps, mapDispatchToProps)(BuyOptions)
|
||||||
|
|
||||||
|
BuyOptions.prototype.renderModalContentOption = function (title, header, onClick) {
|
||||||
|
return h('div.buy-modal-content-option', {
|
||||||
|
onClick,
|
||||||
|
}, [
|
||||||
|
h('div.buy-modal-content-option-title', {}, title),
|
||||||
|
h('div.buy-modal-content-option-subtitle', {}, header),
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
BuyOptions.prototype.render = function () {
|
BuyOptions.prototype.render = function () {
|
||||||
|
const { network, toCoinbase, address, toFaucet } = this.props
|
||||||
|
const networkIsTest = ['3', '4', '42'].find(n => n === network)
|
||||||
|
const networkName = networkNames[network]
|
||||||
|
|
||||||
return h('div', {}, [
|
return h('div', {}, [
|
||||||
h('div.buy-modal-content.transfers-subview', {
|
h('div.buy-modal-content.transfers-subview', {
|
||||||
}, [
|
}, [
|
||||||
@ -47,27 +62,20 @@ BuyOptions.prototype.render = function () {
|
|||||||
|
|
||||||
h('div.buy-modal-content-options.flex-column.flex-center', {}, [
|
h('div.buy-modal-content-options.flex-column.flex-center', {}, [
|
||||||
|
|
||||||
h('div.buy-modal-content-option', {
|
networkIsTest
|
||||||
onClick: () => {
|
? this.renderModalContentOption(networkName, 'Test Faucet', () => toFaucet(network))
|
||||||
const { toCoinbase, address } = this.props
|
: this.renderModalContentOption('Coinbase', 'Deposit with Fiat', () => toCoinbase(address)),
|
||||||
toCoinbase(address)
|
|
||||||
},
|
|
||||||
}, [
|
|
||||||
h('div.buy-modal-content-option-title', {}, 'Coinbase'),
|
|
||||||
h('div.buy-modal-content-option-subtitle', {}, 'Deposit with Fiat'),
|
|
||||||
]),
|
|
||||||
|
|
||||||
// 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'),
|
||||||
// h('div.buy-modal-content-option-subtitle', {}, 'Trade any digital asset for any other'),
|
// h('div.buy-modal-content-option-subtitle', {}, 'Trade any digital asset for any other'),
|
||||||
// ]),
|
// ]),
|
||||||
|
|
||||||
h('div.buy-modal-content-option', {
|
this.renderModalContentOption(
|
||||||
onClick: () => this.goToAccountDetailsModal(),
|
'Direct Deposit',
|
||||||
}, [
|
'Deposit from another account',
|
||||||
h('div.buy-modal-content-option-title', {}, 'Direct Deposit'),
|
() => this.goToAccountDetailsModal()
|
||||||
h('div.buy-modal-content-option-subtitle', {}, 'Deposit from another account'),
|
),
|
||||||
]),
|
|
||||||
|
|
||||||
]),
|
]),
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user