Skip to content

Commit

Permalink
fix: set norAprExternalIncentivesTooltips with reward aprs, and remov…
Browse files Browse the repository at this point in the history
…e it from the asset name
  • Loading branch information
MartinGbz committed Jan 8, 2025
1 parent dac9094 commit f400537
Show file tree
Hide file tree
Showing 15 changed files with 42 additions and 121 deletions.
32 changes: 32 additions & 0 deletions src/components/incentives/IncentivesButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ import { useMeritIncentives } from 'src/hooks/useMeritIncentives';
import { useZkSyncIgniteIncentives } from 'src/hooks/useZkSyncIgniteIncentives';
import { useRootStore } from 'src/store/root';
import { DASHBOARD } from 'src/utils/mixPanelEvents';
import { getNoAprExternalIncentivesTooltipConfig } from 'src/utils/utils';

import { ContentWithTooltip } from '../ContentWithTooltip';
import { SpkAirdropTooltip } from '../infoTooltips/SpkAirdropTooltip';
import { SuperFestTooltip } from '../infoTooltips/SuperFestTooltip';
import { FormattedNumber } from '../primitives/FormattedNumber';
import { TokenIcon } from '../primitives/TokenIcon';
import { getSymbolMap, IncentivesTooltipContent } from './IncentivesTooltipContent';
Expand All @@ -22,6 +25,12 @@ interface IncentivesButtonProps {
displayBlank?: boolean;
}

interface NoAprExternalIncentiveTooltipProps {
market: string;
symbol?: string;
protocolAction?: ProtocolAction;
}

