import { useCallback, useState } from 'react' import Link from 'next/link' import { abbreviateAddress } from '../utils/index' import useLocalStorageState from '../hooks/useLocalStorageState' 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 LanguageSwitch from './LanguageSwitch' import { DEFAULT_MARKET_KEY, initialMarket } from './SettingsModal' // import { useRouter } from 'next/router' import { useTranslation } from 'next-i18next' import Settings from './Settings' const TopBar = () => { const { t } = useTranslation('common') const mangoAccount = useMangoStore((s) => s.selectedMangoAccount.current) const connected = useMangoStore((s) => s.wallet.connected) const [showAccountsModal, setShowAccountsModal] = useState(false) const [defaultMarket] = useLocalStorageState( DEFAULT_MARKET_KEY, initialMarket ) const handleCloseAccounts = useCallback(() => { setShowAccountsModal(false) }, []) return ( <> {t('trade')} {t('account')} {t('borrow')} {t('stats')} {t('learn')} {/* { handleLocaleChange('en') }} > English { handleLocaleChange('zh') }} > 简体中文 { handleLocaleChange('zh_tw') }} > 繁體中文 */} {mangoAccount ? ( setShowAccountsModal(true)} > {t('account')} {mangoAccount.name ? mangoAccount.name : abbreviateAddress(mangoAccount.publicKey)} ) : null} {showAccountsModal ? ( ) : null} > ) } export default TopBar