- { unReadNotificationsCount }
+ return useObserver(() => (
+
+ showModal(
, { right: true }) }>
+
+ { count }
-
- );
+
+ ));
}
export default connect((state: any) => ({
diff --git a/frontend/app/components/shared/AlertTriggersModal/AlertTriggersModal.tsx b/frontend/app/components/shared/AlertTriggersModal/AlertTriggersModal.tsx
index 5547ae750..e36d03ab1 100644
--- a/frontend/app/components/shared/AlertTriggersModal/AlertTriggersModal.tsx
+++ b/frontend/app/components/shared/AlertTriggersModal/AlertTriggersModal.tsx
@@ -1,4 +1,4 @@
-import React from 'react';
+import React, { useEffect } from 'react';
import { Button, NoContent } from 'UI';
import { connect } from 'react-redux';
import { fetchList, setViewed, clearAll } from 'Duck/notifications';
@@ -6,9 +6,10 @@ import { setLastRead } from 'Duck/announcements';
import cn from 'classnames';
import AnimatedSVG, { ICONS } from 'Shared/AnimatedSVG/AnimatedSVG';
import ListItem from './ListItem'
+import { useStore } from 'App/mstore';
+import { useObserver } from 'mobx-react-lite';
interface Props {
- unReadNotificationsCount: number;
setLastRead: Function;
clearingAll: boolean;
@@ -20,7 +21,10 @@ interface Props {
setViewed: Function;
}
function AlertTriggersModal(props: Props) {
- const { list, unReadNotificationsCount, loading, clearingAll, clearing } = props;
+ const { loading, clearingAll, clearing } = props;
+ const { notificationStore } = useStore();
+ const count = useObserver(() => notificationStore.notificationsCount);
+ const list = useObserver(() => notificationStore.notifications);
const onClearAll = () => {
const { list } = props;
@@ -29,21 +33,24 @@ function AlertTriggersModal(props: Props) {
}
const onClear = (notification: any) => {
- console.log('onClear', notification);
props.setViewed(notification.notificationId)
}
+ useEffect(() => {
+ notificationStore.fetchNotifications();
+ }, [])
+
return (
Alerts
- { unReadNotificationsCount > 0 && (
+ { count > 0 && (