Skip to content

Commit

Permalink
feat: Hide MoreMenu if has no action available
Browse files Browse the repository at this point in the history
  • Loading branch information
Merkur39 committed Nov 26, 2024
1 parent c4b3656 commit 0b273ce
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/modules/public/PublicToolbarByLink.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ const PublicToolbarByLink = ({
actionOptions
)

const isMoreMenuDisplayed = actions.length > 0 || files.length > 1

return (
<BarRightOnMobile>
<AddMenuProvider
Expand All @@ -60,15 +62,17 @@ const PublicToolbarByLink = ({
)}
</>
)}
<PublicToolbarMoreMenu
files={files}
hasWriteAccess={hasWriteAccess}
showSelectionBar={showSelectionBar}
actions={actions}
>
{isMobile && hasWriteAccess && <AddMenuItem />}
{files.length > 1 && <SelectableItem onClick={showSelectionBar} />}
</PublicToolbarMoreMenu>
{isMoreMenuDisplayed && (
<PublicToolbarMoreMenu
files={files}
hasWriteAccess={hasWriteAccess}
showSelectionBar={showSelectionBar}
actions={actions}
>
{isMobile && hasWriteAccess && <AddMenuItem />}
{files.length > 1 && <SelectableItem onClick={showSelectionBar} />}
</PublicToolbarMoreMenu>
)}
</AddMenuProvider>
</BarRightOnMobile>
)
Expand Down

0 comments on commit 0b273ce

Please sign in to comment.