aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/coinbase-form.js
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2017-06-13 04:27:04 +0800
committerGitHub <noreply@github.com>2017-06-13 04:27:04 +0800
commit27220b7bcd5ea1ebdae3bc1b494d28d9c828918c (patch)
treec9385fba3d742ca9cbfb9f3b4c6c9ef29c4f4a1b /ui/app/components/coinbase-form.js
parent57d1a1f1860e50837104a10b7b9f86d398c795ec (diff)
parent8af41f1b0539e70cf4c6e1f4a9f4b10ad13656fc (diff)
downloadtangerine-wallet-browser-27220b7bcd5ea1ebdae3bc1b494d28d9c828918c.tar
tangerine-wallet-browser-27220b7bcd5ea1ebdae3bc1b494d28d9c828918c.tar.gz
tangerine-wallet-browser-27220b7bcd5ea1ebdae3bc1b494d28d9c828918c.tar.bz2
tangerine-wallet-browser-27220b7bcd5ea1ebdae3bc1b494d28d9c828918c.tar.lz
tangerine-wallet-browser-27220b7bcd5ea1ebdae3bc1b494d28d9c828918c.tar.xz
tangerine-wallet-browser-27220b7bcd5ea1ebdae3bc1b494d28d9c828918c.tar.zst
tangerine-wallet-browser-27220b7bcd5ea1ebdae3bc1b494d28d9c828918c.zip
Merge branch 'master' into i#1203MainNetSwitch
Diffstat (limited to 'ui/app/components/coinbase-form.js')
-rw-r--r--ui/app/components/coinbase-form.js114
1 files changed, 9 insertions, 105 deletions
diff --git a/ui/app/components/coinbase-form.js b/ui/app/components/coinbase-form.js
index 40f5719bb..f44d86045 100644
--- a/ui/app/components/coinbase-form.js
+++ b/ui/app/components/coinbase-form.js
@@ -4,7 +4,6 @@ const inherits = require('util').inherits
const connect = require('react-redux').connect
const actions = require('../actions')
-const isValidAddress = require('../util').isValidAddress
module.exports = connect(mapStateToProps)(CoinbaseForm)
function mapStateToProps (state) {
@@ -21,105 +20,36 @@ function CoinbaseForm () {
CoinbaseForm.prototype.render = function () {
var props = this.props
- var amount = props.buyView.amount
- var address = props.buyView.buyAddress
return h('.flex-column', {
style: {
- // margin: '10px',
+ marginTop: '35px',
padding: '25px',
+ width: '100%',
},
}, [
- h('.flex-column', {
- style: {
- alignItems: 'flex-start',
- },
- }, [
- h('.flex-row', [
- h('div', 'Address:'),
- h('.ellip-address', address),
- ]),
- h('.flex-row', [
- h('div', 'Amount: $'),
- h('.input-container', [
- h('input.buy-inputs', {
- style: {
- width: '3em',
- boxSizing: 'border-box',
- },
- defaultValue: amount,
- onChange: this.handleAmount.bind(this),
- }),
- h('i.fa.fa-pencil-square-o.edit-text', {
- style: {
- fontSize: '12px',
- color: '#F7861C',
- position: 'relative',
- bottom: '5px',
- right: '11px',
- },
- }),
- ]),
- ]),
- ]),
-
- h('.info-gray', {
- style: {
- fontSize: '10px',
- fontFamily: 'Montserrat Light',
- margin: '15px',
- lineHeight: '13px',
- },
- },
- `there is a USD$ 15 a day max and a USD$ 50
- dollar limit per the life time of an account without a
- coinbase account. A fee of 3.75% will be aplied to debit/credit cards.`),
-
- !props.warning ? h('div', {
- style: {
- width: '340px',
- height: '22px',
- },
- }) : props.warning && h('span.error.flex-center', props.warning),
-
-
h('.flex-row', {
style: {
justifyContent: 'space-around',
margin: '33px',
+ marginTop: '0px',
},
}, [
- h('button', {
+ h('button.btn-green', {
onClick: this.toCoinbase.bind(this),
}, 'Continue to Coinbase'),
- h('button', {
+ h('button.btn-red', {
onClick: () => props.dispatch(actions.backTobuyView(props.accounts.address)),
}, 'Cancel'),
]),
])
}
-CoinbaseForm.prototype.handleAmount = function (event) {
- this.props.dispatch(actions.updateCoinBaseAmount(event.target.value))
-}
-CoinbaseForm.prototype.handleAddress = function (event) {
- this.props.dispatch(actions.updateBuyAddress(event.target.value))
-}
-CoinbaseForm.prototype.toCoinbase = function () {
- var props = this.props
- var amount = props.buyView.amount
- var address = props.buyView.buyAddress
- var message
- if (isValidAddress(address) && isValidAmountforCoinBase(amount).valid) {
- props.dispatch(actions.buyEth(address, props.buyView.amount))
- } else if (!isValidAmountforCoinBase(amount).valid) {
- message = isValidAmountforCoinBase(amount).message
- return props.dispatch(actions.displayWarning(message))
- } else {
- message = 'Receiving address is invalid.'
- return props.dispatch(actions.displayWarning(message))
- }
+CoinbaseForm.prototype.toCoinbase = function () {
+ const props = this.props
+ const address = props.buyView.buyAddress
+ props.dispatch(actions.buyEth({ network: '1', address, amount: 0 }))
}
CoinbaseForm.prototype.renderLoading = function () {
@@ -131,29 +61,3 @@ CoinbaseForm.prototype.renderLoading = function () {
src: 'images/loading.svg',
})
}
-
-function isValidAmountforCoinBase (amount) {
- amount = parseFloat(amount)
- if (amount) {
- if (amount <= 15 && amount > 0) {
- return {
- valid: true,
- }
- } else if (amount > 15) {
- return {
- valid: false,
- message: 'The amount can not be greater then $15',
- }
- } else {
- return {
- valid: false,
- message: 'Can not buy amounts less then $0',
- }
- }
- } else {
- return {
- valid: false,
- message: 'The amount entered is not a number',
- }
- }
-}