Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚸 asset: add asset description in asset page
Browse files Browse the repository at this point in the history
franm91 committed Dec 7, 2023

Verified

This commit was signed with the committer’s verified signature.
franm91 Franm
1 parent 46c554b commit d582ca0
Showing 2 changed files with 20 additions and 1 deletion.
13 changes: 13 additions & 0 deletions components/asset/Header.tsx
Original file line number Diff line number Diff line change
@@ -14,6 +14,8 @@ import { formatEther, formatUnits } from 'viem';
import useStETHNativeAPR from 'hooks/useStETHNativeAPR';
import { toPercentage } from 'utils/utils';
import { track } from 'utils/segment';
import { Typography } from '@mui/material';
import getSymbolDescription from 'utils/getSymbolDescription';

type Props = {
symbol: string;
@@ -27,6 +29,14 @@ const AssetHeaderInfo: FC<Props> = ({ symbol }) => {

const nativeAPR = useStETHNativeAPR();

const assetDescription = useCallback(
(s: string) => {
if (!marketAccount) return '';
return getSymbolDescription(marketAccount, s);
},
[marketAccount],
);

const { floatingDeposits, floatingBorrows, backupBorrows } = useMemo(() => {
if (!marketAccount) return {};

@@ -175,6 +185,9 @@ const AssetHeaderInfo: FC<Props> = ({ symbol }) => {
exaToken={marketAccount.symbol}
/>
)}
<Typography sx={{ width: '100%' }} variant="dashboardMainSubtitle">
{assetDescription(symbol)}
</Typography>
</Grid>
<Grid item container spacing={4}>
{itemsInfo.map(({ label, value, underLabel, tooltipTitle }) => (
8 changes: 7 additions & 1 deletion utils/getSymbolDescription.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { MarketAccount } from 'hooks/useAccountData';

export default (marketAccount: MarketAccount, symbol: string) => {
return symbol === 'WETH' ? 'Ether' : marketAccount.assetName;
if (symbol === 'WETH') {
return 'Ether';
} else if (symbol === 'USDC') {
return 'Bridged USDC';
} else {
return marketAccount.assetName;
}
};

0 comments on commit d582ca0

Please sign in to comment.