const BlankIncentives = () => {
return (
<Box
Expand Down Expand Up @@ -92,6 +101,29 @@ export const ZkIgniteIncentivesButton = (params: {
);
};

export const NoAprExternalIncentiveTooltip = ({
market,
symbol,
protocolAction,
}: NoAprExternalIncentiveTooltipProps) => {
if (!symbol || !protocolAction) {
return null;
}

const noAprExternalIncentivesTooltips = getNoAprExternalIncentivesTooltipConfig(
symbol,
market,
protocolAction
);

return (
<>
{noAprExternalIncentivesTooltips.superFestRewards && <SuperFestTooltip />}
{noAprExternalIncentivesTooltips.spkAirdrop && <SpkAirdropTooltip />}
</>
);
};

export const IncentivesButton = ({ incentives, symbol, displayBlank }: IncentivesButtonProps) => {
const [open, setOpen] = useState(false);

Expand Down
8 changes: 7 additions & 1 deletion src/components/incentives/IncentivesCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,21 @@ import { NoData } from '../primitives/NoData';
import {
IncentivesButton,
MeritIncentivesButton,
NoAprExternalIncentiveTooltip,
ZkIgniteIncentivesButton,
} from './IncentivesButton';

interface IncentivesCardProps {
symbol: string;
value: string | number;
market: string;
incentives?: ReserveIncentiveResponse[];
address?: string;
variant?: 'main14' | 'main16' | 'secondary14';
symbolsVariant?: 'secondary14' | 'secondary16';
align?: 'center' | 'flex-end' | 'start';
color?: string;
tooltip?: ReactNode;
market: string;
protocolAction?: ProtocolAction;
displayBlank?: boolean;
}
Expand Down Expand Up @@ -115,6 +116,11 @@ export const IncentivesBox = ({
rewardedAsset={address}
protocolAction={protocolAction}
/>
<NoAprExternalIncentiveTooltip
market={market}
symbol={symbol}
protocolAction={protocolAction}
/>
</Box>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/infoTooltips/SpkAirdropTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { TextWithTooltip } from '../TextWithTooltip';
export const SpkAirdropTooltip = () => {
return (
<TextWithTooltip
wrapperProps={{ ml: 2 }}
wrapperProps={{ alignSelf: 'center' }}
color="warning.main"
iconSize={20}
icon={<image href="/icons/other/spark.svg" width={25} height={25} />}
Expand Down
2 changes: 1 addition & 1 deletion src/components/infoTooltips/SuperFestTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { TextWithTooltip } from '../TextWithTooltip';
export const SuperFestTooltip = () => {
return (
<TextWithTooltip
wrapperProps={{ ml: 2 }}
wrapperProps={{ alignSelf: 'center' }}
color="warning.main"
iconSize={20}
icon={<image href="/icons/other/superfest.svg" width={25} height={25} />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { useModalContext } from 'src/hooks/useModal';
import { useRootStore } from 'src/store/root';
import { DashboardReserve } from 'src/utils/dashboardSortUtils';
import { DASHBOARD } from 'src/utils/mixPanelEvents';
import { showExternalIncentivesTooltip } from 'src/utils/utils';
import { useShallow } from 'zustand/shallow';

import { CapsHint } from '../../../../components/caps/CapsHint';
Expand Down Expand Up @@ -46,11 +45,6 @@ export const BorrowAssetsListItem = ({
detailsAddress={underlyingAsset}
data-cy={`dashboardBorrowListItem_${symbol.toUpperCase()}`}
currentMarket={currentMarket}
showExternalIncentivesTooltips={showExternalIncentivesTooltip(
symbol,
currentMarket,
ProtocolAction.borrow
)}
>
<ListValueColumn
symbol={symbol}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Box, Button } from '@mui/material';
import { VariableAPYTooltip } from 'src/components/infoTooltips/VariableAPYTooltip';
import { useRootStore } from 'src/store/root';
import { DashboardReserve } from 'src/utils/dashboardSortUtils';
import { showExternalIncentivesTooltip } from 'src/utils/utils';

import { CapsHint } from '../../../../components/caps/CapsHint';
import { CapType } from '../../../../components/caps/helper';
Expand Down Expand Up @@ -41,11 +40,6 @@ export const BorrowAssetsListMobileItem = ({
name={name}
underlyingAsset={underlyingAsset}
currentMarket={currentMarket}
showExternalIncentivesTooltips={showExternalIncentivesTooltip(
symbol,
currentMarket,
ProtocolAction.borrow
)}
>
<ListValueRow
title={<Trans>Available to borrow</Trans>}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { useModalContext } from 'src/hooks/useModal';
import { useRootStore } from 'src/store/root';
import { DashboardReserve } from 'src/utils/dashboardSortUtils';
import { isFeatureEnabled } from 'src/utils/marketsAndNetworksConfig';
import { showExternalIncentivesTooltip } from 'src/utils/utils';
import { useShallow } from 'zustand/shallow';

import { ListAPRColumn } from '../ListAPRColumn';
Expand Down Expand Up @@ -121,11 +120,6 @@ const BorrowedPositionsListItemDesktop = ({
borrowEnabled={reserve.borrowingEnabled}
data-cy={`dashboardBorrowedListItem_${reserve.symbol.toUpperCase()}`}
showBorrowCapTooltips
showExternalIncentivesTooltips={showExternalIncentivesTooltip(
reserve.symbol,
currentMarket,
ProtocolAction.borrow
)}
>
<ListValueColumn symbol={reserve.symbol} value={totalBorrows} subValue={totalBorrowsUSD} />

Expand Down Expand Up @@ -189,11 +183,6 @@ const BorrowedPositionsListItemMobile = ({
frozen={reserve.isFrozen}
borrowEnabled={reserve.borrowingEnabled}
showBorrowCapTooltips
showExternalIncentivesTooltips={showExternalIncentivesTooltip(
symbol,
currentMarket,
ProtocolAction.borrow
)}
>
<ListValueRow
title={<Trans>Debt</Trans>}
Expand Down
10 changes: 0 additions & 10 deletions src/modules/dashboard/lists/ListItemWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@ import { ReactNode } from 'react';
import { BorrowDisabledToolTip } from 'src/components/infoTooltips/BorrowDisabledToolTip';
import { OffboardingTooltip } from 'src/components/infoTooltips/OffboardingToolTip';
import { PausedTooltip } from 'src/components/infoTooltips/PausedTooltip';
import { SpkAirdropTooltip } from 'src/components/infoTooltips/SpkAirdropTooltip';
import { StETHCollateralToolTip } from 'src/components/infoTooltips/StETHCollateralToolTip';
import { SuperFestTooltip } from 'src/components/infoTooltips/SuperFestTooltip';
import { AssetsBeingOffboarded } from 'src/components/Warnings/OffboardingWarning';
import { useAssetCaps } from 'src/hooks/useAssetCaps';
import { useRootStore } from 'src/store/root';
import { CustomMarket } from 'src/ui-config/marketsConfig';
import { DASHBOARD_LIST_COLUMN_WIDTHS } from 'src/utils/dashboardSortUtils';
import { DASHBOARD } from 'src/utils/mixPanelEvents';
import { ExternalIncentivesTooltipsConfig } from 'src/utils/utils';

import { AMPLToolTip } from '../../../components/infoTooltips/AMPLToolTip';
import { FrozenTooltip } from '../../../components/infoTooltips/FrozenTooltip';
Expand All @@ -35,7 +32,6 @@ interface ListItemWrapperProps {
showSupplyCapTooltips?: boolean;
showBorrowCapTooltips?: boolean;
showDebtCeilingTooltips?: boolean;
showExternalIncentivesTooltips?: ExternalIncentivesTooltipsConfig;
}

export const ListItemWrapper = ({
Expand All @@ -51,10 +47,6 @@ export const ListItemWrapper = ({
showSupplyCapTooltips = false,
showBorrowCapTooltips = false,
showDebtCeilingTooltips = false,
showExternalIncentivesTooltips = {
superFestRewards: false,
spkAirdrop: false,
},
...rest
}: ListItemWrapperProps) => {
const { supplyCap, borrowCap, debtCeiling } = useAssetCaps();
Expand Down Expand Up @@ -91,8 +83,6 @@ export const ListItemWrapper = ({
</Tooltip>
</Link>
{paused && <PausedTooltip />}
{showExternalIncentivesTooltips.superFestRewards && <SuperFestTooltip />}
{showExternalIncentivesTooltips.spkAirdrop && <SpkAirdropTooltip />}
{showFrozenTooltip && <FrozenTooltip symbol={symbol} currentMarket={currentMarket} />}
{showRenFilTooltip && <RenFILToolTip />}
{showAmplTooltip && <AMPLToolTip />}
Expand Down
10 changes: 0 additions & 10 deletions src/modules/dashboard/lists/ListMobileItemWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ import { ReactNode } from 'react';
import { BorrowDisabledToolTip } from 'src/components/infoTooltips/BorrowDisabledToolTip';
import { OffboardingTooltip } from 'src/components/infoTooltips/OffboardingToolTip';
import { PausedTooltip } from 'src/components/infoTooltips/PausedTooltip';
import { SpkAirdropTooltip } from 'src/components/infoTooltips/SpkAirdropTooltip';
import { StETHCollateralToolTip } from 'src/components/infoTooltips/StETHCollateralToolTip';
import { SuperFestTooltip } from 'src/components/infoTooltips/SuperFestTooltip';
import { AssetsBeingOffboarded } from 'src/components/Warnings/OffboardingWarning';
import { CustomMarket } from 'src/ui-config/marketsConfig';
import { ExternalIncentivesTooltipsConfig } from 'src/utils/utils';

import { AMPLToolTip } from '../../../components/infoTooltips/AMPLToolTip';
import { FrozenTooltip } from '../../../components/infoTooltips/FrozenTooltip';
Expand All @@ -30,7 +27,6 @@ interface ListMobileItemWrapperProps {
showBorrowCapTooltips?: boolean;
showDebtCeilingTooltips?: boolean;
isIsolated?: boolean;
showExternalIncentivesTooltips?: ExternalIncentivesTooltipsConfig;
}

export const ListMobileItemWrapper = ({
Expand All @@ -48,10 +44,6 @@ export const ListMobileItemWrapper = ({
showBorrowCapTooltips = false,
showDebtCeilingTooltips = false,
isIsolated = false,
showExternalIncentivesTooltips = {
superFestRewards: false,
spkAirdrop: false,
},
}: ListMobileItemWrapperProps) => {
const WarningComponent: React.FC = () => {
const showFrozenTooltip = frozen && symbol !== 'renFIL';
Expand All @@ -64,8 +56,6 @@ export const ListMobileItemWrapper = ({
return (
<>
{paused && <PausedTooltip />}
{showExternalIncentivesTooltips.superFestRewards && <SuperFestTooltip />}
{showExternalIncentivesTooltips.spkAirdrop && <SpkAirdropTooltip />}
{showFrozenTooltip && <FrozenTooltip symbol={symbol} currentMarket={currentMarket} />}
{showRenFilTooltip && <RenFILToolTip />}
{showAmplTooltip && <AMPLToolTip />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { useModalContext } from 'src/hooks/useModal';
import { useRootStore } from 'src/store/root';
import { DashboardReserve } from 'src/utils/dashboardSortUtils';
import { GENERAL } from 'src/utils/mixPanelEvents';
import { showExternalIncentivesTooltip } from 'src/utils/utils';
import { useShallow } from 'zustand/shallow';

import { ListColumn } from '../../../../components/lists/ListColumn';
Expand Down Expand Up @@ -61,11 +60,6 @@ export const SuppliedPositionsListItem = ({
}`}
showSupplyCapTooltips
showDebtCeilingTooltips
showExternalIncentivesTooltips={showExternalIncentivesTooltip(
reserve.symbol,
currentMarket,
ProtocolAction.supply
)}
>
<ListValueColumn
symbol={reserve.iconSymbol}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { useAppDataContext } from 'src/hooks/app-data-provider/useAppDataProvide
import { useAssetCaps } from 'src/hooks/useAssetCaps';
import { useRootStore } from 'src/store/root';
import { DashboardReserve } from 'src/utils/dashboardSortUtils';
import { showExternalIncentivesTooltip } from 'src/utils/utils';
import { useShallow } from 'zustand/shallow';

import { IncentivesCard } from '../../../../components/incentives/IncentivesCard';
Expand Down Expand Up @@ -65,11 +64,6 @@ export const SuppliedPositionsListMobileItem = ({
frozen={reserve.isFrozen}
showSupplyCapTooltips
showDebtCeilingTooltips
showExternalIncentivesTooltips={showExternalIncentivesTooltip(
reserve.symbol,
currentMarket,
ProtocolAction.supply
)}
>
<ListValueRow
title={<Trans>Supply balance</Trans>}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import { useRootStore } from 'src/store/root';
import { DashboardReserve } from 'src/utils/dashboardSortUtils';
import { isFeatureEnabled } from 'src/utils/marketsAndNetworksConfig';
import { DASHBOARD } from 'src/utils/mixPanelEvents';
import { showExternalIncentivesTooltip } from 'src/utils/utils';

import { CapsHint } from '../../../../components/caps/CapsHint';
import { CapType } from '../../../../components/caps/helper';
Expand Down Expand Up @@ -154,11 +153,6 @@ export const SupplyAssetsListItemDesktop = ({
data-cy={`dashboardSupplyListItem_${symbol.toUpperCase()}`}
currentMarket={currentMarket}
showDebtCeilingTooltips
showExternalIncentivesTooltips={showExternalIncentivesTooltip(
symbol,
currentMarket,
ProtocolAction.supply
)}
>
{canSupplyAsWrappedToken && wrappedToken && walletBalance === '0' ? (
<ListColumn>
Expand Down Expand Up @@ -347,11 +341,6 @@ export const SupplyAssetsListItemMobile = ({
underlyingAsset={underlyingAsset}
currentMarket={currentMarket}
showDebtCeilingTooltips
showExternalIncentivesTooltips={showExternalIncentivesTooltip(
symbol,
currentMarket,
ProtocolAction.supply
)}
>
{canSupplyAsWrappedToken && wrappedToken && walletBalance === '0' ? (
<Row
Expand Down
25 changes: 0 additions & 25 deletions src/modules/markets/MarketAssetsListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@ import { Box, Button, Typography } from '@mui/material';
import { useRouter } from 'next/router';
import { OffboardingTooltip } from 'src/components/infoTooltips/OffboardingToolTip';
import { RenFILToolTip } from 'src/components/infoTooltips/RenFILToolTip';
import { SpkAirdropTooltip } from 'src/components/infoTooltips/SpkAirdropTooltip';
import { SuperFestTooltip } from 'src/components/infoTooltips/SuperFestTooltip';
import { IsolatedEnabledBadge } from 'src/components/isolationMode/IsolatedBadge';
import { NoData } from 'src/components/primitives/NoData';
import { ReserveSubheader } from 'src/components/ReserveSubheader';
import { AssetsBeingOffboarded } from 'src/components/Warnings/OffboardingWarning';
import { useRootStore } from 'src/store/root';
import { MARKETS } from 'src/utils/mixPanelEvents';
import { showExternalIncentivesTooltip } from 'src/utils/utils';
import { useShallow } from 'zustand/shallow';

import { IncentivesCard } from '../../components/incentives/IncentivesCard';
Expand All @@ -31,16 +28,6 @@ export const MarketAssetsListItem = ({ ...reserve }: ComputedReserveData) => {
);

const offboardingDiscussion = AssetsBeingOffboarded[currentMarket]?.[reserve.symbol];
const externalIncentivesTooltipsSupplySide = showExternalIncentivesTooltip(
reserve.symbol,
currentMarket,
ProtocolAction.supply
);
const externalIncentivesTooltipsBorrowSide = showExternalIncentivesTooltip(
reserve.symbol,
currentMarket,
ProtocolAction.borrow
);

return (
<ListItem
Expand Down Expand Up @@ -99,12 +86,6 @@ export const MarketAssetsListItem = ({ ...reserve }: ComputedReserveData) => {
symbol={reserve.symbol}
variant="main16"
symbolsVariant="secondary16"
tooltip={
<>
{externalIncentivesTooltipsSupplySide.superFestRewards && <SuperFestTooltip />}
{externalIncentivesTooltipsSupplySide.spkAirdrop && <SpkAirdropTooltip />}
</>
}
market={currentMarket}
protocolAction={ProtocolAction.supply}
/>
Expand All @@ -129,12 +110,6 @@ export const MarketAssetsListItem = ({ ...reserve }: ComputedReserveData) => {
symbol={reserve.symbol}
variant="main16"
symbolsVariant="secondary16"
tooltip={
<>
{externalIncentivesTooltipsBorrowSide.superFestRewards && <SuperFestTooltip />}
{externalIncentivesTooltipsBorrowSide.spkAirdrop && <SpkAirdropTooltip />}
</>
}
market={currentMarket}
protocolAction={ProtocolAction.borrow}
/>
Expand Down
Loading

0 comments on commit f400537

Please sign in to comment.