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

fix: show 0% when there are no surplus apr items #65

Merged
merged 4 commits into from
Oct 16, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -56,6 +56,7 @@ function AddLiquidityAprTooltip({ weeklyYield, totalUsdValue, pool, ...props }:
shouldDisplayBaseTooltip
shouldDisplayMaxVeBalTooltip
usePortal={false}
poolType={pool.type}
>
<HStack align="center" alignItems="center">
<Card cursor="pointer" variant="subSection" w="full" p={['sm', 'ms']}>
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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 {
Expand All @@ -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
Expand Down Expand Up @@ -73,6 +74,7 @@ function BaseAprTooltip({
shouldDisplayBaseTooltip,
shouldDisplayMaxVeBalTooltip,
children,
poolType,
usePortal = true,
}: Props) {
const colorMode = useThemeColorMode()
Expand All @@ -87,7 +89,6 @@ function BaseAprTooltip({
stakingIncentivesAprDisplayed,
merklIncentivesAprDisplayed,
hasMerklIncentives,
hasSurplusIncentives,
surplusIncentivesAprDisplayed,
swapFeesDisplayed,
isSwapFeePresent,
Expand Down Expand Up @@ -185,7 +186,7 @@ function BaseAprTooltip({
tooltipText={merklIncentivesTooltipText}
/>
)}
{hasSurplusIncentives && (
{isCowAmmPool(poolType) && (
<TooltipAprItem
{...basePopoverAprItemProps}
displayValueFormatter={usedDisplayValueFormatter}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -151,6 +151,7 @@ function MainAprTooltip({
totalBaseVeBalText="Total base APR"
customPopoverContent={customPopoverContent}
vebalBoost={vebalBoost}
poolType={pool.type}
>
{({ isOpen }) => (
<HStack align="center" alignItems="center">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function StakeAprTooltip({ pool, totalUsdValue }: Props) {
shouldDisplayBaseTooltip
shouldDisplayMaxVeBalTooltip
usePortal={false}
poolType={pool.type}
>
<Card cursor="pointer" variant="subSection" w="full">
<VStack align="start" w="full" spacing="sm">
Expand Down
2 changes: 0 additions & 2 deletions packages/lib/shared/hooks/useAprTooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -177,7 +176,6 @@ export function useAprTooltip({
merklIncentivesAprDisplayed,
hasMerklIncentives,
surplusIncentivesAprDisplayed,
hasSurplusIncentives,
votingAprDisplayed,
lockingAprDisplayed,
isVotingPresent,
Expand Down
Loading