mars-v2-frontend/src/components/Account/AccountFund/AccountFundFullPage.tsx
Linkie Link fb830c08cc
Added chain agnostic v2 (#710)
* update assets config and chains

* make clients dynamic

* feat: formatted ChainSelect

* fix infinite rerender on trade page

* feat: added NTRN icon

* fix: fixed ChainInfoID

* fix: fixed autoLendEnabled for NTRN

* fix: fixed the navigation and dependencies

* fix: fixed the pricefeed id

* fix: fixed the header menu

* fix: fixed the trading charts

* fix: fixed the healthbars

* fix: fixed naming of pion-1

* feast: updated xdefi image

* env: updated contracts

* make localStorage chain agnostic

* fix: made the selected chain persistant

* fix: fixed the wallet providers

* fix: updated auto connect

* fix: fixed auto connecting

* fix: added ChainSelect to focusMode

* store raw strings in localstorage

* 🔥 remnove tests

* update caching keys + disconnect wallet on change chain

* fix: fixed the chain select

* env: bumped version

---------

Co-authored-by: Bob van der Helm <34470358+bobthebuidlr@users.noreply.github.com>
2024-01-03 15:50:38 +01:00

48 lines
1.6 KiB
TypeScript

import { useEffect, useState } from 'react'
import AccountFundContent from 'components/Account/AccountFund/AccountFundContent'
import Card from 'components/Card'
import { CircularProgress } from 'components/CircularProgress'
import FullOverlayContent from 'components/FullOverlayContent'
import useAccounts from 'hooks/accounts/useAccounts'
import useAccountId from 'hooks/useAccountId'
import useCurrentAccount from 'hooks/useCurrentAccount'
import useStore from 'store'
export default function AccountFundFullPage() {
const address = useStore((s) => s.address)
const accountId = useAccountId()
const { data: accounts, isLoading } = useAccounts('default', address)
const currentAccount = useCurrentAccount()
const [selectedAccountId, setSelectedAccountId] = useState<null | string>(null)
useEffect(() => {
if (accounts && !selectedAccountId && accountId) setSelectedAccountId(accountId)
if (accountId && selectedAccountId !== accountId) setSelectedAccountId(accountId)
}, [accounts, selectedAccountId, accountId, currentAccount])
if (!selectedAccountId || !address) return null
return (
<FullOverlayContent
title={`Fund Credit Account #${selectedAccountId}`}
copy='In order to start using this account, you need to deposit funds.'
docs='fund'
>
{isLoading ? (
<CircularProgress size={40} />
) : (
<Card className='w-full p-6 bg-white/5'>
<AccountFundContent
account={currentAccount}
address={address}
accountId={selectedAccountId}
isFullPage
/>
</Card>
)}
</FullOverlayContent>
)
}