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) useEffect(() => { if (accounts && !selectedAccountId && accountId) setSelectedAccountId(accountId) if (accountId && selectedAccountId !== accountId) setSelectedAccountId(accountId) }, [accounts, selectedAccountId, accountId, currentAccount]) if (!selectedAccountId || !address) return null return ( {isLoading ? ( ) : ( )} ) }