Skip to content

Commit

Permalink
Merge pull request #2603 from headlamp-k8s/fix-broken-menu
Browse files Browse the repository at this point in the history
frontend: TopBar: Hide menu on mobile when empty
  • Loading branch information
joaquimrocha authored Jan 7, 2025
2 parents 5422d68 + c49aada commit 4da085f
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions frontend/src/components/App/TopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,12 @@ export const PureTopBar = memo(
),
},
];

const visibleMobileActions = processAppBarActions(
allAppBarActionsMobile,
appBarActionsProcessors
).filter(action => React.isValidElement(action.action) || typeof action === 'function');

return (
<>
<AppBar
Expand Down Expand Up @@ -429,16 +435,18 @@ export const PureTopBar = memo(
<HeadlampButton open={openSideBar} onToggleOpen={onToggleOpen} />
<Box sx={{ flexGrow: 1 }} />
<GlobalSearch isIconButton />
<IconButton
aria-label={t('show more')}
aria-controls={mobileMenuId}
aria-haspopup="true"
onClick={handleMobileMenuOpen}
color="inherit"
size="medium"
>
<Icon icon="mdi:more-vert" />
</IconButton>
{visibleMobileActions.length > 0 && (
<IconButton
aria-label={t('show more')}
aria-controls={mobileMenuId}
aria-haspopup="true"
onClick={handleMobileMenuOpen}
color="inherit"
size="medium"
>
<Icon icon="mdi:more-vert" />
</IconButton>
)}
</>
) : (
<>
Expand Down

0 comments on commit 4da085f

Please sign in to comment.