import { useCallback, useState } from 'react' import { MenuIcon, XIcon } from '@heroicons/react/outline' import { abbreviateAddress } from '../utils/index' import MenuItem from './MenuItem' import ThemeSwitch from './ThemeSwitch' import useMangoStore from '../stores/useMangoStore' import ConnectWalletButton from './ConnectWalletButton' import NavDropMenu from './NavDropMenu' import AccountsModal from './AccountsModal' import Button from './Button' const TopBar = () => { const connected = useMangoStore((s) => s.wallet.connected) const mangoAccount = useMangoStore((s) => s.selectedMangoAccount.current) const wallet = useMangoStore((s) => s.wallet.current) const [showMenu, setShowMenu] = useState(false) const [showAccountsModal, setShowAccountsModal] = useState(false) const handleCloseAccounts = useCallback(() => { setShowAccountsModal(false) }, []) return ( <> Trade Account Borrow Stats Learn {/* TODO: change v2 link before mainnet */} {mangoAccount ? ( setShowAccountsModal(true)} > Account {abbreviateAddress(mangoAccount.publicKey)} ) : null} setShowMenu((showMenu) => !showMenu)} > Open main menu {showMenu ? ( ) : ( )} Trade Account Borrow Stats Learn {connected && wallet?.publicKey ? ( wallet.disconnect()} > Disconnect ) : ( wallet.connect()} > Connect Wallet )} {showAccountsModal ? ( ) : null} > ) } export default TopBar