Only show left sidebar toggle if there is a sidebar

Summary:
^

Not all selections have a left sidebar. If the current selection doesn't have one, it doesn't make sense to have the toggle sidebar button, so hide it.

Reviewed By: LukeDefeo

Differential Revision: D47593545

fbshipit-source-id: 940d59536e26bd1ab341d2038df431c67e0a5442
This commit is contained in:
Lorenzo Blasa
2023-07-20 04:48:20 -07:00
committed by Facebook GitHub Bot
parent 459f16022e
commit f566fed761
3 changed files with 30 additions and 11 deletions

View File

@@ -246,20 +246,25 @@ function NotificationButton({
function LeftSidebarToggleButton() {
const dispatch = useDispatch();
const hasMainMenu = useStore((state) => state.application.hasLeftSidebar);
const mainMenuVisible = useStore(
(state) => state.application.leftSidebarVisible,
);
return (
<NavbarButton
label="Toggle Sidebar"
icon={LayoutOutlined}
toggled={!mainMenuVisible}
onClick={() => {
dispatch(toggleLeftSidebarVisible());
}}
/>
);
if (hasMainMenu) {
return (
<NavbarButton
label="Toggle Sidebar"
icon={LayoutOutlined}
toggled={!mainMenuVisible}
onClick={() => {
dispatch(toggleLeftSidebarVisible());
}}
/>
);
}
return null;
}
function RightSidebarToggleButton() {