diff --git a/client/src/javascript/components/sidebar/NotificationsButton.tsx b/client/src/javascript/components/sidebar/NotificationsButton.tsx index 4cc17ab9..0abe26c5 100644 --- a/client/src/javascript/components/sidebar/NotificationsButton.tsx +++ b/client/src/javascript/components/sidebar/NotificationsButton.tsx @@ -264,15 +264,13 @@ class NotificationsButton extends Component - {hasNotifications ? {notificationCount.total} : null} + {hasNotification ? {notificationCount.total} : null} ); } diff --git a/client/src/javascript/stores/NotificationStore.ts b/client/src/javascript/stores/NotificationStore.ts index dde67247..a480e046 100644 --- a/client/src/javascript/stores/NotificationStore.ts +++ b/client/src/javascript/stores/NotificationStore.ts @@ -1,4 +1,4 @@ -import {makeAutoObservable} from 'mobx'; +import {computed, makeAutoObservable} from 'mobx'; import type {Notification, NotificationCount, NotificationState} from '@shared/types/Notification'; @@ -8,6 +8,10 @@ class NotificationStore { notifications: Array = []; notificationCount: NotificationCount = INITIAL_COUNT_STATE; + @computed get hasNotification() { + return this.notificationCount.total !== 0; + } + constructor() { makeAutoObservable(this); }