Fix issues with modals (#12)

* Correctly visualize that USDC could not be found in users wallet
* fix contribution modal message
* solve some rounding issues
This commit is contained in:
Maximilian Schneider 2021-08-06 19:45:42 +02:00 committed by GitHub
parent 52b0b62e1c
commit 4386d5ea86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

View File

@ -153,6 +153,8 @@ const ContributionModal = () => {
}
}, [submitting])
const hasUSDC = usdcBalance > 0 || redeemableBalance > 0
const toLateToDeposit =
endDeposits?.isBefore() && endIdo.isAfter() && !largestAccounts.redeemable
@ -224,7 +226,9 @@ const ContributionModal = () => {
<div className="flex items-center text-xs text-fgd-4">
<a
onClick={handleRefresh}
className={refreshing ? 'animate-spin' : 'hover:cursor-pointer'}
className={
refreshing ? 'animate-spin' : 'hover:cursor-pointer'
}
>
<RefreshIcon
className={`w-4 h-4`}
@ -317,8 +321,10 @@ const ContributionModal = () => {
>
<div className={`flex items-center justify-center`}>
{dontAddMore
? 'Sorry you cant add anymore 🥲'
: 'Set Contribution'}
? "Sorry you can't add anymore 🥲"
: hasUSDC || !connected
? 'Set Contribution'
: 'Loading USDC balance 💦'}
</div>
</Button>
</div>

View File

@ -12,6 +12,7 @@ const StatsModal = () => {
// : 0
const priceFormat = new Intl.NumberFormat('en-US', {
minimumSignificantDigits: 4,
maximumSignificantDigits: 4,
})

View File

@ -31,6 +31,6 @@ export function calculateNativeAmountUnsafe(
amount: number
): BN {
const mint = mints[pk.toBase58()]
const nativeAmount = amount * Math.pow(10, mint.decimals)
const nativeAmount = Math.round(amount * Math.pow(10, mint.decimals))
return new BN(nativeAmount.toString())
}