From 97b485f6b30c61eec2f19749ae0162980cecb5b1 Mon Sep 17 00:00:00 2001 From: groninge Date: Tue, 15 Oct 2024 14:01:55 +0200 Subject: [PATCH 1/4] show 0% when there are no surplus apr items --- .../tooltips/apr-tooltip/BaseAprTooltip.tsx | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/lib/shared/components/tooltips/apr-tooltip/BaseAprTooltip.tsx b/packages/lib/shared/components/tooltips/apr-tooltip/BaseAprTooltip.tsx index 12f515476..d323b8a69 100644 --- a/packages/lib/shared/components/tooltips/apr-tooltip/BaseAprTooltip.tsx +++ b/packages/lib/shared/components/tooltips/apr-tooltip/BaseAprTooltip.tsx @@ -185,15 +185,13 @@ function BaseAprTooltip({ tooltipText={merklIncentivesTooltipText} /> )} - {hasSurplusIncentives && ( - - )} + Date: Tue, 15 Oct 2024 14:14:56 +0200 Subject: [PATCH 2/4] show lvr only for cow amm pools --- .../apr-tooltip/AddLiquidityAprTooltip.tsx | 1 + .../tooltips/apr-tooltip/BaseAprTooltip.tsx | 22 +++++++++++-------- .../tooltips/apr-tooltip/MainAprTooltip.tsx | 1 + .../tooltips/apr-tooltip/StakeAprTooltip.tsx | 1 + 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/packages/lib/shared/components/tooltips/apr-tooltip/AddLiquidityAprTooltip.tsx b/packages/lib/shared/components/tooltips/apr-tooltip/AddLiquidityAprTooltip.tsx index ba294990d..0466da958 100644 --- a/packages/lib/shared/components/tooltips/apr-tooltip/AddLiquidityAprTooltip.tsx +++ b/packages/lib/shared/components/tooltips/apr-tooltip/AddLiquidityAprTooltip.tsx @@ -56,6 +56,7 @@ function AddLiquidityAprTooltip({ weeklyYield, totalUsdValue, pool, ...props }: shouldDisplayBaseTooltip shouldDisplayMaxVeBalTooltip usePortal={false} + poolType={pool.type} > diff --git a/packages/lib/shared/components/tooltips/apr-tooltip/BaseAprTooltip.tsx b/packages/lib/shared/components/tooltips/apr-tooltip/BaseAprTooltip.tsx index d323b8a69..b9894a1f2 100644 --- a/packages/lib/shared/components/tooltips/apr-tooltip/BaseAprTooltip.tsx +++ b/packages/lib/shared/components/tooltips/apr-tooltip/BaseAprTooltip.tsx @@ -1,4 +1,4 @@ -import { GqlPoolAprItem } from '@repo/lib/shared/services/api/generated/graphql' +import { GqlPoolAprItem, GqlPoolType } from '@repo/lib/shared/services/api/generated/graphql' import { PlacementWithLogical, Popover, @@ -22,7 +22,7 @@ import { import { TooltipAprItem } from './TooltipAprItem' import BigNumber from 'bignumber.js' import { bn, fNum } from '@repo/lib/shared/utils/numbers' -import { isVebalPool } from '@repo/lib/modules/pool/pool.helpers' +import { isCowAmmPool, isVebalPool } from '@repo/lib/modules/pool/pool.helpers' import { ReactNode } from 'react' interface Props { @@ -31,6 +31,7 @@ interface Props { displayValueFormatter?: (value: BigNumber) => string placement?: PlacementWithLogical poolId: string + poolType: GqlPoolType vebalBoost?: string totalBaseText: string | ((hasVeBalBoost?: boolean) => string) totalBaseVeBalText: string @@ -73,6 +74,7 @@ function BaseAprTooltip({ shouldDisplayBaseTooltip, shouldDisplayMaxVeBalTooltip, children, + poolType, usePortal = true, }: Props) { const colorMode = useThemeColorMode() @@ -185,13 +187,15 @@ function BaseAprTooltip({ tooltipText={merklIncentivesTooltipText} /> )} - + {isCowAmmPool(poolType) && ( + + )} {({ isOpen }) => ( diff --git a/packages/lib/shared/components/tooltips/apr-tooltip/StakeAprTooltip.tsx b/packages/lib/shared/components/tooltips/apr-tooltip/StakeAprTooltip.tsx index f5e1cd64d..6d60baa30 100644 --- a/packages/lib/shared/components/tooltips/apr-tooltip/StakeAprTooltip.tsx +++ b/packages/lib/shared/components/tooltips/apr-tooltip/StakeAprTooltip.tsx @@ -43,6 +43,7 @@ function StakeAprTooltip({ pool, totalUsdValue }: Props) { shouldDisplayBaseTooltip shouldDisplayMaxVeBalTooltip usePortal={false} + poolType={pool.type} > From ab55a82d4973ce5177028d56136f8dba9a5fec78 Mon Sep 17 00:00:00 2001 From: groninge Date: Tue, 15 Oct 2024 14:34:21 +0200 Subject: [PATCH 3/4] fix type errors --- .../components/tooltips/apr-tooltip/AddLiquidityAprTooltip.tsx | 2 +- .../shared/components/tooltips/apr-tooltip/MainAprTooltip.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/lib/shared/components/tooltips/apr-tooltip/AddLiquidityAprTooltip.tsx b/packages/lib/shared/components/tooltips/apr-tooltip/AddLiquidityAprTooltip.tsx index 0466da958..9915e4772 100644 --- a/packages/lib/shared/components/tooltips/apr-tooltip/AddLiquidityAprTooltip.tsx +++ b/packages/lib/shared/components/tooltips/apr-tooltip/AddLiquidityAprTooltip.tsx @@ -10,7 +10,7 @@ import { SparklesIcon } from './MainAprTooltip' interface Props extends Omit< BaseAprTooltipProps, - 'children' | 'totalBaseText' | 'totalBaseVeBalText' | 'maxVeBalText' | 'poolId' + 'children' | 'totalBaseText' | 'totalBaseVeBalText' | 'maxVeBalText' | 'poolId' | 'poolType' > { totalUsdValue: string weeklyYield: string diff --git a/packages/lib/shared/components/tooltips/apr-tooltip/MainAprTooltip.tsx b/packages/lib/shared/components/tooltips/apr-tooltip/MainAprTooltip.tsx index 8b92f2675..4bd6c6234 100644 --- a/packages/lib/shared/components/tooltips/apr-tooltip/MainAprTooltip.tsx +++ b/packages/lib/shared/components/tooltips/apr-tooltip/MainAprTooltip.tsx @@ -23,7 +23,7 @@ import StarIcon from '../../icons/StarIcon' interface Props extends Omit< BaseAprTooltipProps, - 'children' | 'totalBaseText' | 'totalBaseVeBalText' | 'maxVeBalText' + 'children' | 'totalBaseText' | 'totalBaseVeBalText' | 'maxVeBalText' | 'poolType' > { textProps?: TextProps onlySparkles?: boolean From b88e0f0cf7f6d4762ba0a6efedf451a2ce86acdc Mon Sep 17 00:00:00 2001 From: groninge Date: Wed, 16 Oct 2024 08:07:45 +0200 Subject: [PATCH 4/4] remove 'hasSurplusIncentives' --- .../shared/components/tooltips/apr-tooltip/BaseAprTooltip.tsx | 3 +-- packages/lib/shared/hooks/useAprTooltip.ts | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/lib/shared/components/tooltips/apr-tooltip/BaseAprTooltip.tsx b/packages/lib/shared/components/tooltips/apr-tooltip/BaseAprTooltip.tsx index b9894a1f2..cd475f2c0 100644 --- a/packages/lib/shared/components/tooltips/apr-tooltip/BaseAprTooltip.tsx +++ b/packages/lib/shared/components/tooltips/apr-tooltip/BaseAprTooltip.tsx @@ -89,7 +89,6 @@ function BaseAprTooltip({ stakingIncentivesAprDisplayed, merklIncentivesAprDisplayed, hasMerklIncentives, - hasSurplusIncentives, surplusIncentivesAprDisplayed, swapFeesDisplayed, isSwapFeePresent, @@ -192,7 +191,7 @@ function BaseAprTooltip({ {...basePopoverAprItemProps} displayValueFormatter={usedDisplayValueFormatter} title="Prevented LVR" - apr={hasSurplusIncentives ? surplusIncentivesAprDisplayed : bn(0)} + apr={surplusIncentivesAprDisplayed} tooltipText={surplusIncentivesTooltipText} /> )} diff --git a/packages/lib/shared/hooks/useAprTooltip.ts b/packages/lib/shared/hooks/useAprTooltip.ts index 0c55ac14c..1caef919e 100644 --- a/packages/lib/shared/hooks/useAprTooltip.ts +++ b/packages/lib/shared/hooks/useAprTooltip.ts @@ -116,7 +116,6 @@ export function useAprTooltip({ // Surplus incentives const surplusIncentives = filterByType(aprItems, GqlPoolAprItemType.Surplus) - const hasSurplusIncentives = surplusIncentives.length > 0 const surplusIncentivesAprDisplayed = calculateSingleIncentivesAprDisplayed(surplusIncentives) // Bal Reward @@ -177,7 +176,6 @@ export function useAprTooltip({ merklIncentivesAprDisplayed, hasMerklIncentives, surplusIncentivesAprDisplayed, - hasSurplusIncentives, votingAprDisplayed, lockingAprDisplayed, isVotingPresent,