From 52a7a6efabdb9278ca5a5fdd372eabdaeea663d5 Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Wed, 16 Apr 2025 21:15:53 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=B8(frontend)=20add=20sound=20notifica?= =?UTF-8?q?tion=20for=20lobby?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a sound notification while a participant is waiting in the lobby. KISS, use the same notification as the one when participant join the room, thus, without any extra works, user can already toggle the notification in settings. In a v2, a dedicated notification could be added. Requested by a user. --- .../components/WaitingParticipantNotification.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/features/notifications/components/WaitingParticipantNotification.tsx b/src/frontend/src/features/notifications/components/WaitingParticipantNotification.tsx index e916645d..0e731d4e 100644 --- a/src/frontend/src/features/notifications/components/WaitingParticipantNotification.tsx +++ b/src/frontend/src/features/notifications/components/WaitingParticipantNotification.tsx @@ -10,10 +10,14 @@ import { usePrevious } from '@/hooks/usePrevious' import { WaitingParticipant } from '@/features/rooms/api/listWaitingParticipants' import { useWaitingParticipants } from '@/features/rooms/hooks/useWaitingParticipants' import { useSidePanel } from '@/features/rooms/livekit/hooks/useSidePanel' +import { useNotificationSound } from '../hooks/useSoundNotification' +import { NotificationType } from '@/features/notifications' export const NOTIFICATION_DISPLAY_DURATION = 10000 export const WaitingParticipantNotification = () => { + const { triggerNotificationSound } = useNotificationSound() + const { t } = useTranslation('notifications', { keyPrefix: 'waitingParticipants', }) @@ -37,6 +41,9 @@ export const WaitingParticipantNotification = () => { !isParticipantsOpen ) { setShowQuickActionsMessage(true) + + triggerNotificationSound(NotificationType.ParticipantJoined) + if (timerRef.current !== null) { clearTimeout(timerRef.current) } @@ -48,7 +55,12 @@ export const WaitingParticipantNotification = () => { // Hide notification when the participant count changes setShowQuickActionsMessage(false) } - }, [waitingParticipants, prevWaitingParticipant, isParticipantsOpen]) + }, [ + waitingParticipants, + prevWaitingParticipant, + isParticipantsOpen, + triggerNotificationSound, + ]) useEffect(() => { // This cleanup function will only run when the component unmounts