diff --git a/src/components/catalog/views/page/layout/marketplace/MarketplacePostOfferView.tsx b/src/components/catalog/views/page/layout/marketplace/MarketplacePostOfferView.tsx index f9f614d5..9c649fe0 100644 --- a/src/components/catalog/views/page/layout/marketplace/MarketplacePostOfferView.tsx +++ b/src/components/catalog/views/page/layout/marketplace/MarketplacePostOfferView.tsx @@ -9,10 +9,22 @@ export const MarketplacePostOfferView : FC<{}> = props => { const [ item, setItem ] = useState(null); const [ askingPrice, setAskingPrice ] = useState(0); + const [ tempAskingPrice, setTempAskingPrice ] = useState('0'); const { catalogOptions = null, setCatalogOptions = null } = useCatalog(); const { marketplaceConfiguration = null } = catalogOptions; const { showConfirm = null } = useNotification(); + const updateAskingPrice = (price: string) => + { + setTempAskingPrice(price); + + const newValue = parseInt(price); + + if(isNaN(newValue) || (newValue === askingPrice)) return; + + setAskingPrice(parseInt(price)); + } + useMessageEvent(MarketplaceConfigurationEvent, event => { const parser = event.getParser(); @@ -64,7 +76,7 @@ export const MarketplacePostOfferView : FC<{}> = props => setItem(null) }, null, null, LocalizeText('inventory.marketplace.confirm_offer.title')); } - + return ( setItem(null) } /> @@ -83,7 +95,7 @@ export const MarketplacePostOfferView : FC<{}> = props => { LocalizeText('inventory.marketplace.make_offer.expiration_info', [ 'time' ], [ marketplaceConfiguration.offerTime.toString() ]) }
- setAskingPrice(parseInt(event.target.value)) } placeholder={ LocalizeText('inventory.marketplace.make_offer.price_request') } /> + updateAskingPrice(event.target.value) } placeholder={ LocalizeText('inventory.marketplace.make_offer.price_request') } /> { ((askingPrice < marketplaceConfiguration.minimumPrice) || isNaN(askingPrice)) && { LocalizeText('inventory.marketplace.make_offer.min_price', [ 'minprice' ], [ marketplaceConfiguration.minimumPrice.toString() ]) }