File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /*
2+ Copyright 2025 Element Creations Ltd.
3+
4+ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
5+ Please see LICENSE files in the repository root for full details.
6+ */
7+ import React , { useMemo } from "react" ;
8+
9+ import type { Room } from "matrix-js-sdk/src/matrix" ;
10+ import { RoomNotificationStateStore } from "../../stores/notifications/RoomNotificationStateStore" ;
11+ import { useCall } from "../../hooks/useCall" ;
12+ import { NotificationDecoration } from "../../components/views/rooms/NotificationDecoration" ;
13+
14+ export interface ModuleNotificationDecorationProps {
15+ /**
16+ * The room for which the decoration is rendered.
17+ */
18+ room : Room ;
19+ }
20+
21+ /**
22+ * React component that takes a room as prop and renders {@link NotificationDecoration} with it.
23+ * Used by the module API to render notification decoration without having to expose a bunch of stores.
24+ */
25+ export const ModuleNotificationDecoration : React . FC < ModuleNotificationDecorationProps > = ( { room } ) => {
26+ const notificationState = useMemo ( ( ) => RoomNotificationStateStore . instance . getRoomState ( room ) , [ room ] ) ;
27+ const call = useCall ( room . roomId ) ;
28+ return < NotificationDecoration notificationState = { notificationState } callType = { call ?. callType } /> ;
29+ } ;
You can’t perform that action at this time.
0 commit comments