diff --git a/web/app/assets/locales/locale-en.js b/web/app/assets/locales/locale-en.js index 38bfcc671..06cb231ec 100644 --- a/web/app/assets/locales/locale-en.js +++ b/web/app/assets/locales/locale-en.js @@ -646,7 +646,10 @@ bids: "Bids", no_data: "No data", time: "Time interval", - borrow: "Borrow" + borrow: "Borrow", + no_balance: "Insufficient balance", + invalid_amount: "Invalid amount", + invalid_price: "Invalid price" }, fees: { title: "Fee Schedule" diff --git a/web/app/components/Exchange/BuySell.jsx b/web/app/components/Exchange/BuySell.jsx index 2a6d14ab2..f41e8973b 100644 --- a/web/app/components/Exchange/BuySell.jsx +++ b/web/app/components/Exchange/BuySell.jsx @@ -66,9 +66,21 @@ class BuySell extends React.Component { let hasBalance = type === "bid" ? balanceAmount >= parseFloat(total) : balanceAmount >= parseFloat(amount); let buttonText = type === "bid" ? counterpart.translate("exchange.buy") : counterpart.translate("exchange.sell"); - let buttonClass = classNames("button buySellButton", type, {disabled: !((balanceAmount > 0 && hasBalance) && amount > 0 && price > 0)}); + let disabled = !((balanceAmount > 0 && hasBalance) && amount > 0 && price > 0); + + let buttonClass = classNames("button buySellButton", type, {disabled: disabled}); let balanceSymbol = type === "bid" ? base.get("symbol") : quote.get("symbol"); + + let noBalance = !(balanceAmount > 0 && hasBalance); + let invalidPrice = !(price > 0); + let invalidAmount = !(amount >0); + + let disabledText = invalidPrice ? counterpart.translate("exchange.invalid_price") : + invalidAmount ? counterpart.translate("exchange.invalid_amount") : + noBalance ? counterpart.translate("exchange.no_balance") : + null; + return (
{`${buttonText} ${quote.get("symbol")}`}
@@ -86,7 +98,7 @@ class BuySell extends React.Component { {base.get("symbol")}/{quote.get("symbol")}
- +
: @@ -137,11 +149,17 @@ class BuySell extends React.Component { {currentPrice ?  {base.get("symbol")}/{quote.get("symbol")} : null}
-
- -
+ {disabledText ? + (
+ +
) : + (
+ +
) + } + - +