From b4d9828017de82caa5631980d5a9c06122722f7e Mon Sep 17 00:00:00 2001 From: GigiaJ Date: Thu, 1 May 2025 16:19:04 -0500 Subject: [PATCH] Add tooltips and properly implement the navlink --- src/app/pages/call/CallNavBottom.tsx | 129 ++++++++++++++++----------- 1 file changed, 75 insertions(+), 54 deletions(-) diff --git a/src/app/pages/call/CallNavBottom.tsx b/src/app/pages/call/CallNavBottom.tsx index 79e7e7a0..d4fa8148 100644 --- a/src/app/pages/call/CallNavBottom.tsx +++ b/src/app/pages/call/CallNavBottom.tsx @@ -1,36 +1,15 @@ import { logger } from 'matrix-js-sdk/lib/logger'; +import { NavLink, useParams } from 'react-router-dom'; +import { Box, Chip, Icon, IconButton, Icons, Text, Tooltip, TooltipProvider } from 'folds'; +import React from 'react'; import { useMatrixClient } from '../../hooks/useMatrixClient'; import { useCallState } from '../client/CallProvider'; -import { Box, Chip, Icon, IconButton, Icons, Text } from 'folds'; -import { useMentionClickHandler } from '../../hooks/useMentionClickHandler'; -import { - makeMentionCustomProps, - renderMatrixMention, -} from '../../plugins/react-custom-html-parser'; export function CallNavBottom() { - const { - sendWidgetAction, - activeCallRoomId, - isAudioEnabled, - isVideoEnabled, - toggleAudio, - toggleVideo, - hangUp, - } = useCallState(); + const { activeCallRoomId, isAudioEnabled, isVideoEnabled, toggleAudio, toggleVideo, hangUp } = + useCallState(); const mx = useMatrixClient(); - const userName = mx.getUser(mx.getUserId() ?? '')?.displayName ?? mx.getUserId() ?? 'User'; - - const handleSendMessageClick = () => { - const action = 'my.custom.action'; - const data = { message: `Hello from ${userName}!` }; - 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)); - }; - - const mentionClickHandler = useMentionClickHandler(activeCallRoomId ?? mx.getUserId()); + const { roomIdOrAlias: viewedRoomId } = useParams<{ roomIdOrAlias: string }>(); if (!activeCallRoomId) { return ( @@ -49,14 +28,6 @@ export function CallNavBottom() { ); } - //Muted:{(!isAudioEnabled).toString()} - //Videosn't:{(!isVideoEnabled).toString()} - /* - - - -*/ - const test = `https://matrix.to/#/${activeCallRoomId}`; return ( {/* Going to need better icons for this */} - - - - - - - - - + + {!isAudioEnabled ? 'Unmute' : 'Mute'} + + } + > + {(triggerRef) => ( + + + + )} + + + {!isVideoEnabled ? 'Video on' : 'Video off'} + + } + > + {(triggerRef) => ( + + + + )} + + + + Hang up + + } + > + {(triggerRef) => ( + + + + )} + + - - {renderMatrixMention( - mx, - undefined, - test, - makeMentionCustomProps( - mentionClickHandler, - mx.getRoom(activeCallRoomId)?.normalizedName + + Go to room + + } + > + {(triggerRef) => + viewedRoomId !== (activeCallRoomId ?? '') ? ( + + + {mx.getRoom(activeCallRoomId)?.normalizedName} + + + ) : ( + + {mx.getRoom(activeCallRoomId)?.normalizedName} + ) - )} - + } +