Skip to content

Commit c49aada

Browse files
skoevajoaquimrocha
authored andcommitted
frontend: TopBar: Hide menu on mobile when empty
This change hides the top bar menu on mobile when there are no actions to display. Fixes: #2066 Signed-off-by: Evangelos Skopelitis <eskopelitis@microsoft.com>
1 parent 5422d68 commit c49aada

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

frontend/src/components/App/TopBar.tsx

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,12 @@ export const PureTopBar = memo(
399399
),
400400
},
401401
];
402+
403+
const visibleMobileActions = processAppBarActions(
404+
allAppBarActionsMobile,
405+
appBarActionsProcessors
406+
).filter(action => React.isValidElement(action.action) || typeof action === 'function');
407+
402408
return (
403409
<>
404410
<AppBar
@@ -429,16 +435,18 @@ export const PureTopBar = memo(
429435
<HeadlampButton open={openSideBar} onToggleOpen={onToggleOpen} />
430436
<Box sx={{ flexGrow: 1 }} />
431437
<GlobalSearch isIconButton />
432-
<IconButton
433-
aria-label={t('show more')}
434-
aria-controls={mobileMenuId}
435-
aria-haspopup="true"
436-
onClick={handleMobileMenuOpen}
437-
color="inherit"
438-
size="medium"
439-
>
440-
<Icon icon="mdi:more-vert" />
441-
</IconButton>
438+
{visibleMobileActions.length > 0 && (
439+
<IconButton
440+
aria-label={t('show more')}
441+
aria-controls={mobileMenuId}
442+
aria-haspopup="true"
443+
onClick={handleMobileMenuOpen}
444+
color="inherit"
445+
size="medium"
446+
>
447+
<Icon icon="mdi:more-vert" />
448+
</IconButton>
449+
)}
442450
</>
443451
) : (
444452
<>

0 commit comments

Comments
 (0)