From cd1d55ac640355a16e30599a4fcc556d5bb76471 Mon Sep 17 00:00:00 2001 From: Adam Chambers Date: Fri, 24 Nov 2023 16:55:31 -0500 Subject: [PATCH] fix: mobile filter / sort onChange --- .../MobileAssetsList/MobileAssetsList.tsx | 76 +++++++++++-------- 1 file changed, 45 insertions(+), 31 deletions(-) diff --git a/apps/marginfi-v2-ui/src/components/mobile/MobileAssetsList/MobileAssetsList.tsx b/apps/marginfi-v2-ui/src/components/mobile/MobileAssetsList/MobileAssetsList.tsx index 32ca0fddb8..5fb1c72c0e 100644 --- a/apps/marginfi-v2-ui/src/components/mobile/MobileAssetsList/MobileAssetsList.tsx +++ b/apps/marginfi-v2-ui/src/components/mobile/MobileAssetsList/MobileAssetsList.tsx @@ -9,7 +9,15 @@ import { useMrgnlendStore, useUiStore } from "~/store"; import { useWalletContext } from "~/hooks/useWalletContext"; import { MrgnTooltip } from "~/components/common"; -import { LSTDialog, LSTDialogVariants, AssetListFilters, sortApRate, sortTvl } from "~/components/common/AssetList"; +import { + LSTDialog, + LSTDialogVariants, + AssetListFilters, + sortApRate, + sortTvl, + STABLECOINS, + LSTS, +} from "~/components/common/AssetList"; import { AssetCard } from "~/components/mobile/MobileAssetsList/AssetCard"; import { LendingModes } from "~/types"; @@ -90,24 +98,28 @@ export const MobileAssetsList = () => { {isStoreInitialized && globalBanks ? ( globalBanks.length > 0 ? (
- {globalBanks.map((bank) => ( - void) => { - setLSTDialogVariant(variant); - setIsLSTDialogOpen(true); - if (onClose) { - setLSTDialogCallback(() => onClose); - } - }} - /> - ))} + {globalBanks.map((bank) => { + if (poolFilter === "stable" && !STABLECOINS.includes(bank.meta.tokenSymbol)) return null; + if (poolFilter === "lst" && !LSTS.includes(bank.meta.tokenSymbol)) return null; + return ( + void) => { + setLSTDialogVariant(variant); + setIsLSTDialogOpen(true); + if (onClose) { + setLSTDialogCallback(() => onClose); + } + }} + /> + ); + })}
) : ( @@ -129,7 +141,7 @@ export const MobileAssetsList = () => { )} )} - {poolFilter === "isolated" && ( + {poolFilter !== "stable" && poolFilter !== "lst" && (
Isolated pools @@ -153,17 +165,19 @@ export const MobileAssetsList = () => { {isStoreInitialized && globalBanks ? ( isolatedBanks.length > 0 ? (
- {isolatedBanks.map((bank, i) => ( - - ))} + {isolatedBanks.map((bank, i) => { + return ( + + ); + })}
) : (