import React, { useEffect } from 'react'; import { Button, NoContent } from 'UI'; import { connect } from 'react-redux'; import { fetchList, setViewed, clearAll } from 'Duck/notifications'; 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 { setLastRead: Function; clearingAll: boolean; loading: boolean; clearing: boolean; list: any; clearAll: Function; setViewed: Function; } function AlertTriggersModal(props: Props) { const { loading, clearingAll, clearing } = props; const { notificationStore } = useStore(); const count = useObserver(() => notificationStore.notificationsCount); const list = useObserver(() => notificationStore.notifications); const onClearAll = () => { const { list } = props; const firstItem = list.first(); props.clearAll({ endTimestamp: firstItem.createdAt.ts }); } const onClear = (notification: any) => { props.setViewed(notification.notificationId) } useEffect(() => { notificationStore.fetchNotifications(); }, []) return (