From 19804d2e3f94bf45147734ad70a08d632a448db7 Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Wed, 12 Feb 2025 10:38:43 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8(frontend)=20add=20sound=20notificatio?= =?UTF-8?q?n=20for=20unread=20messages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add togglable audio alerts when new chat messages arrive, allowing users to customize their notification preferences. --- .../src/features/notifications/MainNotificationToast.tsx | 3 ++- src/frontend/src/stores/notifications.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/features/notifications/MainNotificationToast.tsx b/src/frontend/src/features/notifications/MainNotificationToast.tsx index 88b01337..4bddf3c3 100644 --- a/src/frontend/src/features/notifications/MainNotificationToast.tsx +++ b/src/frontend/src/features/notifications/MainNotificationToast.tsx @@ -30,6 +30,7 @@ export const MainNotificationToast = () => { participant?: Participant | undefined ) => { if (!participant || participant.isLocal) return + triggerNotificationSound(NotificationType.MessageReceived) toastQueue.add( { participant: participant, @@ -43,7 +44,7 @@ export const MainNotificationToast = () => { return () => { room.off(RoomEvent.ChatMessage, handleChatMessage) } - }, [room]) + }, [room, triggerNotificationSound]) useEffect(() => { const handleDataReceived = ( diff --git a/src/frontend/src/stores/notifications.ts b/src/frontend/src/stores/notifications.ts index a717d01e..4416d004 100644 --- a/src/frontend/src/stores/notifications.ts +++ b/src/frontend/src/stores/notifications.ts @@ -14,6 +14,7 @@ const DEFAULT_STATE: State = { new Map([ [NotificationType.ParticipantJoined, true], [NotificationType.HandRaised, true], + [NotificationType.MessageReceived, true], ]) ), soundNotificationVolume: 0.1,