forked from solana-labs/governance-ui
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Solend to treasury investments UI (solana-labs#749)
* add withdraw * complete solend investment integration * DRY investment mint * remove console.log * fix case where token has no strategy in main market * fix case where token has no strategy in main market for withdraw too
- Loading branch information
Showing
10 changed files
with
1,514 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { useState } from 'react' | ||
import { SolendStrategy } from 'Strategies/types/types' | ||
import ButtonGroup from '@components/ButtonGroup' | ||
import { AssetAccount } from '@utils/uiTypes/assets' | ||
import { CreateSolendStrategyParams } from 'Strategies/protocols/solend' | ||
import SolendDeposit from './solend/SolendDeposit' | ||
import SolendWithdraw from './solend/SolendWithdraw' | ||
|
||
const DEPOSIT = 'Deposit' | ||
const WITHDRAW = 'Withdraw' | ||
|
||
const SolendDepositComponent = ({ | ||
proposedInvestment, | ||
handledMint, | ||
createProposalFcn, | ||
governedTokenAccount, | ||
}: { | ||
proposedInvestment: SolendStrategy | ||
handledMint: string | ||
createProposalFcn: CreateSolendStrategyParams | ||
governedTokenAccount: AssetAccount | ||
}) => { | ||
const [proposalType, setProposalType] = useState('Deposit') | ||
|
||
const tabs = [DEPOSIT, WITHDRAW] | ||
|
||
return ( | ||
<div> | ||
<div className="pb-4"> | ||
<ButtonGroup | ||
activeValue={proposalType} | ||
className="h-10" | ||
onChange={(v) => setProposalType(v)} | ||
values={tabs} | ||
/> | ||
</div> | ||
{proposalType === WITHDRAW && ( | ||
<SolendWithdraw | ||
proposedInvestment={proposedInvestment} | ||
handledMint={handledMint} | ||
createProposalFcn={createProposalFcn} | ||
governedTokenAccount={governedTokenAccount} | ||
/> | ||
)} | ||
{proposalType === DEPOSIT && ( | ||
<SolendDeposit | ||
proposedInvestment={proposedInvestment} | ||
handledMint={handledMint} | ||
createProposalFcn={createProposalFcn} | ||
governedTokenAccount={governedTokenAccount} | ||
/> | ||
)} | ||
</div> | ||
) | ||
} | ||
|
||
export default SolendDepositComponent |
Oops, something went wrong.