diff --git a/src/stores/notification.js b/src/stores/notification.js index 90743997..b50c1bb2 100644 --- a/src/stores/notification.js +++ b/src/stores/notification.js @@ -124,6 +124,16 @@ export const useNotificationStore = defineStore('Notification', () => { (n) => getNotificationCategory(n.type) === 'other' ) ); + const unseenSet = computed(() => new Set(unseenNotifications.value)); + const unseenFriendNotifications = computed(() => + friendNotifications.value.filter((n) => unseenSet.value.has(n.id)) + ); + const unseenGroupNotifications = computed(() => + groupNotifications.value.filter((n) => unseenSet.value.has(n.id)) + ); + const unseenOtherNotifications = computed(() => + otherNotifications.value.filter((n) => unseenSet.value.has(n.id)) + ); const hasUnseenNotifications = computed( () => unseenNotifications.value.length > 0 ); @@ -2703,6 +2713,9 @@ export const useNotificationStore = defineStore('Notification', () => { friendNotifications, groupNotifications, otherNotifications, + unseenFriendNotifications, + unseenGroupNotifications, + unseenOtherNotifications, hasUnseenNotifications, getNotificationCategory, isNotificationExpired, diff --git a/src/views/Sidebar/components/NotificationCenterSheet.vue b/src/views/Sidebar/components/NotificationCenterSheet.vue index 1000bdb4..f529daa1 100644 --- a/src/views/Sidebar/components/NotificationCenterSheet.vue +++ b/src/views/Sidebar/components/NotificationCenterSheet.vue @@ -10,43 +10,40 @@ {{ t('side_panel.notification_center.tab_friend') }} - - ({{ activeCount.friend }}) + + ({{ unseenFriendNotifications.length }}) {{ t('side_panel.notification_center.tab_group') }} - - ({{ activeCount.group }}) + + ({{ unseenGroupNotifications.length }}) {{ t('side_panel.notification_center.tab_other') }} - - ({{ activeCount.other }}) + + ({{ unseenOtherNotifications.length }}) @@ -65,7 +62,7 @@