From fd1ccc7281fc0fd51586a8e60f9831bf93b5fb01 Mon Sep 17 00:00:00 2001 From: Gigiaj Date: Thu, 17 Apr 2025 02:35:19 -0500 Subject: [PATCH] add mute video and hangup buttons and implemented their functionality --- src/app/pages/client/space/Space.tsx | 79 ++++++++++++++-------------- 1 file changed, 39 insertions(+), 40 deletions(-) diff --git a/src/app/pages/client/space/Space.tsx b/src/app/pages/client/space/Space.tsx index 59ec557b..9dcd730a 100644 --- a/src/app/pages/client/space/Space.tsx +++ b/src/app/pages/client/space/Space.tsx @@ -82,7 +82,7 @@ import { useCallState } from '../CallProvider'; /** * Processes the raw hierarchy from useSpaceJoinedHierarchy into a flat list - * suitable for the virtualizer, including collapsible headers for text/voice channels. + * suitable for the virtualizer, including collapsible headers for text/voice rooms. * Removes the top-level "Rooms" category header. * * @param hierarchy - The raw hierarchy data (array of { roomId: string }). @@ -109,7 +109,7 @@ const processHierarchyForVirtualizer = ( if (currentCategoryRooms.text.length > 0) { processed.push({ - type: 'channel_header', + type: 'room_header', title: 'Text Rooms', categoryId: textCategoryId, key: `${parentId}-text-header`, @@ -123,7 +123,7 @@ const processHierarchyForVirtualizer = ( if (currentCategoryRooms.voice.length > 0) { processed.push({ - type: 'channel_header', + type: 'room_header', title: 'Call Rooms', categoryId: voiceCategoryId, key: `${parentId}-voice-header`, @@ -358,7 +358,15 @@ function SpaceHeader() { } function FixedBottomNavArea() { - const { sendWidgetAction, activeCallRoomId } = useCallState(); + const { + sendWidgetAction, + activeCallRoomId, + isAudioEnabled, + isVideoEnabled, + toggleAudio, + toggleVideo, + hangUp, + } = useCallState(); const mx = useMatrixClient(); const userName = mx.getUser(mx.getUserId() ?? '')?.displayName ?? mx.getUserId() ?? 'User'; @@ -371,22 +379,15 @@ function FixedBottomNavArea() { .catch((err) => logger.error(`FixedBottomNavArea: Failed action '${action}':`, err)); }; - const handleToggleMuteClick = () => { - const action = WidgetApiToWidgetAction.SetAudioInputMuted; - const data = {}; - logger.debug(`FixedBottomNavArea: Sending action '${action}'`); - sendWidgetAction(action, data) - .then(() => logger.info(`FixedBottomNavArea: Action '${action}' sent.`)) - .catch((err) => logger.error(`FixedBottomNavArea: Failed action '${action}':`, err)); - }; - if (!activeCallRoomId) { return ( No active call @@ -396,27 +397,26 @@ function FixedBottomNavArea() { } return ( - - {mx.getRoom(activeCallRoomId)?.normalizedName} - - ); -} /* - - - - + + + {/* Going to need better icons for this */} + + + + + + {mx.getRoom(activeCallRoomId)?.normalizedName} - */ + ); +} export function Space() { const mx = useMatrixClient(); @@ -493,7 +493,7 @@ export function Space() { scrollRef={scrollRef} style={{ flexGrow: 1, overflowY: 'auto', overflowX: 'hidden' }} > - + @@ -559,16 +559,15 @@ export function Space() { ); } - case 'channel_header': { + case 'room_header': { const { title, categoryId } = item; return ( - + {title} @@ -579,7 +578,7 @@ export function Space() { case 'room': { const { room } = item; return ( - +