From b8955d63e2a69cebb44c4450c9581f23325a95ea Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 25 Apr 2022 18:26:17 -0500 Subject: [PATCH] SidebarMenu: make accounts clickable --- app/soapbox/components/sidebar_menu.tsx | 49 +++++++++++++------------ 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/app/soapbox/components/sidebar_menu.tsx b/app/soapbox/components/sidebar_menu.tsx index 2de745577..11ac907a6 100644 --- a/app/soapbox/components/sidebar_menu.tsx +++ b/app/soapbox/components/sidebar_menu.tsx @@ -79,28 +79,29 @@ const SidebarMenu: React.FC = (): JSX.Element | null => { onClose(); }; - const handleSwitchAccount = (account: AccountEntity): React.EventHandler => { + const handleSwitchAccount = (account: AccountEntity): React.MouseEventHandler => { return (e) => { e.preventDefault(); - switchAccount(account); dispatch(switchAccount(account.id)); }; }; - const onClickLogOut: React.EventHandler = (e) => { + const onClickLogOut: React.MouseEventHandler = (e) => { e.preventDefault(); dispatch(logOut(intl)); }; - const handleSwitcherClick: React.EventHandler = (e) => { + const handleSwitcherClick: React.MouseEventHandler = (e) => { e.preventDefault(); setSwitcher((prevState) => (!prevState)); }; const renderAccount = (account: AccountEntity) => ( - - + +
+ +
); @@ -155,26 +156,26 @@ const SidebarMenu: React.FC = (): JSX.Element | null => { - {/* TODO: make this available to everyone */} - {account.staff && ( - - + + + - {switcher && ( -
- {otherAccounts.map(account => renderAccount(account))} -
- )} -
- )} + {switcher && ( +
+ {otherAccounts.map(account => renderAccount(account))} +
+ )} +