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/+my-account/my-account-video-playlists | |
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/+my-account/my-account-video-playlists')
5 files changed, 18 insertions, 7 deletions
diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.html b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.html index 4de4e69da..a3de3da4a 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.html +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.html | |||
@@ -12,7 +12,7 @@ | |||
12 | 12 | ||
13 | <div | 13 | <div |
14 | class="videos" myInfiniteScroller [autoInit]="true" (nearOfBottom)="onNearOfBottom()" | 14 | class="videos" myInfiniteScroller [autoInit]="true" (nearOfBottom)="onNearOfBottom()" |
15 | cdkDropList (cdkDropListDropped)="drop($event)" | 15 | cdkDropList (cdkDropListDropped)="drop($event)" [dataObservable]="onDataSubject.asObservable()" |
16 | > | 16 | > |
17 | <div class="video" *ngFor="let playlistElement of playlistElements; trackBy: trackByFn" cdkDrag> | 17 | <div class="video" *ngFor="let playlistElement of playlistElements; trackBy: trackByFn" cdkDrag> |
18 | <my-video-playlist-element-miniature | 18 | <my-video-playlist-element-miniature |
diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.scss b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.scss index 900669827..9657ac11d 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.scss +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.scss | |||
@@ -7,7 +7,7 @@ | |||
7 | margin-left: -15px; | 7 | margin-left: -15px; |
8 | margin-top: -$sub-menu-margin-bottom; | 8 | margin-top: -$sub-menu-margin-bottom; |
9 | 9 | ||
10 | padding: $sub-menu-margin-bottom 0; | 10 | padding: $sub-menu-margin-bottom 0 -15px 0; |
11 | 11 | ||
12 | display: flex; | 12 | display: flex; |
13 | justify-content: center; | 13 | justify-content: center; |
diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.ts b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.ts index 6f307a058..22c9af566 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.ts +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.ts | |||
@@ -3,7 +3,7 @@ import { Notifier, ServerService } from '@app/core' | |||
3 | import { AuthService } from '../../core/auth' | 3 | import { AuthService } from '../../core/auth' |
4 | import { ConfirmService } from '../../core/confirm' | 4 | import { ConfirmService } from '../../core/confirm' |
5 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' | 5 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' |
6 | import { Subscription } from 'rxjs' | 6 | import { Subject, Subscription } from 'rxjs' |
7 | import { ActivatedRoute } from '@angular/router' | 7 | import { ActivatedRoute } from '@angular/router' |
8 | import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' | 8 | import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' |
9 | import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' | 9 | import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' |
@@ -22,10 +22,12 @@ export class MyAccountVideoPlaylistElementsComponent implements OnInit, OnDestro | |||
22 | 22 | ||
23 | pagination: ComponentPagination = { | 23 | pagination: ComponentPagination = { |
24 | currentPage: 1, | 24 | currentPage: 1, |
25 | itemsPerPage: 30, | 25 | itemsPerPage: 10, |
26 | totalItems: null | 26 | totalItems: null |
27 | } | 27 | } |
28 | 28 | ||
29 | onDataSubject = new Subject<any[]>() | ||
30 | |||
29 | private videoPlaylistId: string | number | 31 | private videoPlaylistId: string | number |
30 | private paramsSub: Subscription | 32 | private paramsSub: Subscription |
31 | 33 | ||
@@ -102,6 +104,8 @@ export class MyAccountVideoPlaylistElementsComponent implements OnInit, OnDestro | |||
102 | .subscribe(({ total, data }) => { | 104 | .subscribe(({ total, data }) => { |
103 | this.playlistElements = this.playlistElements.concat(data) | 105 | this.playlistElements = this.playlistElements.concat(data) |
104 | this.pagination.totalItems = total | 106 | this.pagination.totalItems = total |
107 | |||
108 | this.onDataSubject.next(data) | ||
105 | }) | 109 | }) |
106 | } | 110 | } |
107 | 111 | ||
diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.html b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.html index 322560673..307884c70 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.html +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.html | |||
@@ -5,7 +5,7 @@ | |||
5 | </a> | 5 | </a> |
6 | </div> | 6 | </div> |
7 | 7 | ||
8 | <div class="video-playlists" myInfiniteScroller (nearOfBottom)="onNearOfBottom()"> | 8 | <div class="video-playlists" myInfiniteScroller [autoInit]="true" (nearOfBottom)="onNearOfBottom()" [dataObservable]="onDataSubject.asObservable()"> |
9 | <div *ngFor="let playlist of videoPlaylists" class="video-playlist"> | 9 | <div *ngFor="let playlist of videoPlaylists" class="video-playlist"> |
10 | <div class="miniature-wrapper"> | 10 | <div class="miniature-wrapper"> |
11 | <my-video-playlist-miniature [playlist]="playlist" [toManage]="true" [displayChannel]="true" [displayDescription]="true" [displayPrivacy]="true" | 11 | <my-video-playlist-miniature [playlist]="playlist" [toManage]="true" [displayChannel]="true" [displayDescription]="true" [displayPrivacy]="true" |
diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts index e30656b92..0c4e4b0d6 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts | |||
@@ -9,6 +9,7 @@ import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' | |||
9 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' | 9 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' |
10 | import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' | 10 | import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' |
11 | import { VideoPlaylistType } from '@shared/models' | 11 | import { VideoPlaylistType } from '@shared/models' |
12 | import { Subject } from 'rxjs' | ||
12 | 13 | ||
13 | @Component({ | 14 | @Component({ |
14 | selector: 'my-account-video-playlists', | 15 | selector: 'my-account-video-playlists', |
@@ -20,10 +21,12 @@ export class MyAccountVideoPlaylistsComponent implements OnInit { | |||
20 | 21 | ||
21 | pagination: ComponentPagination = { | 22 | pagination: ComponentPagination = { |
22 | currentPage: 1, | 23 | currentPage: 1, |
23 | itemsPerPage: 10, | 24 | itemsPerPage: 5, |
24 | totalItems: null | 25 | totalItems: null |
25 | } | 26 | } |
26 | 27 | ||
28 | onDataSubject = new Subject<any[]>() | ||
29 | |||
27 | private user: User | 30 | private user: User |
28 | 31 | ||
29 | constructor ( | 32 | constructor ( |
@@ -78,11 +81,15 @@ export class MyAccountVideoPlaylistsComponent implements OnInit { | |||
78 | } | 81 | } |
79 | 82 | ||
80 | private loadVideoPlaylists () { | 83 | private loadVideoPlaylists () { |
84 | const playlistsObservable = this.videoPlaylistService.listAccountPlaylists(this.user.account, this.pagination, '-updatedAt') | ||
85 | |||
81 | this.authService.userInformationLoaded | 86 | this.authService.userInformationLoaded |
82 | .pipe(flatMap(() => this.videoPlaylistService.listAccountPlaylists(this.user.account, '-updatedAt'))) | 87 | .pipe(flatMap(() => playlistsObservable)) |
83 | .subscribe(res => { | 88 | .subscribe(res => { |
84 | this.videoPlaylists = this.videoPlaylists.concat(res.data) | 89 | this.videoPlaylists = this.videoPlaylists.concat(res.data) |
85 | this.pagination.totalItems = res.total | 90 | this.pagination.totalItems = res.total |
91 | |||
92 | this.onDataSubject.next(res.data) | ||
86 | }) | 93 | }) |
87 | } | 94 | } |
88 | } | 95 | } |