import { ExecuteResult } from '@cosmjs/cosmwasm-stargate' import { UseMutateFunction } from '@tanstack/react-query' import classNames from 'classnames' import { useMemo, useState } from 'react' import { FundAccountModal, WithdrawModal } from 'components/Account' import Button from 'components/Button' import ArrowDown from 'components/Icons/arrow-down.svg' import ArrowUp from 'components/Icons/arrow-up.svg' import ChevronDownIcon from 'components/Icons/expand.svg' import Overlay from 'components/Overlay' import Text from 'components/Text' interface Props { creditAccountsList: string[] selectedAccount: string | null deleteCreditAccount: UseMutateFunction setSelectedAccount: (id: string) => void createCreditAccount: () => void } const MAX_VISIBLE_CREDIT_ACCOUNTS = 5 const SubAccountNavigation = ({ creditAccountsList, createCreditAccount, deleteCreditAccount, selectedAccount, setSelectedAccount, }: Props) => { const { firstCreditAccounts, restCreditAccounts } = useMemo(() => { return { firstCreditAccounts: creditAccountsList?.slice(0, MAX_VISIBLE_CREDIT_ACCOUNTS) ?? [], restCreditAccounts: creditAccountsList?.slice(MAX_VISIBLE_CREDIT_ACCOUNTS) ?? [], } }, [creditAccountsList]) const [showManageMenu, setShowManageMenu] = useState(false) const [showMoreMenu, setShowMoreMenu] = useState(false) const [showFundWalletModal, setShowFundWalletModal] = useState(false) const [showWithdrawModal, setShowWithdrawModal] = useState(false) return ( <> {firstCreditAccounts.map((account) => ( ))}
{restCreditAccounts.length > 0 && ( <>
{restCreditAccounts.map((account) => ( ))}
)}
Manage
) } export default SubAccountNavigation