-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into jjjj/jup-api-liquidator
- Loading branch information
Showing
88 changed files
with
2,770 additions
and
1,610 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file removed
BIN
-116 KB
apps/marginfi-v2-ui/src/assets/IBM_Plex_Mono/IBMPlexMono-BoldItalic.ttf
Binary file not shown.
Binary file removed
BIN
-108 KB
apps/marginfi-v2-ui/src/assets/IBM_Plex_Mono/IBMPlexMono-ExtraLight.ttf
Binary file not shown.
Binary file removed
BIN
-116 KB
apps/marginfi-v2-ui/src/assets/IBM_Plex_Mono/IBMPlexMono-ExtraLightItalic.ttf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-115 KB
apps/marginfi-v2-ui/src/assets/IBM_Plex_Mono/IBMPlexMono-LightItalic.ttf
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-115 KB
apps/marginfi-v2-ui/src/assets/IBM_Plex_Mono/IBMPlexMono-MediumItalic.ttf
Binary file not shown.
Binary file removed
BIN
-107 KB
apps/marginfi-v2-ui/src/assets/IBM_Plex_Mono/IBMPlexMono-Regular.ttf
Binary file not shown.
Binary file removed
BIN
-112 KB
apps/marginfi-v2-ui/src/assets/IBM_Plex_Mono/IBMPlexMono-SemiBold.ttf
Binary file not shown.
Binary file removed
BIN
-119 KB
apps/marginfi-v2-ui/src/assets/IBM_Plex_Mono/IBMPlexMono-SemiBoldItalic.ttf
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-117 KB
apps/marginfi-v2-ui/src/assets/IBM_Plex_Mono/IBMPlexMono-ThinItalic.ttf
Binary file not shown.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file removed
BIN
-180 KB
apps/marginfi-v2-ui/src/assets/IBM_Plex_Sans/IBMPlexSans-BoldItalic.ttf
Binary file not shown.
Binary file removed
BIN
-175 KB
apps/marginfi-v2-ui/src/assets/IBM_Plex_Sans/IBMPlexSans-ExtraLight.ttf
Binary file not shown.
Binary file removed
BIN
-183 KB
apps/marginfi-v2-ui/src/assets/IBM_Plex_Sans/IBMPlexSans-ExtraLightItalic.ttf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-182 KB
apps/marginfi-v2-ui/src/assets/IBM_Plex_Sans/IBMPlexSans-LightItalic.ttf
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-181 KB
apps/marginfi-v2-ui/src/assets/IBM_Plex_Sans/IBMPlexSans-MediumItalic.ttf
Binary file not shown.
Binary file removed
BIN
-172 KB
apps/marginfi-v2-ui/src/assets/IBM_Plex_Sans/IBMPlexSans-Regular.ttf
Binary file not shown.
Binary file removed
BIN
-173 KB
apps/marginfi-v2-ui/src/assets/IBM_Plex_Sans/IBMPlexSans-SemiBold.ttf
Binary file not shown.
Binary file removed
BIN
-182 KB
apps/marginfi-v2-ui/src/assets/IBM_Plex_Sans/IBMPlexSans-SemiBoldItalic.ttf
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-184 KB
apps/marginfi-v2-ui/src/assets/IBM_Plex_Sans/IBMPlexSans-ThinItalic.ttf
Binary file not shown.
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
apps/marginfi-v2-ui/src/components/common/AssetList/AssetList.utils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const SWITCHBOARD_BANKS = ["JLP", "SHDW", "STEP", "GUAC", "BLZE", "OPOS", "LST", "UXD", "DUST", "KIN"]; |
131 changes: 131 additions & 0 deletions
131
apps/marginfi-v2-ui/src/components/common/AssetList/AssetListFilters.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
import React from "react"; | ||
|
||
import { useUiStore, SORT_OPTIONS_MAP } from "~/store"; | ||
import { cn } from "~/utils"; | ||
import { useWalletContext } from "~/hooks/useWalletContext"; | ||
|
||
import { MrgnLabeledSwitch } from "~/components/common/MrgnLabeledSwitch"; | ||
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, sortDirection, SortAssetOption } from "~/types"; | ||
|
||
export const AssetListFilters = () => { | ||
const { connected } = useWalletContext(); | ||
const [ | ||
lendingMode, | ||
setLendingMode, | ||
poolFilter, | ||
setPoolFilter, | ||
isFilteredUserPositions, | ||
setIsFilteredUserPositions, | ||
setIsWalletAuthDialogOpen, | ||
sortOption, | ||
setSortOption, | ||
] = useUiStore((state) => [ | ||
state.lendingMode, | ||
state.setLendingMode, | ||
state.poolFilter, | ||
state.setPoolFilter, | ||
state.isFilteredUserPositions, | ||
state.setIsFilteredUserPositions, | ||
state.setIsWalletAuthDialogOpen, | ||
state.sortOption, | ||
state.setSortOption, | ||
]); | ||
|
||
return ( | ||
<div className="col-span-full w-full space-y-5"> | ||
<NewAssetBanner | ||
asset="render" | ||
image="https://shdw-drive.genesysgo.net/5zseP54TGrcz9C8HdjZwJJsZ6f3VbP11p1abwKWGykZH/rndr.png" | ||
/> | ||
<div className="flex flex-col gap-2 lg:flex-row lg:items-center lg:gap-8"> | ||
<div className="flex w-[150px] h-[42px] mr-auto"> | ||
<MrgnLabeledSwitch | ||
labelLeft="Lend" | ||
labelRight="Borrow" | ||
checked={lendingMode === LendingModes.BORROW} | ||
onClick={() => setLendingMode(lendingMode === LendingModes.LEND ? LendingModes.BORROW : LendingModes.LEND)} | ||
/> | ||
</div> | ||
<div | ||
className={cn("flex items-center gap-1 text-sm", !connected && "opacity-50")} | ||
onClick={(e) => { | ||
e.stopPropagation(); | ||
if (connected) return; | ||
setIsWalletAuthDialogOpen(true); | ||
}} | ||
> | ||
<MrgnContainedSwitch | ||
checked={isFilteredUserPositions} | ||
onChange={() => { | ||
setIsFilteredUserPositions(!isFilteredUserPositions); | ||
setPoolFilter(PoolTypes.ALL); | ||
}} | ||
inputProps={{ "aria-label": "controlled" }} | ||
className={cn(!connected && "pointer-events-none")} | ||
/> | ||
<div>Filter my positions</div> | ||
</div> | ||
<div className="flex flex-col md:flex-row md:items-center gap-3"> | ||
<div className="space-y-2 w-full md:w-auto"> | ||
<Select | ||
value={poolFilter} | ||
disabled={isFilteredUserPositions} | ||
onValueChange={(value) => { | ||
setPoolFilter(value as PoolTypes); | ||
}} | ||
> | ||
<SelectTrigger className="md:w-[180px]"> | ||
<div className="flex items-center gap-2"> | ||
<IconFilter size={18} /> | ||
<SelectValue defaultValue="allpools" placeholder="Select pools" /> | ||
</div> | ||
</SelectTrigger> | ||
<SelectContent> | ||
<SelectItem value="all">All pools</SelectItem> | ||
<SelectItem value="isolated">Isolated pools</SelectItem> | ||
<SelectItem value="stable">Stablecoins</SelectItem> | ||
<SelectItem value="lst">SOL / LST</SelectItem> | ||
</SelectContent> | ||
</Select> | ||
</div> | ||
<div className="space-y-2 w-full md:w-auto"> | ||
<Select | ||
value={sortOption.value} | ||
disabled={isFilteredUserPositions} | ||
onValueChange={(value) => setSortOption(SORT_OPTIONS_MAP[value as SortType])} | ||
> | ||
<SelectTrigger className="md:w-[220px]"> | ||
<div className="flex items-center gap-2"> | ||
{sortOption.direction === sortDirection.ASC ? ( | ||
<IconSortAscending size={18} /> | ||
) : ( | ||
<IconSortDescending size={18} /> | ||
)} | ||
<SelectValue placeholder="Order by" /> | ||
</div> | ||
</SelectTrigger> | ||
<SelectContent> | ||
{Object.values(SORT_OPTIONS_MAP).map((option) => { | ||
const opt = option as SortAssetOption; | ||
return ( | ||
<SelectItem key={opt.value} value={opt.value}> | ||
<div className="flex items-center gap-2"> | ||
{lendingMode === LendingModes.LEND || !opt.borrowLabel ? opt.label : opt.borrowLabel} | ||
</div> | ||
</SelectItem> | ||
); | ||
})} | ||
</SelectContent> | ||
</Select> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; |
Oops, something went wrong.