mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-04 22:40:29 +03:00
minor changes
This commit is contained in:
parent
56dfc6a497
commit
e417b18835
2 changed files with 5 additions and 6 deletions
|
|
@ -239,7 +239,6 @@ export function Lobby() {
|
||||||
* @param roomId - The room ID to start the check from.
|
* @param roomId - The room ID to start the check from.
|
||||||
* @returns True if every parent category is collapsed; false otherwise.
|
* @returns True if every parent category is collapsed; false otherwise.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const getAllAncestorsCollapsed = (spaceId: string, roomId: string): boolean => {
|
const getAllAncestorsCollapsed = (spaceId: string, roomId: string): boolean => {
|
||||||
const parentIds = roomToParents.get(roomId);
|
const parentIds = roomToParents.get(roomId);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -318,6 +318,7 @@ export function Space() {
|
||||||
*
|
*
|
||||||
* @param spaceId - The root space ID.
|
* @param spaceId - The root space ID.
|
||||||
* @param parentId - The parent space ID to start the check from.
|
* @param parentId - The parent space ID to start the check from.
|
||||||
|
* @param previousId - The last ID checked, only used to ignore root collapse state.
|
||||||
* @returns True if parentId or all ancestors is in a closed category.
|
* @returns True if parentId or all ancestors is in a closed category.
|
||||||
*/
|
*/
|
||||||
const getInClosedCategories = useCallback(
|
const getInClosedCategories = useCallback(
|
||||||
|
|
@ -354,13 +355,14 @@ export function Space() {
|
||||||
// There are better ways to do this
|
// There are better ways to do this
|
||||||
const roomToChildren = useMemo(() => {
|
const roomToChildren = useMemo(() => {
|
||||||
const map = new Map<string, Set<string>>();
|
const map = new Map<string, Set<string>>();
|
||||||
|
|
||||||
roomToParents.forEach((parentSet, childId) => {
|
roomToParents.forEach((parentSet, childId) => {
|
||||||
parentSet.forEach((parentId) => {
|
parentSet.forEach((parentId) => {
|
||||||
if (!map.has(parentId)) map.set(parentId, new Set());
|
if (!map.has(parentId)) map.set(parentId, new Set());
|
||||||
/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
|
map.get(parentId)?.add(childId);
|
||||||
map.get(parentId)!.add(childId);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
return map;
|
return map;
|
||||||
}, [roomToParents]);
|
}, [roomToParents]);
|
||||||
|
|
||||||
|
|
@ -400,10 +402,8 @@ export function Space() {
|
||||||
* @param roomId - The room ID to start the check from.
|
* @param roomId - The room ID to start the check from.
|
||||||
* @returns True if every parent category is collapsed; false otherwise.
|
* @returns True if every parent category is collapsed; false otherwise.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const getAllAncestorsCollapsed = (spaceId: string, roomId: string): boolean => {
|
const getAllAncestorsCollapsed = (spaceId: string, roomId: string): boolean => {
|
||||||
const parentIds = roomToParents.get(roomId);
|
const parentIds = roomToParents.get(roomId);
|
||||||
|
|
||||||
if (!parentIds || parentIds.size === 0) {
|
if (!parentIds || parentIds.size === 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -431,7 +431,7 @@ export function Space() {
|
||||||
[getContainsShowRoom, getInClosedCategories, space.roomId]
|
[getContainsShowRoom, getInClosedCategories, space.roomId]
|
||||||
),
|
),
|
||||||
useCallback(
|
useCallback(
|
||||||
(sId) => getInClosedCategories(space.roomId, sId, sId),
|
(sId) => getInClosedCategories(space.roomId, sId),
|
||||||
[getInClosedCategories, space.roomId]
|
[getInClosedCategories, space.roomId]
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue