diff --git a/app/pages/Auction/BidActionPanel/BidNow.js b/app/pages/Auction/BidActionPanel/BidNow.js index 6044999be..c7866128a 100644 --- a/app/pages/Auction/BidActionPanel/BidNow.js +++ b/app/pages/Auction/BidActionPanel/BidNow.js @@ -1,6 +1,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; +import {consensus} from 'hsd/lib/protocol'; import { AuctionPanel, AuctionPanelFooter, @@ -105,6 +106,15 @@ class BidNow extends Component { } } + processValue = (val, field) => { + const value = val.match(/[0-9]*\.?[0-9]{0,6}/g)[0]; + if (Number.isNaN(parseFloat(value))) + return; + if (value * consensus.COIN > consensus.MAX_MONEY) + return; + this.setState({[field]: value}); + } + render() { const {domain} = this.props; @@ -162,6 +172,7 @@ class BidNow extends Component { renderBiddingView() { const { bidAmount, + disguiseAmount } = this.state; const {spendableBalance} = this.props; @@ -174,9 +185,8 @@ class BidNow extends Component {
Bid Amount:
this.setState({bidAmount: e.target.value})} + onChange={e => this.processValue(e.target.value, 'bidAmount')} value={bidAmount} />
@@ -186,7 +196,8 @@ class BidNow extends Component { @@ -225,9 +236,8 @@ class BidNow extends Component {
this.setState({disguiseAmount: e.target.value})} + onChange={e => this.processValue(e.target.value, 'disguiseAmount')} value={disguiseAmount} />
@@ -408,7 +418,7 @@ function getTotalBids(domain) { for (const {bid} of domain.bids) { if (bid.own) { // This is our bid, but we don't know its value - if (!bid.value) + if (bid.value == null) return -1; total += bid.value; diff --git a/app/pages/Auction/BidHistory.js b/app/pages/Auction/BidHistory.js index 2786ef370..ddf5444b9 100644 --- a/app/pages/Auction/BidHistory.js +++ b/app/pages/Auction/BidHistory.js @@ -61,12 +61,12 @@ export default class BidHistory extends Component { const bid = map[fromAddress]; const {month, day, year} = bid.date; let bidValue = 'Hidden Until Reveal'; - if (!bid.bid && bid.own) { + if (bid.bid == null && bid.own) { bidValue = ; } - if (bid.bid) + if (bid.bid != null) bidValue = displayBalance(bid.bid, true); return (