{
- toggleNotificationsDropdownMobile()
- visitNotifications()
- }}
- isOpen={isDropdownMobileOpen}
- >
- {!hasUnread ? (
- notificationsEmpty
- ) : (
-
- {globalSource && (globalSource.notifications.length || isViewAll && globalSource.total) &&
- viewOlderNotifications(globalSource.id) : null}
- onLinkClick={(notificationId) => {
- toggleNotificationsDropdownMobile()
- markNotificationSeen(notificationId)
- }}
- />}
- {projectSources.filter(source => source.notifications.length || isViewAll && source.total).map(source => (
- viewOlderNotifications(source.id) : null}
- onLinkClick={(notificationId) => {
- toggleNotificationsDropdownMobile()
- markNotificationSeen(notificationId)
- }}
- />
- ))}
- {!isViewAll && (olderNotificationsCount > 0 || hiddenByLimitCount > 0) &&
- Read all notifications}
-
- )}
-
- ))}
+ {(matches) => {
+ if (matches) {
+ const notificationsBySources = limitQuantityInSources(
+ allNotificationsBySources,
+ NOTIFICATIONS_DROPDOWN_PER_SOURCE,
+ oldSourceIds
+ )
+ const hiddenByLimitCount = _.sumBy(notificationsBySources, 'total') - _.sumBy(notificationsBySources, 'notifications.length')
+ const globalSource = notificationsBySources.length > 0 && notificationsBySources[0].id === 'global' ? notificationsBySources[0] : null
+ const projectSources = notificationsBySources.length > 1 && globalSource ? notificationsBySources.slice(1) : notificationsBySources
+
+ return (
+