Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Commit

Permalink
Displaying the max amount on hover also on success view
Browse files Browse the repository at this point in the history
  • Loading branch information
Leandro committed Jan 25, 2022
1 parent af2ddb6 commit 8b9cccd
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/custom/pages/Claim/ClaimingStatus.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { CurrencyAmount } from '@uniswap/sdk-core'
import { Trans } from '@lingui/macro'
import { ConfirmOrLoadingWrapper, ConfirmedIcon, AttemptFooter, CowSpinner } from 'pages/Claim/styled'
import { ClaimStatus } from 'state/claim/actions'
Expand All @@ -12,6 +13,8 @@ import { EnhancedTransactionLink } from 'components/EnhancedTransactionLink'
import { ExplorerDataType } from 'utils/getExplorerLink'
import { V_COW } from 'constants/tokens'
import AddToMetamask from 'components/AddToMetamask'
import { formatMax, formatSmartLocaleAware } from 'utils/format'
import { AMOUNT_PRECISION } from 'constants/index'

export default function ClaimingStatus() {
const { chainId, account } = useActiveWeb3React()
Expand All @@ -33,6 +36,11 @@ export default function ClaimingStatus() {

const currency = chainId ? V_COW[chainId] : undefined

const vCowAmount = currency && CurrencyAmount.fromRawAmount(currency, claimedAmount)

const formattedVCowAmount = formatSmartLocaleAware(vCowAmount, AMOUNT_PRECISION)
const formattedMaxVCowAmount = vCowAmount?.greaterThan('0') ? formatMax(vCowAmount, currency?.decimals) : ''

return (
<ConfirmOrLoadingWrapper activeBG={true}>
<ConfirmedIcon>
Expand All @@ -45,15 +53,19 @@ export default function ClaimingStatus() {
)}
</ConfirmedIcon>
<h3>{isConfirmed ? 'Claimed!' : 'Claiming'}</h3>
{!isConfirmed && <Trans>{claimedAmount} vCOW</Trans>}
{!isConfirmed && (
<Trans>
<span title={formattedMaxVCowAmount && `${formattedMaxVCowAmount} vCOW`}>{formattedVCowAmount} vCOW</span>
</Trans>
)}

{isConfirmed && (
<>
<Trans>
<h3>You have successfully claimed</h3>
</Trans>
<Trans>
<p>{claimedAmount} vCOW</p>
<p title={formattedMaxVCowAmount && `${formattedMaxVCowAmount} vCOW`}>{formattedVCowAmount} vCOW</p>
</Trans>
<Trans>
<span role="img" aria-label="party-hat">
Expand Down

0 comments on commit 8b9cccd

Please sign in to comment.