From 00209ef9c3948e9e34b25672df692d323eee3018 Mon Sep 17 00:00:00 2001 From: David Luzar Date: Fri, 5 Feb 2021 15:45:44 +0100 Subject: [PATCH] fix: hide collaborator list on mobile if empty (#2938) Co-authored-by: Lipis --- src/components/LayerUI.tsx | 23 +++++++++++---------- src/components/MobileMenu.tsx | 38 ++++++++++++++++++----------------- 2 files changed, 32 insertions(+), 29 deletions(-) diff --git a/src/components/LayerUI.tsx b/src/components/LayerUI.tsx index ad30daf59c..2bb8c984c2 100644 --- a/src/components/LayerUI.tsx +++ b/src/components/LayerUI.tsx @@ -513,17 +513,18 @@ const LayerUI = ({ "transition-right": zenModeEnabled, })} > - {Array.from(appState.collaborators) - // Collaborator is either not initialized or is actually the current user. - .filter(([_, client]) => Object.keys(client).length !== 0) - .map(([clientId, client]) => ( - - {actionManager.renderAction("goToCollaborator", clientId)} - - ))} + {appState.collaborators.size > 0 && + Array.from(appState.collaborators) + // Collaborator is either not initialized or is actually the current user. + .filter(([_, client]) => Object.keys(client).length !== 0) + .map(([clientId, client]) => ( + + {actionManager.renderAction("goToCollaborator", clientId)} + + ))} diff --git a/src/components/MobileMenu.tsx b/src/components/MobileMenu.tsx index fafdaa4cec..a23c4c6fba 100644 --- a/src/components/MobileMenu.tsx +++ b/src/components/MobileMenu.tsx @@ -152,24 +152,26 @@ export const MobileMenu = ({ {renderCanvasActions()} {renderCustomFooter?.(true)} -
- {t("labels.collaborators")} - - {Array.from(appState.collaborators) - // Collaborator is either not initialized or is actually the current user. - .filter( - ([_, client]) => Object.keys(client).length !== 0, - ) - .map(([clientId, client]) => ( - - {actionManager.renderAction( - "goToCollaborator", - clientId, - )} - - ))} - -
+ {appState.collaborators.size > 0 && ( +
+ {t("labels.collaborators")} + + {Array.from(appState.collaborators) + // Collaborator is either not initialized or is actually the current user. + .filter( + ([_, client]) => Object.keys(client).length !== 0, + ) + .map(([clientId, client]) => ( + + {actionManager.renderAction( + "goToCollaborator", + clientId, + )} + + ))} + +
+ )}