Skip to content

Commit

Permalink
fix: layout, icons, final cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
grothem committed Oct 27, 2024
1 parent 3215666 commit 889a018
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 45 deletions.
2 changes: 1 addition & 1 deletion src/components/transactions/Emode/EmodeModalContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ export const EmodeModalContent = ({ user }: { user: ExtendedFormattedUser }) =>
>
<TableCell align="center" sx={{ py: 1 }}>
<Stack direction="row" gap={1} alignItems="center">
<TokenIcon symbol={asset.symbol} sx={{ fontSize: '16px' }} />
<TokenIcon symbol={asset.iconSymbol} sx={{ fontSize: '16px' }} />
<Typography variant="secondary12">{asset.symbol}</Typography>
</Stack>
</TableCell>
Expand Down
1 change: 1 addition & 0 deletions src/helpers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export type EmodeCategory = {
assets: Array<{
underlyingAsset: string;
symbol: string;
iconSymbol: string;
collateral: boolean;
borrowable: boolean;
}>;
Expand Down
8 changes: 1 addition & 7 deletions src/hooks/app-data-provider/useAppDataProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,7 @@ export const AppDataProvider: React.FC = ({ children }) => {
reserves: formattedPoolReserves || [],
eModes,
user,
userReserves:
userReserves?.map((r) => ({
...r,
stableBorrowRate: '0',
principalStableDebt: '0',
stableBorrowLastUpdateTimestamp: 0,
})) || [],
userReserves: userReserves || [],
marketReferencePriceInUsd: baseCurrencyData?.marketReferenceCurrencyPriceInUsd || '0',
marketReferenceCurrencyDecimals: baseCurrencyData?.marketReferenceCurrencyDecimals || 0,
// TODO: we should consider removing this from the context and use zustand instead. If we had a selector that would return the formatted gho data, I think that
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { InformationCircleIcon } from '@heroicons/react/outline';
import { Trans } from '@lingui/macro';
import { Box, Button, SvgIcon, useMediaQuery, useTheme } from '@mui/material';
import { Box, Button, Stack, SvgIcon, useMediaQuery, useTheme } from '@mui/material';
import { ContentWithTooltip } from 'src/components/ContentWithTooltip';
import { GhoIncentivesCard } from 'src/components/incentives/GhoIncentivesCard';
import { FixedAPYTooltipText } from 'src/components/infoTooltips/FixedAPYTooltip';
Expand Down Expand Up @@ -148,30 +148,30 @@ const GhoBorrowedPositionsListItemDesktop = ({
subValue={userGhoBorrowBalance}
/>
<ListColumn>
<GhoIncentivesCard
withTokenIcon={hasDiscount}
value={ghoLoadingData || !ghoUserDataFetched ? -1 : borrowRateAfterDiscount}
data-cy={`apyType`}
stkAaveBalance={userDiscountTokenBalance}
ghoRoute={ROUTES.reserveOverview(underlyingAsset, currentMarket) + '/#discount'}
userQualifiesForDiscount={hasDiscount}
/>
</ListColumn>
<ListColumn>
<ContentWithTooltip tooltipContent={FixedAPYTooltipText} offset={[0, -4]} withoutHover>
<Button
variant="outlined"
size="small"
color="primary"
disabled
data-cy={`apyButton_fixed`}
>
GHO RATE
<SvgIcon sx={{ marginLeft: '2px', fontSize: '14px' }}>
<InformationCircleIcon />
</SvgIcon>
</Button>
</ContentWithTooltip>
<Stack direction="row" gap={1}>
<GhoIncentivesCard
withTokenIcon={hasDiscount}
value={ghoLoadingData || !ghoUserDataFetched ? -1 : borrowRateAfterDiscount}
data-cy={`apyType`}
stkAaveBalance={userDiscountTokenBalance}
ghoRoute={ROUTES.reserveOverview(underlyingAsset, currentMarket) + '/#discount'}
userQualifiesForDiscount={hasDiscount}
/>
<ContentWithTooltip tooltipContent={FixedAPYTooltipText} offset={[0, -4]} withoutHover>
<Button
variant="outlined"
size="small"
color="primary"
disabled
data-cy={`apyButton_fixed`}
>
GHO RATE
{/* <SvgIcon sx={{ marginLeft: '2px', fontSize: '12px' }}>
<InformationCircleIcon />
</SvgIcon> */}
</Button>
</ContentWithTooltip>
</Stack>
</ListColumn>
<ListButtonsColumn>
{showSwitchButton ? (
Expand Down
14 changes: 6 additions & 8 deletions src/modules/dashboard/lists/ListItemLoader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ListColumn } from '../../../components/lists/ListColumn';
import { ListItem } from '../../../components/lists/ListItem';
import { ListButtonsColumn } from './ListButtonsColumn';

export const ListItemLoader = () => {
export const ListItemLoader = ({ columns }: { columns: number }) => {
return (
<ListItem>
<ListColumn maxWidth={160} isRow>
Expand All @@ -14,13 +14,11 @@ export const ListItemLoader = () => {
</Box>
</ListColumn>

<ListColumn>
<Skeleton width={70} height={20} />
</ListColumn>

<ListColumn>
<Skeleton width={70} height={20} />
</ListColumn>
{Array.from({ length: columns - 1 }).map((_, index) => (
<ListColumn key={index}>
<Skeleton width={70} height={20} />
</ListColumn>
))}

<ListButtonsColumn>
<Skeleton height={38} width={74} />
Expand Down
4 changes: 2 additions & 2 deletions src/modules/dashboard/lists/ListLoader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export const ListLoader = ({ title, withTopMargin, head }: ListLoaderProps) => {
{!downToXSM && <ListHeader head={head} />}
{!downToXSM ? (
<>
<ListItemLoader />
<ListItemLoader />
<ListItemLoader columns={head.length} />
<ListItemLoader columns={head.length} />
</>
) : (
<MobileListItemLoader />
Expand Down
11 changes: 9 additions & 2 deletions src/store/poolSelectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { FormattedReservesAndIncentives } from 'src/hooks/pool/usePoolFormattedR
import { CustomMarket, marketsData, NetworkConfig } from 'src/utils/marketsAndNetworksConfig';

import { PoolReserve } from './poolSlice';
import { fetchIconSymbolAndName } from 'src/ui-config/reservePatches';

export const selectCurrentChainIdMarkets = (
chainId: number,
Expand Down Expand Up @@ -54,6 +55,10 @@ export const formatEmodes = (reserves: FormattedReservesAndIncentives[]) => {
const eModes: Record<number, EmodeCategory> = {};

reserves.forEach((r) => {
const { symbol, iconSymbol } = fetchIconSymbolAndName({
underlyingAsset: r.underlyingAsset,
symbol: r.symbol,
});
r.eModes.forEach((e) => {
if (!eModes[e.id]) {
eModes[e.id] = {
Expand All @@ -65,7 +70,8 @@ export const formatEmodes = (reserves: FormattedReservesAndIncentives[]) => {
assets: [
{
underlyingAsset: r.underlyingAsset,
symbol: r.symbol,
symbol,
iconSymbol,
collateral: e.collateralEnabled && r.baseLTVasCollateral !== '0',
borrowable: e.borrowingEnabled,
},
Expand All @@ -74,7 +80,8 @@ export const formatEmodes = (reserves: FormattedReservesAndIncentives[]) => {
} else {
eModes[e.id].assets.push({
underlyingAsset: r.underlyingAsset,
symbol: r.symbol,
symbol,
iconSymbol,
collateral: e.collateralEnabled && r.baseLTVasCollateral !== '0',
borrowable: e.borrowingEnabled,
});
Expand Down

0 comments on commit 889a018

Please sign in to comment.