Skip to content

Commit

Permalink
Merge pull request #113 from PotLock/staging
Browse files Browse the repository at this point in the history
Staging => main
  • Loading branch information
M-Rb3 authored May 20, 2024
2 parents 2126578 + 02e8408 commit c4b3238
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/modals/ModalDonation/AmountInput/AmountInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@ const AmountInput = (props: any) => {
},
onChange: ({ value }: any) => {
const tokenBalance = parseFloat(getTokenBalance(value));

updateState({
selectedDenomination: denominationOptions.find((option: any) => option.value === value),
amountError:
tokenBalance > parseFloat(amount) ? "" : "You don’t have enough balance to complete this transaction.",
tokenBalance !== null
? tokenBalance > parseFloat(amount)
? ""
: "You don’t have enough balance to complete this transaction."
: "",
});
},
containerStyles: {
Expand Down
4 changes: 3 additions & 1 deletion src/modals/ModalDonation/FormPot/FormPot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const FormPot = ({
if (amount === ".") amount = "0.";
updateState({ amount, amountError: "" });
// error if amount is greater than balance
if (amount > ftBalance) {
if (amount > ftBalance && ftBalance) {
updateState({ amountError: "You don’t have enough balance to complete this transaction." });
} else if (parseFloat(amount) < 0.1) {
updateState({ amountError: "Minimum donation is 0.1 NEAR" });
Expand Down Expand Up @@ -87,6 +87,8 @@ const FormPot = ({
let totalAmount = 0;
Object.values(updatedProjects).forEach((amount: any) => (totalAmount += parseFloat(amount)));

console.log("ftBalance", ftBalance);

if (totalAmount > ftBalance && ftBalance !== null) {
updateState({ amountError: "You don’t have enough balance to complete this transaction." });
} else if (parseFloat(amount) < 0.1 && parseFloat(amount) !== 0) {
Expand Down

0 comments on commit c4b3238

Please sign in to comment.