Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Merge pull request #2667 from ethcore/jg-gavcoin-no-accounts
Browse files Browse the repository at this point in the history
Don't allow gavcoin transfer with no balances
  • Loading branch information
jacogr authored Oct 17, 2016
2 parents 948763d + b839bfc commit 6122231
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
27 changes: 18 additions & 9 deletions js/src/dapps/gavcoin/Actions/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,20 @@ import React, { Component, PropTypes } from 'react';

import { RaisedButton } from 'material-ui';
import ActionAddShoppingCart from 'material-ui/svg-icons/action/add-shopping-cart';
import AvReplay from 'material-ui/svg-icons/av/replay';
// import AvReplay from 'material-ui/svg-icons/av/replay';
import ContentSend from 'material-ui/svg-icons/content/send';

import styles from './actions.css';

export default class Actions extends Component {
static propTypes = {
onAction: PropTypes.func.isRequired
onAction: PropTypes.func.isRequired,
gavBalance: PropTypes.object.isRequired
}

render () {
const { gavBalance } = this.props;

return (
<div className={ styles.actions }>
<RaisedButton
Expand All @@ -38,27 +41,33 @@ export default class Actions extends Component {
primary
onTouchTap={ this.onBuyIn } />
<RaisedButton
disabled={ !gavBalance || gavBalance.eq(0) }
className={ styles.button }
icon={ <ContentSend /> }
label='send coins'
primary
onTouchTap={ this.onTransfer } />
<RaisedButton
className={ styles.button }
icon={ <AvReplay /> }
label='claim refund'
primary
onTouchTap={ this.onRefund } />
</div>
);

// <RaisedButton
// className={ styles.button }
// icon={ <AvReplay /> }
// label='claim refund'
// primary
// onTouchTap={ this.onRefund } />
}

onBuyIn = () => {
this.props.onAction('BuyIn');
}

onTransfer = () => {
this.props.onAction('Transfer');
const { gavBalance } = this.props;

if (gavBalance && gavBalance.gt(0)) {
this.props.onAction('Transfer');
}
}

onRefund = () => {
Expand Down
1 change: 1 addition & 0 deletions js/src/dapps/gavcoin/Application/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export default class Application extends Component {
accounts={ accounts } />
</Status>
<Actions
gavBalance={ gavBalance }
onAction={ this.onAction } />
<Events
accounts={ accounts } />
Expand Down

0 comments on commit 6122231

Please sign in to comment.