From fa1a874f2bd365f93775be6c149016790dbcc29b Mon Sep 17 00:00:00 2001 From: David Langley Date: Fri, 30 Jan 2026 16:26:41 +0000 Subject: [PATCH] Migrate ModuleNotificationDecoration to use shared component --- .../ModuleNotificationDecoration.tsx | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/modules/components/ModuleNotificationDecoration.tsx b/src/modules/components/ModuleNotificationDecoration.tsx index 12852d0910..d4e1025bc5 100644 --- a/src/modules/components/ModuleNotificationDecoration.tsx +++ b/src/modules/components/ModuleNotificationDecoration.tsx @@ -5,11 +5,14 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com Please see LICENSE files in the repository root for full details. */ import React, { useMemo } from "react"; +import { CallType } from "matrix-js-sdk/src/webrtc/call"; +import { NotificationDecoration } from "@element-hq/web-shared-components"; import type { Room } from "matrix-js-sdk/src/matrix"; import { RoomNotificationStateStore } from "../../stores/notifications/RoomNotificationStateStore"; import { useCall } from "../../hooks/useCall"; -import { NotificationDecoration } from "../../components/views/rooms/NotificationDecoration"; +import { useTypedEventEmitterState } from "../../hooks/useEventEmitter"; +import { NotificationStateEvents } from "../../stores/notifications/NotificationState"; export interface ModuleNotificationDecorationProps { /** @@ -25,5 +28,23 @@ export interface ModuleNotificationDecorationProps { export const ModuleNotificationDecoration: React.FC = ({ room }) => { const notificationState = useMemo(() => RoomNotificationStateStore.instance.getRoomState(room), [room]); const call = useCall(room.roomId); - return ; + + // Subscribe to notification state changes + const notificationData = useTypedEventEmitterState(notificationState, NotificationStateEvents.Update, () => ({ + hasAnyNotificationOrActivity: notificationState.hasAnyNotificationOrActivity, + isUnsentMessage: notificationState.isUnsentMessage, + invited: notificationState.invited, + isMention: notificationState.isMention, + isActivityNotification: notificationState.isActivityNotification, + isNotification: notificationState.isNotification, + hasUnreadCount: notificationState.hasUnreadCount, + count: notificationState.count, + muted: notificationState.muted, + })); + + // Convert CallType enum to string + const callType = + call?.callType === CallType.Video ? "video" : call?.callType === CallType.Voice ? "voice" : undefined; + + return ; };