From 1a4fc8aaae2ae2f7875406e9013d3ad11d6dcd97 Mon Sep 17 00:00:00 2001 From: Kristie Huang Date: Thu, 6 Jan 2022 23:32:20 -0800 Subject: [PATCH] Add duplicate bid warning --- src/components/bidpage/BidForm.js | 10 +++++++++- src/components/bidpage/BidPageMain.js | 8 ++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/components/bidpage/BidForm.js b/src/components/bidpage/BidForm.js index 2b1c66f..e4f8c55 100644 --- a/src/components/bidpage/BidForm.js +++ b/src/components/bidpage/BidForm.js @@ -45,7 +45,7 @@ const PlaceBidButton = styled(Button)` } `; -const BidForm = () => { +const BidForm = ({ props }) => { const { t } = useTranslation(); const { yobot, isAuthed, balance, address, refreshEvents } = useYobot(); const [validParams, setValidParams] = useState(false); @@ -284,11 +284,19 @@ const BidForm = () => { ) : ( "" )} + {isAuthed && props.alreadyPlacedBid ? ( + + You've already placed a bid on this project. + + ) : ( + "" + )} {!isAuthed ? ( ) : ( { const [totalBids, setTotalBids] = useState("-"); const [highestBidInWei, setHighestBidInWei] = useState("-"); const [gettingActions, setGettingActions] = useState(true); + const [alreadyPlacedBid, setAlreadyPlacedBid] = useState(false); const fetchUserOrdersAndTotalStats = async () => { let _placed_orders = []; @@ -48,9 +49,6 @@ const BidPageMain = ({ projectId }) => { let _token_address = values["1"]; let _action_taken = values["4"]; - // orders[msg.sender][_tokenAddress]; - // for all orders for this token address, add qty - // TODO: implement orderID so easier to lookup orders to update order status & get stats... Otherwise need to loop thru all txs // For this NFT contract, @@ -107,6 +105,8 @@ const BidPageMain = ({ projectId }) => { _cancelled_orders.reverse() ); + setAlreadyPlacedBid(_placed_orders.length > 0); + const highestBidInWei = Math.max( highestFilledBidInWei, Math.max(...Object.values(placedBidValuesForProject)) @@ -168,7 +168,7 @@ const BidPageMain = ({ projectId }) => {
- +