Merge pull request #1475 from lbryio/disable-zero-tip
disable Send button when tip amount is zero
This commit is contained in:
commit
c790f1158f
2 changed files with 6 additions and 2 deletions
|
@ -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 => ({
|
||||
|
|
|
@ -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 }} />
|
||||
|
|
Loading…
Reference in a new issue