diff --git a/packages/client/src/pages/HomePage.tsx b/packages/client/src/pages/HomePage.tsx index 489075245..eb501a710 100644 --- a/packages/client/src/pages/HomePage.tsx +++ b/packages/client/src/pages/HomePage.tsx @@ -349,14 +349,19 @@ export const HomePage = observer((): JSX.Element => { } > -
- ) => { - setMetaFilters(filters); - }} - /> -
+ {!configStore.store.config.adminOnlyViewMenuBarFlag && + configStore.isEngineOperationAvailable('APP', 'add') && ( +
+ , + ) => { + setMetaFilters(filters); + }} + /> +
+ )} ({ width: SIDEBAR_DIVIDER_WIDTH, })); -const StyledContent = styled('div')(() => ({ +const StyledContent = styled('div', { + shouldForwardProp: (prop) => prop !== 'showSidebar', +})<{ showSidebar: boolean }>(({ showSidebar }) => ({ position: 'absolute', paddingTop: NAV_HEIGHT, - paddingLeft: SIDEBAR_WIDTH, + paddingLeft: showSidebar ? SIDEBAR_WIDTH : '0', height: '100%', width: '100%', overflow: 'hidden', @@ -84,26 +86,22 @@ const StyledContent = styled('div')(() => ({ export const NavigatorLayout = observer(() => { const { pathname } = useLocation(); const { configStore } = useRootStore(); - const [viewSidebar, setViewSidebar] = useState(false); - useEffect(() => { - if (configStore.store.user.admin) { - setViewSidebar(true); - } else if ( - !configStore.store.user.admin && - !configStore.store.config.adminOnlyViewMenuBarFlag - ) { - setViewSidebar(true); - } - }, [ - configStore.store.user.admin, - configStore.store.config.adminOnlyViewMenuBarFlag, - ]); + let showSidebar = true; + if (configStore.store.user.admin) { + // show the sidebar if the user is an admin + showSidebar = true; + } else if (!configStore.store.config.adminOnlyViewMenuBarFlag) { + // if the flag is false, show the sidebar + showSidebar = true; + } else { + showSidebar = false; + } return ( }> - {viewSidebar && ( + {showSidebar && ( { )} - +