1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-23 18:41:38 +01:00
metamask-extension/ui/app/components/coinbase-form.js

70 lines
1.5 KiB
JavaScript
Raw Normal View History

2016-08-10 22:43:01 +02:00
const Component = require('react').Component
const PropTypes = require('prop-types')
2016-08-10 22:43:01 +02:00
const h = require('react-hyperscript')
const inherits = require('util').inherits
const connect = require('react-redux').connect
2016-08-10 22:43:01 +02:00
const actions = require('../actions')
CoinbaseForm.contextTypes = {
t: PropTypes.func,
}
2016-08-10 22:43:01 +02:00
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',
padding: '25px',
width: '100%',
2016-08-10 22:43:01 +02:00
},
}, [
h('.flex-row', {
style: {
justifyContent: 'space-around',
margin: '33px',
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),
}, this.context.t('continueToCoinbase')),
2016-08-10 22:43:01 +02:00
2017-04-24 12:58:01 +02:00
h('button.btn-red', {
onClick: () => props.dispatch(actions.goHome()),
}, this.context.t('cancel')),
2016-08-10 22:43:01 +02:00
]),
])
}
2017-04-23 19:18:14 +02:00
2016-08-10 22:43:01 +02:00
CoinbaseForm.prototype.toCoinbase = function () {
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',
})
}