Merge pull request #1475 from lbryio/disable-zero-tip

disable Send button when tip amount is zero
This commit is contained in:
Sean Yesmunt 2018-05-16 11:07:22 -04:00 committed by GitHub
commit c790f1158f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -4,6 +4,7 @@ import {
makeSelectTitleForUri,
makeSelectClaimForUri,
selectIsSendingSupport,
selectBalance,
} from 'lbry-redux';
import WalletSendTip from './view';
@ -11,6 +12,7 @@ const select = (state, props) => ({
isPending: selectIsSendingSupport(state),
title: makeSelectTitleForUri(props.uri)(state),
claim: makeSelectClaimForUri(props.uri)(state),
balance: selectBalance(state),
});
const perform = dispatch => ({

View file

@ -14,6 +14,7 @@ type Props = {
sendSupport: (number, string, string) => void,
onCancel: () => void,
sendTipCallback?: () => void,
balance: number,
};
type State = {
@ -51,7 +52,8 @@ class WalletSendTip extends React.PureComponent<Props, State> {
}
render() {
const { title, errorMessage, isPending, uri, onCancel } = this.props;
const { title, errorMessage, isPending, uri, onCancel, balance } = this.props;
const { amount } = this.state;
return (
<div>
@ -82,7 +84,7 @@ class WalletSendTip extends React.PureComponent<Props, State> {
<Button
button="primary"
label={__('Send')}
disabled={isPending}
disabled={isPending || amount <= 0 || amount > balance}
onClick={this.handleSendButtonClicked}
/>
<Button button="alt" label={__('Cancel')} onClick={onCancel} navigateParams={{ uri }} />