Skip to content

Commit ef383b0

Browse files
Fix Issue #160 : Make "Mark All as Read" disabled
if all notifications already read
1 parent 549f0a6 commit ef383b0

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

dist/dev/index.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/prod/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/NotificationsPopup/NotificationList.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export default class NotificationList extends React.Component {
7777
markAllNotificationAsRead, dismissChallengeNotifications } = this.props
7878
let completedSection = _.filter((notifications || []), t => t.eventType === eventTypes.PROJECT.COMPLETED)
7979
let nonCompletedSection = _.filter((notifications || []), t => t.eventType !== eventTypes.PROJECT.COMPLETED)
80+
const unreadCount = _.filter((notifications || []), t => t.isRead === false).length
8081
return (
8182
<>
8283
<div className={styles['noti-header']}>
@@ -100,8 +101,8 @@ export default class NotificationList extends React.Component {
100101
<div className={styles.rights}>
101102
<span
102103
role='button'
103-
className={styles['white-link']}
104-
onClick={() => markAllNotificationAsRead()}
104+
className={cn(styles['white-link'], unreadCount <= 0 && styles['disabled'])}
105+
onClick={unreadCount > 0 ? () => markAllNotificationAsRead() : null}
105106
>
106107
Mark All as Read
107108
</span>
@@ -116,9 +117,9 @@ export default class NotificationList extends React.Component {
116117
</div>
117118
<div className={styles['rights-mobile']}>
118119
<div
119-
className={styles['btn-tick']}
120+
className={cn(styles['btn-tick'], unreadCount <= 0 && styles['disabled'])}
120121
role='button'
121-
onClick={markAllNotificationAsRead}
122+
onClick={unreadCount > 0 ? markAllNotificationAsRead : null}
122123
>
123124
<TickIcon />
124125
</div>

src/components/NotificationsPopup/styles.module.scss

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
z-index: 100;
1717
cursor: default;
1818

19-
[role="button"] {
19+
[role="button"]:not(.disabled) {
2020
cursor: pointer;
2121
}
2222

@@ -90,6 +90,9 @@
9090
&:hover {
9191
opacity: 0.75;
9292
}
93+
&.disabled {
94+
opacity: 0.50;
95+
}
9396
}
9497

9598
.point {
@@ -508,10 +511,12 @@
508511
flex: 1;
509512
justify-content: flex-end;
510513
}
511-
512514
.btn-tick {
513515
margin: auto 0px;
514516
margin-right: 20px;
517+
&.disabled {
518+
opacity: 0.50;
519+
}
515520
}
516521
.btn-setting {
517522
margin: auto 0px;

0 commit comments

Comments
 (0)