Skip to content

Commit 0f1db7e

Browse files
committed
fix: handle gho incetive
1 parent b8f58d9 commit 0f1db7e

File tree

1 file changed

+40
-29
lines changed

1 file changed

+40
-29
lines changed

src/components/incentives/IncentivesButton.tsx

Lines changed: 40 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { useRootStore } from 'src/store/root';
1212
import { DASHBOARD } from 'src/utils/events';
1313

1414
import { ContentWithTooltip } from '../ContentWithTooltip';
15+
import { FormattedNumber } from '../primitives/FormattedNumber';
1516
import { EthenaAirdropTooltipContent } from './EthenaIncentivesTooltipContent';
1617
import { EtherFiAirdropTooltipContent } from './EtherfiIncentivesTooltipContent';
1718
import { IncentivesTooltipContent } from './IncentivesTooltipContent';
@@ -331,36 +332,46 @@ const Content = ({
331332
}
332333
}
333334

334-
// const incentivesButtonValue = () => {
335-
// if (incentivesNetAPR !== 'Infinity' && incentivesNetAPR < 10000) {
336-
// return (
337-
// <FormattedNumber
338-
// value={incentivesNetAPR}
339-
// percent
340-
// variant="secondary12"
341-
// color="text.secondary"
342-
// />
343-
// );
344-
// } else if (incentivesNetAPR !== 'Infinity' && incentivesNetAPR > 9999) {
345-
// return (
346-
// <FormattedNumber
347-
// value={incentivesNetAPR}
348-
// percent
349-
// compact
350-
// variant="secondary12"
351-
// color="text.secondary"
352-
// />
353-
// );
354-
// } else if (incentivesNetAPR === 'Infinity') {
355-
// return (
356-
// <Typography variant="main12" color="text.secondary">
357-
// ∞
358-
// </Typography>
359-
// );
360-
// }
361-
// };
362-
363335
const incentivesButtonValue = () => {
336+
// NOTE: For GHO incentives, we want to show the formatted number given its on sGHO page only
337+
338+
const hasGhoIncentives = incentives.some(
339+
(incentive) =>
340+
incentive.rewardTokenSymbol?.toLowerCase().includes('gho') ||
341+
incentive.rewardTokenSymbol?.toLowerCase().includes('agho') ||
342+
incentive.rewardTokenSymbol?.toLowerCase().includes('abasgho')
343+
);
344+
345+
if (hasGhoIncentives) {
346+
if (incentivesNetAPR !== 'Infinity' && incentivesNetAPR < 10000) {
347+
return (
348+
<FormattedNumber
349+
value={incentivesNetAPR}
350+
percent
351+
variant="secondary12"
352+
color="text.secondary"
353+
/>
354+
);
355+
} else if (incentivesNetAPR !== 'Infinity' && incentivesNetAPR > 9999) {
356+
return (
357+
<FormattedNumber
358+
value={incentivesNetAPR}
359+
percent
360+
compact
361+
variant="secondary12"
362+
color="text.secondary"
363+
/>
364+
);
365+
} else if (incentivesNetAPR === 'Infinity') {
366+
return (
367+
<Typography variant="main12" color="text.secondary">
368+
369+
</Typography>
370+
);
371+
}
372+
}
373+
374+
// Default behavior: show icon for non-GHO incentives
364375
return (
365376
<>
366377
<IncentivesIcon width="16" height="16" />

0 commit comments

Comments
 (0)