aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+my-account/my-account-notifications/my-account-notifications.component.ts
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-07-23 21:30:04 +0200
committerRigel Kent <par@rigelk.eu>2020-07-29 18:15:53 +0200
commit4f5d045960b042eb27e10bac1bdaf1c074c9fa2a (patch)
tree09e1e8cce0a2e64146ede51941cfa2f1bdcf3c2f /client/src/app/+my-account/my-account-notifications/my-account-notifications.component.ts
parentbc99dfe54e093e69ba8fd06d36b36fbbda3f45de (diff)
downloadPeerTube-4f5d045960b042eb27e10bac1bdaf1c074c9fa2a.tar.gz
PeerTube-4f5d045960b042eb27e10bac1bdaf1c074c9fa2a.tar.zst
PeerTube-4f5d045960b042eb27e10bac1bdaf1c074c9fa2a.zip
harmonize search for libraries
Diffstat (limited to 'client/src/app/+my-account/my-account-notifications/my-account-notifications.component.ts')
-rw-r--r--client/src/app/+my-account/my-account-notifications/my-account-notifications.component.ts18
1 files changed, 17 insertions, 1 deletions
diff --git a/client/src/app/+my-account/my-account-notifications/my-account-notifications.component.ts b/client/src/app/+my-account/my-account-notifications/my-account-notifications.component.ts
index 8a51319fe..0ec67d401 100644
--- a/client/src/app/+my-account/my-account-notifications/my-account-notifications.component.ts
+++ b/client/src/app/+my-account/my-account-notifications/my-account-notifications.component.ts
@@ -1,6 +1,8 @@
1import { Component, ViewChild } from '@angular/core' 1import { Component, ViewChild } from '@angular/core'
2import { UserNotificationsComponent } from '@app/shared/shared-main' 2import { UserNotificationsComponent } from '@app/shared/shared-main'
3 3
4type NotificationSortType = 'createdAt' | 'read'
5
4@Component({ 6@Component({
5 templateUrl: './my-account-notifications.component.html', 7 templateUrl: './my-account-notifications.component.html',
6 styleUrls: [ './my-account-notifications.component.scss' ] 8 styleUrls: [ './my-account-notifications.component.scss' ]
@@ -8,7 +10,17 @@ import { UserNotificationsComponent } from '@app/shared/shared-main'
8export class MyAccountNotificationsComponent { 10export class MyAccountNotificationsComponent {
9 @ViewChild('userNotification', { static: true }) userNotification: UserNotificationsComponent 11 @ViewChild('userNotification', { static: true }) userNotification: UserNotificationsComponent
10 12
11 notificationSortType = 'created' 13 _notificationSortType: NotificationSortType = 'createdAt'
14
15 get notificationSortType () {
16 return !this.hasUnreadNotifications()
17 ? 'createdAt'
18 : this._notificationSortType
19 }
20
21 set notificationSortType (type: NotificationSortType) {
22 this._notificationSortType = type
23 }
12 24
13 markAllAsRead () { 25 markAllAsRead () {
14 this.userNotification.markAllAsRead() 26 this.userNotification.markAllAsRead()
@@ -17,4 +29,8 @@ export class MyAccountNotificationsComponent {
17 hasUnreadNotifications () { 29 hasUnreadNotifications () {
18 return this.userNotification.notifications.filter(n => n.read === false).length !== 0 30 return this.userNotification.notifications.filter(n => n.read === false).length !== 0
19 } 31 }
32
33 onChangeSortColumn () {
34 this.userNotification.changeSortColumn(this.notificationSortType)
35 }
20} 36}