import React, { ComponentType, useCallback, useState } from 'react'; import clsx from 'clsx'; import ClickAwayListener from 'react-click-away-listener'; import { Account } from 'app/components/accounts'; import AccountSwitcher from './AccountSwitcher'; import styles from './loggedInPanel.scss'; interface Props { activeAccount: Account; accounts: ReadonlyArray; onSwitchAccount?: (account: Account) => Promise; onRemoveAccount?: (account: Account) => Promise; } const LoggedInPanel: ComponentType = ({ activeAccount, accounts, onSwitchAccount, onRemoveAccount }) => { const [isAccountSwitcherActive, setAccountSwitcherState] = useState(false); const hideAccountSwitcher = useCallback(() => setAccountSwitcherState(false), []); const onAccountClick = useCallback( async (account: Account) => { if (onSwitchAccount) { await onSwitchAccount(account); } setAccountSwitcherState(false); }, [onSwitchAccount], ); return (
); }; export default LoggedInPanel;