diff options
author | Chocobozzz <me@florianbigard.com> | 2019-08-02 14:49:25 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-08-02 14:49:25 +0200 |
commit | ad453580b20056fd80b3245d4db554f5ca1a5e29 (patch) | |
tree | ed07a6dbd8bc8cd27b22cd33dabcbd3d31deea07 /client/src/app/shared/users | |
parent | dd570a34ff731a6cd98ef8f8bf83f234e804f6c1 (diff) | |
download | PeerTube-ad453580b20056fd80b3245d4db554f5ca1a5e29.tar.gz PeerTube-ad453580b20056fd80b3245d4db554f5ca1a5e29.tar.zst PeerTube-ad453580b20056fd80b3245d4db554f5ca1a5e29.zip |
Fix infinite scroll on big screens
Diffstat (limited to 'client/src/app/shared/users')
-rw-r--r-- | client/src/app/shared/users/user-notifications.component.html | 2 | ||||
-rw-r--r-- | client/src/app/shared/users/user-notifications.component.ts | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/client/src/app/shared/users/user-notifications.component.html b/client/src/app/shared/users/user-notifications.component.html index d0d9d9f35..292813426 100644 --- a/client/src/app/shared/users/user-notifications.component.html +++ b/client/src/app/shared/users/user-notifications.component.html | |||
@@ -1,6 +1,6 @@ | |||
1 | <div *ngIf="componentPagination.totalItems === 0" class="no-notification" i18n>You don't have notifications.</div> | 1 | <div *ngIf="componentPagination.totalItems === 0" class="no-notification" i18n>You don't have notifications.</div> |
2 | 2 | ||
3 | <div class="notifications" myInfiniteScroller [autoInit]="true" (nearOfBottom)="onNearOfBottom()"> | 3 | <div class="notifications" myInfiniteScroller [autoInit]="true" (nearOfBottom)="onNearOfBottom()" [dataObservable]="onDataSubject.asObservable()"> |
4 | <div *ngFor="let notification of notifications" class="notification" [ngClass]="{ unread: !notification.read }" (click)="markAsRead(notification)"> | 4 | <div *ngFor="let notification of notifications" class="notification" [ngClass]="{ unread: !notification.read }" (click)="markAsRead(notification)"> |
5 | 5 | ||
6 | <ng-container [ngSwitch]="notification.type"> | 6 | <ng-container [ngSwitch]="notification.type"> |
diff --git a/client/src/app/shared/users/user-notifications.component.ts b/client/src/app/shared/users/user-notifications.component.ts index ce43b604a..3c9eb369d 100644 --- a/client/src/app/shared/users/user-notifications.component.ts +++ b/client/src/app/shared/users/user-notifications.component.ts | |||
@@ -4,6 +4,7 @@ import { UserNotificationType } from '../../../../../shared' | |||
4 | import { ComponentPagination, hasMoreItems } from '@app/shared/rest/component-pagination.model' | 4 | import { ComponentPagination, hasMoreItems } from '@app/shared/rest/component-pagination.model' |
5 | import { Notifier } from '@app/core' | 5 | import { Notifier } from '@app/core' |
6 | import { UserNotification } from '@app/shared/users/user-notification.model' | 6 | import { UserNotification } from '@app/shared/users/user-notification.model' |
7 | import { Subject } from 'rxjs' | ||
7 | 8 | ||
8 | @Component({ | 9 | @Component({ |
9 | selector: 'my-user-notifications', | 10 | selector: 'my-user-notifications', |
@@ -24,6 +25,8 @@ export class UserNotificationsComponent implements OnInit { | |||
24 | 25 | ||
25 | componentPagination: ComponentPagination | 26 | componentPagination: ComponentPagination |
26 | 27 | ||
28 | onDataSubject = new Subject<any[]>() | ||
29 | |||
27 | constructor ( | 30 | constructor ( |
28 | private userNotificationService: UserNotificationService, | 31 | private userNotificationService: UserNotificationService, |
29 | private notifier: Notifier | 32 | private notifier: Notifier |
@@ -47,6 +50,8 @@ export class UserNotificationsComponent implements OnInit { | |||
47 | this.componentPagination.totalItems = result.total | 50 | this.componentPagination.totalItems = result.total |
48 | 51 | ||
49 | this.notificationsLoaded.emit() | 52 | this.notificationsLoaded.emit() |
53 | |||
54 | this.onDataSubject.next(result.data) | ||
50 | }, | 55 | }, |
51 | 56 | ||
52 | err => this.notifier.error(err.message) | 57 | err => this.notifier.error(err.message) |