Skip to content

Commit

Permalink
fix: merit badge (#2062)
Browse files Browse the repository at this point in the history
  • Loading branch information
grothem authored May 7, 2024
1 parent 80c424f commit 7dc6525
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 16 deletions.
11 changes: 0 additions & 11 deletions pages/staking.staking.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ import dynamic from 'next/dynamic';
import { useEffect, useState } from 'react';
import { ConnectWalletPaperStaking } from 'src/components/ConnectWalletPaperStaking';
import { ContentContainer } from 'src/components/ContentContainer';
import {
MeritIncentivesButton,
UserMeritIncentivesButton,
} from 'src/components/incentives/IncentivesButton';
import { Link } from 'src/components/primitives/Link';
import { Warning } from 'src/components/primitives/Warning';
import StyledToggleButton from 'src/components/StyledToggleButton';
Expand Down Expand Up @@ -228,13 +224,6 @@ export default function Staking() {
onCooldownAction={() => openStakeCooldown(Stake.gho, 'GHO')}
onUnstakeAction={() => openUnstake(Stake.gho, 'GHO')}
onStakeRewardClaimAction={() => openStakeRewardsClaim(Stake.gho, 'AAVE')}
headerAction={
stkGhoUserData?.stakeTokenUserBalance !== '0' ? (
<UserMeritIncentivesButton symbol="stkgho" />
) : (
<MeritIncentivesButton symbol="stkgho" />
)
}
/>
</Grid>

Expand Down
11 changes: 7 additions & 4 deletions src/components/incentives/IncentivesButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const UserMeritIncentivesButton = ({ symbol }: { symbol: 'gho' | 'stkgho'
setOpen={setOpen}
open={open}
>
<Content incentives={[incentives]} incentivesNetAPR={+incentives.incentiveAPR} />
<Content incentives={[incentives]} incentivesNetAPR={+incentives.incentiveAPR} plus />
</ContentWithTooltip>
);
};
Expand Down Expand Up @@ -93,7 +93,7 @@ export const MeritIncentivesButton = ({ symbol }: { symbol: 'gho' | 'stkgho' })
setOpen={setOpen}
open={open}
>
<Content incentives={[incentives]} incentivesNetAPR={+incentives.incentiveAPR} />
<Content incentives={[incentives]} incentivesNetAPR={+incentives.incentiveAPR} plus />
</ContentWithTooltip>
);
};
Expand Down Expand Up @@ -148,10 +148,12 @@ const Content = ({
incentives,
incentivesNetAPR,
displayBlank,
plus,
}: {
incentives: ReserveIncentiveResponse[];
incentivesNetAPR: number | 'Infinity';
displayBlank?: boolean;
plus?: boolean;
}) => {
const [open, setOpen] = useState(false);
const trackEvent = useRootStore((store) => store.trackEvent);
Expand Down Expand Up @@ -226,8 +228,9 @@ const Content = ({
setOpen(!open);
}}
>
<Box sx={{ mr: 2 }}>{incentivesButtonValue()}</Box>

<Box sx={{ mr: 2 }}>
{plus ? '+' : ''} {incentivesButtonValue()}
</Box>
<Box sx={{ display: 'inline-flex' }}>
<>
{incentives.length < 5 ? (
Expand Down
20 changes: 19 additions & 1 deletion src/modules/staking/StakingPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ import {
import { BigNumber } from 'ethers';
import { formatEther, formatUnits } from 'ethers/lib/utils';
import React from 'react';
import {
MeritIncentivesButton,
UserMeritIncentivesButton,
} from 'src/components/incentives/IncentivesButton';
import { DarkTooltip } from 'src/components/infoTooltips/DarkTooltip';
import { FormattedNumber } from 'src/components/primitives/FormattedNumber';
import { Link } from 'src/components/primitives/Link';
Expand Down Expand Up @@ -320,7 +324,21 @@ export const StakingPanel: React.FC<StakingPanelProps> = ({
</TextWithTooltip>
)}
</Stack>
<FormattedNumber value={stakeData.stakeApyFormatted} percent variant="secondary14" />
<Stack direction="row" alignItems="center">
<FormattedNumber
sx={{ mr: 2 }}
value={stakeData.stakeApyFormatted}
percent
variant="secondary14"
/>
{stakedToken === 'GHO' ? (
stakeUserData.stakeTokenUserBalance !== '0' ? (
<UserMeritIncentivesButton symbol="stkgho" />
) : (
<MeritIncentivesButton symbol="stkgho" />
)
) : null}
</Stack>
</Box>
<Box
sx={{
Expand Down

2 comments on commit 7dc6525

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit was deployed on ipfs

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit was deployed on ipfs

Please sign in to comment.