Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add estimated value of unclaimed fees #338

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 40 additions & 22 deletions src/components/PositionDetails/SinglePositionInfo/BoxInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const BoxInfo: React.FC<{
tokenA: BoxInfoToken
tokenB: BoxInfoToken
showBalance?: boolean
showValue?: boolean
swapHandler?: () => void
showLoader?: boolean
isBalanceLoading: boolean
Expand All @@ -29,6 +30,7 @@ export const BoxInfo: React.FC<{
tokenB,
tokenA,
showBalance = false,
showValue = false,
swapHandler,
showLoader = false,
isBalanceLoading
Expand Down Expand Up @@ -112,22 +114,30 @@ export const BoxInfo: React.FC<{
{showPrefix(tokenXPrintValue, prefixConfig)}
</Typography>
</Grid>
{showBalance ? (
{showBalance || showValue ? (
<Grid className={classes.tokenAreaLowerPart}>
<Typography className={classes.tokenBalance}>
Balance:{' '}
{isBalanceLoading ? (
<img src={loadingAnimation} className={classes.loadingBalance} alt='Loading' />
) : (
formatNumber(tokenA.balance)
)}{' '}
{tokenA.name}
</Typography>
{showBalance ? (
<Typography className={classes.tokenBalance}>
Balance:{' '}
{isBalanceLoading ? (
<img src={loadingAnimation} className={classes.loadingBalance} alt='Loading' />
) : (
formatNumber(tokenA.balance)
)}{' '}
{tokenA.name}
</Typography>
) : (
<div />
)}
{typeof tokenA.usdValue !== 'undefined' && tokenA.price ? (
<Tooltip
enterTouchDelay={0}
leaveTouchDelay={Number.MAX_SAFE_INTEGER}
title="Estimated USD Value of the Position's Tokens"
title={
showValue
? 'Estimated USD Value of unclaimed fee'
: "Estimated USD Value of the Position's Tokens"
}
placement='bottom'
classes={{
tooltip: classes.tooltip
Expand Down Expand Up @@ -179,22 +189,30 @@ export const BoxInfo: React.FC<{
{showPrefix(tokenYPrintValue, prefixConfig)}
</Typography>
</Grid>
{showBalance ? (
{showBalance || showValue ? (
<Grid className={classes.tokenAreaLowerPart}>
<Typography className={classes.tokenBalance}>
Balance:{' '}
{isBalanceLoading ? (
<img src={loadingAnimation} className={classes.loadingBalance} alt='Loading' />
) : (
formatNumber(tokenB.balance)
)}{' '}
{tokenB.name}
</Typography>
{showBalance ? (
<Typography className={classes.tokenBalance}>
Balance:{' '}
{isBalanceLoading ? (
<img src={loadingAnimation} className={classes.loadingBalance} alt='Loading' />
) : (
formatNumber(tokenB.balance)
)}{' '}
{tokenB.name}
</Typography>
) : (
<div />
)}
{typeof tokenB.usdValue !== 'undefined' && tokenB.price ? (
<Tooltip
enterTouchDelay={0}
leaveTouchDelay={Number.MAX_SAFE_INTEGER}
title="Estimated USD Value of the Position's Tokens"
title={
showValue
? 'Estimated USD Value of unclaimed fee'
: "Estimated USD Value of the Position's Tokens"
}
placement='bottom'
classes={{
tooltip: classes.tooltip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,19 @@ const SinglePositionInfo: React.FC<IProp> = ({
<BoxInfo
title={'Unclaimed fees'}
tokenA={
xToY ? { ...tokenX, value: tokenX.claimValue } : { ...tokenY, value: tokenY.claimValue }
xToY
? { ...tokenX, value: tokenX.claimValue, price: tokenXPriceData?.price }
: { ...tokenY, value: tokenY.claimValue, price: tokenYPriceData?.price }
}
tokenB={
xToY ? { ...tokenY, value: tokenY.claimValue } : { ...tokenX, value: tokenX.claimValue }
xToY
? { ...tokenY, value: tokenY.claimValue, price: tokenYPriceData?.price }
: { ...tokenX, value: tokenX.claimValue, price: tokenXPriceData?.price }
}
onClickButton={onClickClaimFee}
showLoader={showFeesLoader}
isBalanceLoading={isBalanceLoading}
showValue
/>
</Grid>
</Grid>
Expand Down
Loading