Skip to content

Commit

Permalink
feat: mobile account switcher
Browse files Browse the repository at this point in the history
  • Loading branch information
chambaz committed Nov 23, 2023
1 parent 2f9e5ef commit 4f9bf39
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 11 additions & 2 deletions apps/marginfi-v2-ui/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@ const Home = () => {

<Mobile>
<PageHeader>lend</PageHeader>
{walletAddress && selectedAccount && marginfiAccounts.length > 1 && (
<MultipleAccountsBanner
selectedAccount={selectedAccount}
marginfiAccounts={marginfiAccounts}
fetchMrgnlendState={fetchMrgnlendState}
isRefreshing={isRefreshingStore}
setIsRefreshing={setIsRefreshingStore}
/>
)}
<div className="flex flex-col w-full h-full justify-start content-start pt-4 px-4 gap-4 mb-20">
<MobileAssetsList />
</div>
Expand Down Expand Up @@ -165,11 +174,11 @@ const MultipleAccountsBanner = ({
}}
>
<SelectTrigger className="w-[180px]">{isRefreshing ? "Loading..." : shortAddress}</SelectTrigger>
<SelectContent>
<SelectContent className="w-full">
<SelectGroup>
<SelectLabel>Accounts</SelectLabel>
{marginfiAccounts.map((account, index) => (
<SelectItem key={index} value={account.address.toBase58()}>
<SelectItem key={index} value={account.address.toBase58()} className="!text-xs">
{account.address.toBase58()}
</SelectItem>
))}
Expand Down
2 changes: 0 additions & 2 deletions packages/marginfi-client-v2/src/models/account/pure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,8 @@ class MarginfiAccount {
// ------------------------------------- //
// collateral bank with positive weights //
// ------------------------------------- //
console.log("here");
// bypass volatility factor if no liabilities or if all collateral is untied
if (liabilitiesInit.isZero() || initCollateralForBank.lte(freeCollateral)) {
console.log("aqui");
return entireBalance;
}

Expand Down

0 comments on commit 4f9bf39

Please sign in to comment.