File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4949 </ main >
5050 </ div >
5151
52- < aside mdcDrawerContainer ="temporary " class ="right " [(open)] ="openNotifications ">
52+ < aside mdcDrawerContainer ="temporary " class ="right " [(open)] ="openNotifications " (openChange) =" onOpenNotificationsChange($event) " >
5353 < nav mdcDrawer >
5454 < div mdcDrawerToolbarSpacer > </ div >
5555 < div mdcDrawerHeader >
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ export class LayoutComponent implements OnInit {
1313
1414 openMenu : boolean = false ;
1515 openNotifications : boolean = false ;
16+ private wasNotificationsOpened : boolean = false ;
1617 @Input ( ) view : View = null ;
1718 @Input ( ) isLoading : boolean = false ;
1819 @Output ( ) private isLoadingChange : EventEmitter < boolean > = new EventEmitter ( ) ;
@@ -41,13 +42,13 @@ export class LayoutComponent implements OnInit {
4142
4243 toggleNotifications ( ) {
4344 this . openNotifications = ! this . openNotifications ;
44- if ( this . openNotifications ) {
45- this . notifications . markAllAsRead ( ) ;
46- }
45+ this . wasNotificationsOpened = this . openNotifications ;
4746 }
4847
49- closeNotifications ( ) {
50- this . openNotifications = false ;
48+ onOpenNotificationsChange ( open : boolean ) {
49+ if ( ! open && this . wasNotificationsOpened ) {
50+ this . notifications . markAllAsRead ( ) ;
51+ }
5152 }
5253
5354 onSearchTap ( ) {
Original file line number Diff line number Diff line change 22< ng-container *ngIf ="notifications.get().length > 0; else noNotificationsTpl ">
33 < div mdcListGroup >
44 < nav mdcList *ngFor ="let notification of notifications.get() ">
5- < a mdcListItem >
5+ < a mdcListItem [class.unread] =" notification.status === notificationStatus.Unread " >
66 < ng-container
77 [ngTemplateOutlet] ="notificationIconTpl "
88 [ngTemplateOutletContext] ="{ $implicit: notification } "
Original file line number Diff line number Diff line change 1212 color : $green-color ;
1313}
1414
15+ .unread {
16+ background-color : #ECF8FE ;
17+ }
18+
1519.no-notifications-container {
1620 display : flex ;
1721 width : 100% ;
Original file line number Diff line number Diff line change 11import { Component , OnInit } from '@angular/core' ;
2- import { Notification , NotificationType } from 'src/app/models/notification' ;
2+ import { NotificationType , NotificationStatus } from 'src/app/models/notification' ;
33import { NotificationsService } from 'src/app/services/notifications.service' ;
44
55@Component ( {
@@ -10,6 +10,7 @@ import { NotificationsService } from 'src/app/services/notifications.service';
1010export class NotificationsComponent implements OnInit {
1111
1212 notificationTypes : typeof NotificationType = NotificationType ;
13+ notificationStatus : typeof NotificationStatus = NotificationStatus ;
1314
1415 constructor ( public notifications : NotificationsService ) { }
1516
You can’t perform that action at this time.
0 commit comments