improve lobby

This commit is contained in:
Gimle Larpes 2025-06-29 20:01:25 +02:00
parent a55065b1de
commit 64fc3066a1
3 changed files with 87 additions and 21 deletions

View file

@ -314,11 +314,11 @@ export function Space() {
);
/**
* Recursively checks if a given parentId (and its ancestors) is in a closed category.
* Recursively checks if a given parentId (or all its ancestors) is in a closed category.
*
* @param spaceId - The root space ID.
* @param parentId - The parent space ID to start the check from.
* @returns True if parentId or any ancestor is in a closed category.
* @returns True if parentId or all ancestors is in a closed category.
*/
const getInClosedCategories = useCallback(
(spaceId: string, parentId: string): boolean => {
@ -331,14 +331,14 @@ export function Space() {
return false;
}
let closed = false;
let anyOpen = false;
parentParentIds.forEach((id) => {
if (getInClosedCategories(spaceId, id)) {
closed = true;
if (!getInClosedCategories(spaceId, id)) {
anyOpen = true;
}
});
return closed;
return !anyOpen;
},
[closedCategories, roomToParents]
);