From a4882a199b74a13ee59b92fb0dcb07859c1c5369 Mon Sep 17 00:00:00 2001 From: AlexisG Date: Fri, 29 Nov 2024 12:17:43 +0100 Subject: [PATCH] feat: Do not display MoreMenu if has no actions --- src/modules/public/PublicToolbarByLink.jsx | 2 +- src/modules/public/PublicToolbarCozyToCozy.jsx | 2 +- src/modules/public/PublicToolbarMoreMenu.jsx | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/public/PublicToolbarByLink.jsx b/src/modules/public/PublicToolbarByLink.jsx index 3d10b07174..dee5dd86a2 100644 --- a/src/modules/public/PublicToolbarByLink.jsx +++ b/src/modules/public/PublicToolbarByLink.jsx @@ -41,7 +41,7 @@ const PublicToolbarByLink = ({ const actions = makeActions( [ isMobile && download, - select, + files.length > 1 && select, addItems, isMobile && (files.length > 1 || hasWriteAccess) && hr, isMobile && openExternalLink diff --git a/src/modules/public/PublicToolbarCozyToCozy.jsx b/src/modules/public/PublicToolbarCozyToCozy.jsx index f2387ef5be..b41e8296dc 100644 --- a/src/modules/public/PublicToolbarCozyToCozy.jsx +++ b/src/modules/public/PublicToolbarCozyToCozy.jsx @@ -29,7 +29,7 @@ const PublicToolbarCozyToCozy = ({ const actions = makeActions( [ isMobile && download, - select, + files.length > 1 && select, ((isMobile && files.length > 0) || files.length > 1) && hr, openExternalLink ], diff --git a/src/modules/public/PublicToolbarMoreMenu.jsx b/src/modules/public/PublicToolbarMoreMenu.jsx index 3ff4db8d8f..0ec3affc05 100644 --- a/src/modules/public/PublicToolbarMoreMenu.jsx +++ b/src/modules/public/PublicToolbarMoreMenu.jsx @@ -19,6 +19,8 @@ const PublicToolbarMoreMenu = ({ files, actions }) => { openMenu() }, [closeMenu, openMenu, menuIsVisible]) + if (actions.length === 0) return null + return ( <>