Skip to content

Commit

Permalink
UI-finished implementation to hide success notification (#94)
Browse files Browse the repository at this point in the history
finished implementation to hide success notification

Co-authored-by: Ubuntu <[email protected]>
  • Loading branch information
Boyuan-Deng and Ubuntu authored Jun 23, 2022
1 parent 52dfede commit da90798
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/ui/common/src/components/layouts/menuSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { useLocation } from 'react-router-dom';
import { handleFetchNotifications } from '../../reducers/notifications';
import { AppDispatch, RootState } from '../../stores/store';
import UserProfile from '../../utils/auth';
import { NotificationStatus } from '../../utils/notifications';
import { NotificationStatus, NotificationLogLevel } from '../../utils/notifications';
import NotificationsPopover from '../notifications/NotificationsPopover';
import styles from './menu-sidebar-styles.module.css';

Expand Down Expand Up @@ -115,7 +115,8 @@ const MenuSidebar: React.FC<{ user: UserProfile }> = ({ user }) => {
const numUnreadNotifications = useSelector(
(state: RootState) =>
state.notificationsReducer.notifications.filter(
(notification) => notification.status === NotificationStatus.Unread
(notification) => notification.level !== NotificationLogLevel.Success &&
notification.status === NotificationStatus.Unread
).length
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useDispatch, useSelector } from 'react-redux';
import { handleArchiveAllNotifications } from '../../reducers/notifications';
import { AppDispatch, RootState } from '../../stores/store';
import UserProfile from '../../utils/auth';
import { NotificationAssociation } from '../../utils/notifications';
import { NotificationAssociation, NotificationLogLevel} from '../../utils/notifications';
import { Notification } from '../../utils/notifications';
import { Tab, Tabs } from '../primitives/Tabs.styles';
import NotificationListItem from './NotificationListItem';
Expand Down Expand Up @@ -53,6 +53,9 @@ export const NotificationsPopover: React.FC<NotificationsPopoverProps> = ({

const filteredNotifications: Notification[] = notifications
.filter((notification: Notification) => {
if (notification.level === NotificationLogLevel.Success) {
return false
}
const association = notification.association.object;
if (activeTab === NotificationsTabs.All) {
return true;
Expand Down

0 comments on commit da90798

Please sign in to comment.