Skip to content

Virtual whiteboard for sketching hand-drawn like diagrams

fix: hide collaborator list on mobile if empty (#2938)

David Luzar00209ef9c394
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]) => (
- <Tooltip
- label={client.username || "Unknown user"}
- key={clientId}
- >
- {actionManager.renderAction("goToCollaborator", clientId)}
- </Tooltip>
- ))}
+ {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]) => (
+ <Tooltip
+ label={client.username || "Unknown user"}
+ key={clientId}
+ >
+ {actionManager.renderAction("goToCollaborator", clientId)}
+ </Tooltip>
+ ))}
</UserList>
</div>
</FixedSideContainer>
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 = ({
<Stack.Col gap={4}>
{renderCanvasActions()}
{renderCustomFooter?.(true)}
- <fieldset>
- <legend>{t("labels.collaborators")}</legend>
- <UserList mobile>
- {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]) => (
- <React.Fragment key={clientId}>
- {actionManager.renderAction(
- "goToCollaborator",
- clientId,
- )}
- </React.Fragment>
- ))}
- </UserList>
- </fieldset>
+ {appState.collaborators.size > 0 && (
+ <fieldset>
+ <legend>{t("labels.collaborators")}</legend>
+ <UserList mobile>
+ {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]) => (
+ <React.Fragment key={clientId}>
+ {actionManager.renderAction(
+ "goToCollaborator",
+ clientId,
+ )}
+ </React.Fragment>
+ ))}
+ </UserList>
+ </fieldset>
+ )}
</Stack.Col>
</div>
</Section>