From 116a9c9de0624e024da1c7d3afc2965a12fff5e2 Mon Sep 17 00:00:00 2001 From: Ajay Bura Date: Wed, 2 Mar 2022 21:30:14 +0530 Subject: [PATCH] Add categorize space option Signed-off-by: Ajay Bura --- src/app/molecules/space-options/SpaceOptions.jsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/app/molecules/space-options/SpaceOptions.jsx b/src/app/molecules/space-options/SpaceOptions.jsx index 223ff57..4b3e8ca 100644 --- a/src/app/molecules/space-options/SpaceOptions.jsx +++ b/src/app/molecules/space-options/SpaceOptions.jsx @@ -6,7 +6,12 @@ import { twemojify } from '../../../util/twemojify'; import initMatrix from '../../../client/initMatrix'; import { openSpaceSettings, openSpaceManage, openInviteUser } from '../../../client/action/navigation'; import { leave } from '../../../client/action/room'; -import { createSpaceShortcut, deleteSpaceShortcut } from '../../../client/action/accountData'; +import { + createSpaceShortcut, + deleteSpaceShortcut, + categorizeSpace, + unCategorizeSpace, +} from '../../../client/action/accountData'; import { MenuHeader, MenuItem } from '../../atoms/context-menu/ContextMenu'; @@ -24,6 +29,7 @@ function SpaceOptions({ roomId, afterOptionSelect }) { const room = mx.getRoom(roomId); const canInvite = room?.canInvite(mx.getUserId()); const isPinned = initMatrix.accountData.spaceShortcut.has(roomId); + const isCategorized = initMatrix.accountData.categorizedSpaces.has(roomId); const handleInviteClick = () => { openInviteUser(roomId); @@ -35,7 +41,8 @@ function SpaceOptions({ roomId, afterOptionSelect }) { afterOptionSelect(); }; const handleCategorizeClick = () => { - alert('categorize'); + if (isCategorized) unCategorizeSpace(roomId); + else categorizeSpace(roomId); afterOptionSelect(); }; const handleSettingsClick = () => { @@ -59,9 +66,9 @@ function SpaceOptions({ roomId, afterOptionSelect }) { {twemojify(`Options for ${initMatrix.matrixClient.getRoom(roomId)?.name}`)} - Categorize subspaces + {isCategorized ? 'Uncategorize subspaces' : 'Categorize subspaces'}