diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-07-23 21:30:04 +0200 |
---|---|---|
committer | Rigel Kent <par@rigelk.eu> | 2020-07-29 18:15:53 +0200 |
commit | 4f5d045960b042eb27e10bac1bdaf1c074c9fa2a (patch) | |
tree | 09e1e8cce0a2e64146ede51941cfa2f1bdcf3c2f /client/src/app/+my-account/my-account-notifications/my-account-notifications.component.ts | |
parent | bc99dfe54e093e69ba8fd06d36b36fbbda3f45de (diff) | |
download | PeerTube-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.ts | 18 |
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 @@ | |||
1 | import { Component, ViewChild } from '@angular/core' | 1 | import { Component, ViewChild } from '@angular/core' |
2 | import { UserNotificationsComponent } from '@app/shared/shared-main' | 2 | import { UserNotificationsComponent } from '@app/shared/shared-main' |
3 | 3 | ||
4 | type 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' | |||
8 | export class MyAccountNotificationsComponent { | 10 | export 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 | } |