Skip to content

Commit 213439a

Browse files
authored
fix: hide Merit value next to tooltip button for GHO (#2587)
1 parent 44d7a1d commit 213439a

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

src/components/incentives/IncentivesButton.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ export const MeritIncentivesButton = (params: {
132132
protocolAction?: ProtocolAction;
133133
protocolAPY?: number;
134134
protocolIncentives?: ReserveIncentiveResponse[];
135+
hideValue?: boolean;
135136
}) => {
136137
const [open, setOpen] = useState(false);
137138
const { data: meritIncentives } = useMeritIncentives(params);
@@ -150,7 +151,11 @@ export const MeritIncentivesButton = (params: {
150151
setOpen={setOpen}
151152
open={open}
152153
>
153-
<Content incentives={[meritIncentives]} incentivesNetAPR={displayValue} />
154+
<Content
155+
incentives={[meritIncentives]}
156+
incentivesNetAPR={displayValue}
157+
hideValue={params.hideValue}
158+
/>
154159
</ContentWithTooltip>
155160
);
156161
};
@@ -307,11 +312,13 @@ const Content = ({
307312
incentivesNetAPR,
308313
displayBlank,
309314
plus,
315+
hideValue,
310316
}: {
311317
incentives: ReserveIncentiveResponse[];
312318
incentivesNetAPR: number | typeof INFINITY;
313319
displayBlank?: boolean;
314320
plus?: boolean;
321+
hideValue?: boolean;
315322
}) => {
316323
const [open, setOpen] = useState(false);
317324
const trackEvent = useRootStore((store) => store.trackEvent);
@@ -341,7 +348,13 @@ const Content = ({
341348
incentive.rewardTokenSymbol?.toLowerCase().includes('agho') ||
342349
incentive.rewardTokenSymbol?.toLowerCase().includes('abasgho')
343350
);
344-
351+
if (hideValue && hasGhoIncentives) {
352+
return (
353+
<Box sx={{ display: 'flex', alignItems: 'center', gap: 0.5 }}>
354+
<IncentivesIcon width="16" height="16" />
355+
</Box>
356+
);
357+
}
345358
if (hasGhoIncentives) {
346359
if (incentivesNetAPR !== INFINITY && incentivesNetAPR < 10000) {
347360
return (

src/components/incentives/IncentivesCard.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { ProtocolAction } from '@aave/contract-helpers';
22
import { ReserveIncentiveResponse } from '@aave/math-utils/dist/esm/formatters/incentive/calculate-reserve-incentives';
33
import { Box, Typography } from '@mui/material';
4+
import { useRouter } from 'next/router';
45
import { ReactNode } from 'react';
56
import { useMeritIncentives } from 'src/hooks/useMeritIncentives';
67
import { useMerklIncentives } from 'src/hooks/useMerklIncentives';
@@ -45,6 +46,8 @@ export const IncentivesCard = ({
4546
protocolAction,
4647
inlineIncentives = false,
4748
}: IncentivesCardProps) => {
49+
const router = useRouter();
50+
4851
const protocolAPY = typeof value === 'string' ? parseFloat(value) : value;
4952

5053
const protocolIncentivesAPR =
@@ -85,6 +88,10 @@ export const IncentivesCard = ({
8588
? protocolAPY - (protocolIncentivesAPR as number) - meritIncentivesAPR - merklIncentivesAPR
8689
: protocolAPY + (protocolIncentivesAPR as number) + meritIncentivesAPR + merklIncentivesAPR;
8790

91+
const isSghoPage =
92+
typeof router?.asPath === 'string' && router.asPath.toLowerCase().startsWith('/sgho');
93+
const hideMeritValue = symbol === 'GHO' && !isSghoPage;
94+
8895
const incentivesContent = (
8996
<>
9097
<IncentivesButton
@@ -95,13 +102,16 @@ export const IncentivesCard = ({
95102
protocolAPY={protocolAPY}
96103
address={address}
97104
/>
105+
98106
<MeritIncentivesButton
99107
symbol={symbol}
100108
market={market}
101109
protocolAction={protocolAction}
102110
protocolAPY={protocolAPY}
103111
protocolIncentives={incentives || []}
112+
hideValue={hideMeritValue}
104113
/>
114+
105115
<MerklIncentivesButton
106116
market={market}
107117
rewardedAsset={address}

0 commit comments

Comments
 (0)