2016-08-10 22:43:01 +02:00
|
|
|
const Component = require('react').Component
|
|
|
|
const h = require('react-hyperscript')
|
|
|
|
const inherits = require('util').inherits
|
|
|
|
const connect = require('react-redux').connect
|
|
|
|
const actions = require('../actions')
|
|
|
|
|
|
|
|
module.exports = connect(mapStateToProps)(CoinbaseForm)
|
|
|
|
|
2016-11-11 19:26:12 +01:00
|
|
|
function mapStateToProps (state) {
|
2016-08-10 22:43:01 +02:00
|
|
|
return {
|
|
|
|
warning: state.appState.warning,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
inherits(CoinbaseForm, Component)
|
|
|
|
|
2016-11-11 19:26:12 +01:00
|
|
|
function CoinbaseForm () {
|
2016-08-10 22:43:01 +02:00
|
|
|
Component.call(this)
|
|
|
|
}
|
|
|
|
|
|
|
|
CoinbaseForm.prototype.render = function () {
|
|
|
|
var props = this.props
|
|
|
|
|
|
|
|
return h('.flex-column', {
|
|
|
|
style: {
|
2017-04-24 12:58:01 +02:00
|
|
|
marginTop: '35px',
|
2016-08-13 00:41:59 +02:00
|
|
|
padding: '25px',
|
2017-04-18 18:21:24 +02:00
|
|
|
width: '100%',
|
2016-08-10 22:43:01 +02:00
|
|
|
},
|
|
|
|
}, [
|
|
|
|
h('.flex-row', {
|
|
|
|
style: {
|
|
|
|
justifyContent: 'space-around',
|
|
|
|
margin: '33px',
|
2017-04-18 18:21:24 +02:00
|
|
|
marginTop: '0px',
|
2016-08-10 22:43:01 +02:00
|
|
|
},
|
|
|
|
}, [
|
2017-04-24 12:58:01 +02:00
|
|
|
h('button.btn-green', {
|
2016-08-10 22:43:01 +02:00
|
|
|
onClick: this.toCoinbase.bind(this),
|
|
|
|
}, 'Continue to Coinbase'),
|
|
|
|
|
2017-04-24 12:58:01 +02:00
|
|
|
h('button.btn-red', {
|
2017-12-08 17:39:53 +01:00
|
|
|
onClick: () => props.dispatch(actions.goHome()),
|
2016-08-10 22:43:01 +02:00
|
|
|
}, 'Cancel'),
|
|
|
|
]),
|
|
|
|
])
|
|
|
|
}
|
2017-04-23 19:18:14 +02:00
|
|
|
|
2016-08-10 22:43:01 +02:00
|
|
|
CoinbaseForm.prototype.toCoinbase = function () {
|
2017-04-18 18:21:24 +02:00
|
|
|
const props = this.props
|
|
|
|
const address = props.buyView.buyAddress
|
|
|
|
props.dispatch(actions.buyEth({ network: '1', address, amount: 0 }))
|
2016-08-10 22:43:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
CoinbaseForm.prototype.renderLoading = function () {
|
|
|
|
return h('img', {
|
|
|
|
style: {
|
|
|
|
width: '27px',
|
|
|
|
marginRight: '-27px',
|
|
|
|
},
|
|
|
|
src: 'images/loading.svg',
|
|
|
|
})
|
|
|
|
}
|