Merge pull request #1947 from jessopb/fixTipModal

fix: checks tip input re:#1889
This commit is contained in:
Sean Yesmunt 2018-09-12 11:21:07 -04:00 committed by GitHub
commit 923fac18d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -50,6 +50,9 @@ class WalletSendTip extends React.PureComponent<Props, State> {
const { balance } = this.props; const { balance } = this.props;
const tipAmount = parseFloat(event.target.value); const tipAmount = parseFloat(event.target.value);
let newTipError; let newTipError;
if (!String(tipAmount).match(/^(\d*([.]\d{0,8})?)$/)) {
newTipError = __('Tip must be a valid number with no more than 8 decimal places');
}
if (tipAmount === balance) { if (tipAmount === balance) {
newTipError = __('Please decrease your tip to account for transaction fees'); newTipError = __('Please decrease your tip to account for transaction fees');
} else if (tipAmount > balance) { } else if (tipAmount > balance) {