diff --git a/apps/marginfi-v2-ui/src/components/common/AssetList/AssetListFilters.tsx b/apps/marginfi-v2-ui/src/components/common/AssetList/AssetListFilters.tsx index aecc017b72..f2e321f554 100644 --- a/apps/marginfi-v2-ui/src/components/common/AssetList/AssetListFilters.tsx +++ b/apps/marginfi-v2-ui/src/components/common/AssetList/AssetListFilters.tsx @@ -9,8 +9,9 @@ import { MrgnContainedSwitch } from "~/components/common/MrgnContainedSwitch"; import { NewAssetBanner } from "~/components/common/AssetList"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "~/components/ui/select"; +import { IconFilter, IconSortAscending, IconSortDescending } from "~/components/ui/icons"; -import { LendingModes, PoolTypes, SortType, SortAssetOption } from "~/types"; +import { LendingModes, PoolTypes, SortType, sortDirection, SortAssetOption } from "~/types"; export const AssetListFilters = () => { const { connected } = useWalletContext(); @@ -38,8 +39,8 @@ export const AssetListFilters = () => { return (
-
-
+
+
{ onClick={() => setLendingMode(lendingMode === LendingModes.LEND ? LendingModes.BORROW : LendingModes.LEND)} />
-
- Filter - +
{ + e.stopPropagation(); + if (connected) return; + setIsWalletAuthDialogOpen(true); + }} + > + setIsFilteredUserPositions(!isFilteredUserPositions)} + inputProps={{ "aria-label": "controlled" }} + className={cn(!connected && "pointer-events-none")} + /> +
Filter my positions
-
- Sort - +
+
+ +
+
+ +
- -
{ - e.stopPropagation(); - if (connected) return; - setIsWalletAuthDialogOpen(true); - }} - > - setIsFilteredUserPositions(!isFilteredUserPositions)} - inputProps={{ "aria-label": "controlled" }} - className={cn(!connected && "pointer-events-none")} - /> -
Filter my positions
-
-
); 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 aeeb65836e..32ca0fddb8 100644 --- a/apps/marginfi-v2-ui/src/components/mobile/MobileAssetsList/MobileAssetsList.tsx +++ b/apps/marginfi-v2-ui/src/components/mobile/MobileAssetsList/MobileAssetsList.tsx @@ -8,10 +8,12 @@ import { Skeleton, Typography } from "@mui/material"; import { useMrgnlendStore, useUiStore } from "~/store"; import { useWalletContext } from "~/hooks/useWalletContext"; -import { MrgnLabeledSwitch, MrgnTooltip } from "~/components/common"; +import { MrgnTooltip } from "~/components/common"; import { LSTDialog, LSTDialogVariants, AssetListFilters, sortApRate, sortTvl } from "~/components/common/AssetList"; import { AssetCard } from "~/components/mobile/MobileAssetsList/AssetCard"; +import { LendingModes } from "~/types"; + export const MobileAssetsList = () => { const { connected } = useWalletContext(); @@ -22,14 +24,15 @@ export const MobileAssetsList = () => { state.selectedAccount, ]); - const [isFilteredUserPositions, sortOption, poolFilter] = useUiStore((state) => [ + const [lendingMode, isFilteredUserPositions, sortOption, poolFilter] = useUiStore((state) => [ + state.lendingMode, state.isFilteredUserPositions, state.sortOption, state.poolFilter, ]); + const isInLendingMode = React.useMemo(() => lendingMode === LendingModes.LEND, [lendingMode]); const inputRefs = React.useRef>({}); - const [isInLendingMode, setIsInLendingMode] = React.useState(true); const [isLSTDialogOpen, setIsLSTDialogOpen] = React.useState(false); const [lstDialogVariant, setLSTDialogVariant] = React.useState(null); const [lstDialogCallback, setLSTDialogCallback] = React.useState<(() => void) | null>(null); @@ -78,17 +81,6 @@ export const MobileAssetsList = () => { return ( <> -
-
- setIsInLendingMode(!isInLendingMode)} - /> -
-
-
{poolFilter !== "isolated" && (
diff --git a/apps/marginfi-v2-ui/src/components/ui/icons.tsx b/apps/marginfi-v2-ui/src/components/ui/icons.tsx index c1770c9721..ca2d275181 100644 --- a/apps/marginfi-v2-ui/src/components/ui/icons.tsx +++ b/apps/marginfi-v2-ui/src/components/ui/icons.tsx @@ -20,6 +20,9 @@ import { IconExternalLink, IconUserPlus, IconClockHour4, + IconFilter, + IconSortAscending, + IconSortDescending, } from "@tabler/icons-react"; import { cn } from "~/utils/themeUtils"; @@ -397,6 +400,9 @@ export { IconUserPlus, IconBrandDiscordFilled, IconClockHour4, + IconFilter, + IconSortAscending, + IconSortDescending, // customed icons IconBrandGoogle,