Skip to content

Commit

Permalink
🚸 asset: add asset description in asset page
Browse files Browse the repository at this point in the history
  • Loading branch information
franm91 committed Dec 7, 2023
1 parent 46c554b commit 2102f00
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
13 changes: 13 additions & 0 deletions components/asset/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {};

Expand Down Expand Up @@ -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 }) => (
Expand Down
2 changes: 1 addition & 1 deletion components/markets/MarketsTables/poolMobile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ const GridAPRItem: FC<{
<ImportExportIcon sx={{ fontSize: 14, color: palette.operation.variable }} />
)}
<Typography width="fit-content" variant="subtitle2" color="grey.500">
{maturity ? parseTimestamp(maturity) : 'Open-endened'}
{maturity ? parseTimestamp(maturity) : 'Open-ended'}
</Typography>
</Grid>
</Grid>
Expand Down
4 changes: 2 additions & 2 deletions components/markets/MarketsTables/poolTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ const PoolTable: FC<PoolTableProps> = ({ isLoading, headers, rows }) => {
<ImportExportIcon sx={{ fontSize: 16, color: palette.operation.variable }} />
)}
<Typography width="fit-content" variant="subtitle2" color="grey.500">
{depositMaturity ? parseTimestamp(depositMaturity) : 'Open-endened'}
{depositMaturity ? parseTimestamp(depositMaturity) : 'Open-ended'}
</Typography>
</Grid>
</Box>
Expand Down Expand Up @@ -255,7 +255,7 @@ const PoolTable: FC<PoolTableProps> = ({ isLoading, headers, rows }) => {
<ImportExportIcon sx={{ fontSize: 16, color: palette.operation.variable }} />
)}
<Typography width="fit-content" variant="subtitle2" color="grey.500">
{borrowMaturity ? parseTimestamp(borrowMaturity) : 'Open-endened'}
{borrowMaturity ? parseTimestamp(borrowMaturity) : 'Open-ended'}
</Typography>
</Grid>
</Box>
Expand Down
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 2102f00

Please sign in to comment.