diff --git a/res/css/structures/_ThreadsActivityCentre.pcss b/res/css/structures/_ThreadsActivityCentre.pcss
index 62fd00a42f3..9a8ab28bf62 100644
--- a/res/css/structures/_ThreadsActivityCentre.pcss
+++ b/res/css/structures/_ThreadsActivityCentre.pcss
@@ -66,18 +66,3 @@
}
}
}
-
-.mx_ThreadsActivityCentreBadge {
- background-color: $primary-content;
- width: 8px;
- height: 8px;
- border-radius: 8px;
-
- &.mx_ThreadsActivityCentreBadge_highlight {
- background-color: $alert;
- }
-
- &.mx_ThreadsActivityCentreBadge_normal {
- background-color: var(--cpd-color-icon-accent-tertiary);
- }
-}
diff --git a/src/components/views/spaces/threads-activity-centre/ThreadsActivityCentre.tsx b/src/components/views/spaces/threads-activity-centre/ThreadsActivityCentre.tsx
index 98014e5fdc9..715bf9e6c6b 100644
--- a/src/components/views/spaces/threads-activity-centre/ThreadsActivityCentre.tsx
+++ b/src/components/views/spaces/threads-activity-centre/ThreadsActivityCentre.tsx
@@ -26,10 +26,11 @@ import DecoratedRoomAvatar from "../../avatars/DecoratedRoomAvatar";
import { Action } from "../../../../dispatcher/actions";
import defaultDispatcher from "../../../../dispatcher/dispatcher";
import { ViewRoomPayload } from "../../../../dispatcher/payloads/ViewRoomPayload";
-import { ThreadsActivityCentreBadge, ThreadsActivityNotificationState } from "./ThreadsActivityCentreBadge";
import RightPanelStore from "../../../../stores/right-panel/RightPanelStore";
import { RightPanelPhases } from "../../../../stores/right-panel/RightPanelStorePhases";
import { useUnreadThreadRooms } from "./useUnreadThreadRooms";
+import { StatelessNotificationBadge } from "../../rooms/NotificationBadge/StatelessNotificationBadge";
+import { NotificationLevel } from "../../../../stores/notifications/NotificationLevel";
interface ThreadsActivityCentreProps {
/**
@@ -57,11 +58,11 @@ export function ThreadsActivityCentre({ displayButtonLabel }: ThreadsActivityCen
>
{/* Make the content of the pop-up scrollable */}
- {roomsAndNotifications.map(({ room, notificationState }) => (
+ {roomsAndNotifications.map(({ room, notificationLevel }) => (
setOpen(false)}
/>
))}
@@ -78,7 +79,7 @@ interface ThreadsActivityRow {
/**
* The state of the badge.
*/
- notificationState: ThreadsActivityNotificationState;
+ notificationLevel: NotificationLevel;
/**
* Callback when the user clicks on the row.
*/
@@ -88,7 +89,7 @@ interface ThreadsActivityRow {
/**
* Display a room with unread threads.
*/
-function ThreadsActivityRow({ room, onClick, notificationState }: ThreadsActivityRow): JSX.Element {
+function ThreadsActivityRow({ room, onClick, notificationLevel }: ThreadsActivityRow): JSX.Element {
return (
}
>
-
+
);
}
diff --git a/src/components/views/spaces/threads-activity-centre/ThreadsActivityCentreBadge.tsx b/src/components/views/spaces/threads-activity-centre/ThreadsActivityCentreBadge.tsx
deleted file mode 100644
index e616b8993a1..00000000000
--- a/src/components/views/spaces/threads-activity-centre/ThreadsActivityCentreBadge.tsx
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *
- * Copyright 2024 The Matrix.org Foundation C.I.C.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * /
- */
-
-import React, { JSX } from "react";
-import classNames from "classnames";
-
-export type ThreadsActivityNotificationState = "minor" | "normal" | "highlight";
-
-interface ThreadsActivityCentreBadgeProps {
- /**
- * The state of the badge.
- */
- state: ThreadsActivityNotificationState;
-}
-
-/**
- * A badge to show the unread state of the room in the ThreadsActivityCentre.
- */
-export function ThreadsActivityCentreBadge({ state }: ThreadsActivityCentreBadgeProps): JSX.Element {
- const className = classNames("mx_ThreadsActivityCentreBadge", {
- mx_ThreadsActivityCentreBadge_highlight: state === "highlight",
- mx_ThreadsActivityCentreBadge_normal: state === "normal",
- });
-
- return ;
-}
diff --git a/src/components/views/spaces/threads-activity-centre/useUnreadThreadRooms.ts b/src/components/views/spaces/threads-activity-centre/useUnreadThreadRooms.ts
index 4edaa5719a7..4869af12f5d 100644
--- a/src/components/views/spaces/threads-activity-centre/useUnreadThreadRooms.ts
+++ b/src/components/views/spaces/threads-activity-centre/useUnreadThreadRooms.ts
@@ -19,17 +19,15 @@
import { useMemo } from "react";
import { NotificationCountType, Room } from "matrix-js-sdk/src/matrix";
-import { ThreadsActivityNotificationState } from "./ThreadsActivityCentreBadge";
import RoomListStore from "../../../../stores/room-list/RoomListStore";
import { doesRoomHaveUnreadThreads } from "../../../../Unread";
+import { NotificationLevel } from "../../../../stores/notifications/NotificationLevel";
/**
* TODO doc
* @param open
*/
-export function useUnreadThreadRooms(
- open: boolean,
-): Array<{ room: Room; notificationState: ThreadsActivityNotificationState }> {
+export function useUnreadThreadRooms(open: boolean): Array<{ room: Room; notificationLevel: NotificationLevel }> {
return useMemo(() => {
if (!open) return [];
@@ -39,7 +37,7 @@ export function useUnreadThreadRooms(
return acc;
}, [])
.filter((room) => doesRoomHaveUnreadThreads(room))
- .map((room) => ({ room, notificationState: getNotificationState(room) }));
+ .map((room) => ({ room, notificationLevel: getNotificationState(room) }));
}, [open]);
}
@@ -47,14 +45,14 @@ export function useUnreadThreadRooms(
* TODO doc
* @param room
*/
-function getNotificationState(room: Room): ThreadsActivityNotificationState {
+function getNotificationState(room: Room): NotificationLevel {
const notificationCountType = room.threadsAggregateNotificationType;
switch (notificationCountType) {
case NotificationCountType.Highlight:
- return "highlight";
+ return NotificationLevel.Highlight;
case NotificationCountType.Total:
- return "normal";
+ return NotificationLevel.Notification;
default:
- return "minor";
+ return NotificationLevel.Activity;
}
}