Disable srm deposit button if srm wallet account doesn't exist

This commit is contained in:
Tyler Shipe 2021-05-05 12:43:13 -04:00
parent a38752d792
commit 3a3682c085
2 changed files with 7 additions and 2 deletions

View File

@ -14,7 +14,7 @@ type AccountSelectProps = {
onSelectAccount: (x) => any onSelectAccount: (x) => any
getBalance?: (x) => any getBalance?: (x) => any
hideAddress?: boolean hideAddress?: boolean
symbols?: Array<{ [key: string]: string }> symbols?: { [key: string]: string }
} }
const AccountSelect = ({ const AccountSelect = ({

View File

@ -91,6 +91,7 @@ const DepositSrmModal = ({ isOpen, onClose }) => {
</Modal.Header> </Modal.Header>
<> <>
<AccountSelect <AccountSelect
symbols={{ SRM: srmMintAddress }}
accounts={depositAccounts} accounts={depositAccounts}
selectedAccount={selectedAccount} selectedAccount={selectedAccount}
onSelectAccount={setSelectedAccount} onSelectAccount={setSelectedAccount}
@ -116,7 +117,11 @@ const DepositSrmModal = ({ isOpen, onClose }) => {
/> />
</div> </div>
<div className={`mt-5 flex justify-center`}> <div className={`mt-5 flex justify-center`}>
<Button onClick={handleDeposit} className="w-full"> <Button
onClick={handleDeposit}
className="w-full"
disabled={!selectedAccount}
>
<div className={`flex items-center justify-center`}> <div className={`flex items-center justify-center`}>
{submitting && <Loading />} {submitting && <Loading />}
{`Deposit ${inputAmount ? inputAmount : ''} SRM {`Deposit ${inputAmount ? inputAmount : ''} SRM