aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-02-13 14:11:05 +0100
committerChocobozzz <me@florianbigard.com>2018-02-13 14:20:46 +0100
commit0cd4344f3cf529b15308fcf3eb7d7eb07726df56 (patch)
tree276f6e8cfe72d583114d82fd5db981550a395488 /client/src/app/videos
parent29c6b829446a6fb29dffc6b7b638079ce60f3771 (diff)
downloadPeerTube-0cd4344f3cf529b15308fcf3eb7d7eb07726df56.tar.gz
PeerTube-0cd4344f3cf529b15308fcf3eb7d7eb07726df56.tar.zst
PeerTube-0cd4344f3cf529b15308fcf3eb7d7eb07726df56.zip
Rewrite infinite scroll
Diffstat (limited to 'client/src/app/videos')
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comments.component.html7
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comments.component.ts7
-rw-r--r--client/src/app/videos/video-list/video-recently-added.component.ts7
-rw-r--r--client/src/app/videos/video-list/video-search.component.ts12
-rw-r--r--client/src/app/videos/video-list/video-trending.component.ts6
5 files changed, 21 insertions, 18 deletions
diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.html b/client/src/app/videos/+video-watch/comment/video-comments.component.html
index 80b200931..7f2e96e93 100644
--- a/client/src/app/videos/+video-watch/comment/video-comments.component.html
+++ b/client/src/app/videos/+video-watch/comment/video-comments.component.html
@@ -15,10 +15,9 @@
15 15
16 <div 16 <div
17 class="comment-threads" 17 class="comment-threads"
18 infiniteScroll 18 myInfiniteScroller
19 [infiniteScrollUpDistance]="1.5" 19 [autoLoading]="true"
20 [infiniteScrollDistance]="0.5" 20 (nearOfBottom)="onNearOfBottom()"
21 (scrolled)="onNearOfBottom()"
22 > 21 >
23 <div *ngFor="let comment of comments"> 22 <div *ngFor="let comment of comments">
24 <my-video-comment 23 <my-video-comment
diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.ts b/client/src/app/videos/+video-watch/comment/video-comments.component.ts
index 6025256de..7ca3bafb5 100644
--- a/client/src/app/videos/+video-watch/comment/video-comments.component.ts
+++ b/client/src/app/videos/+video-watch/comment/video-comments.component.ts
@@ -160,11 +160,8 @@ export class VideoCommentsComponent implements OnChanges {
160 this.threadComments = {} 160 this.threadComments = {}
161 this.threadLoading = {} 161 this.threadLoading = {}
162 this.inReplyToCommentId = undefined 162 this.inReplyToCommentId = undefined
163 this.componentPagination = { 163 this.componentPagination.currentPage = 1
164 currentPage: 1, 164 this.componentPagination.totalItems = null
165 itemsPerPage: 10,
166 totalItems: null
167 }
168 165
169 this.loadMoreComments() 166 this.loadMoreComments()
170 } 167 }
diff --git a/client/src/app/videos/video-list/video-recently-added.component.ts b/client/src/app/videos/video-list/video-recently-added.component.ts
index 3020b8c30..f150e38da 100644
--- a/client/src/app/videos/video-list/video-recently-added.component.ts
+++ b/client/src/app/videos/video-list/video-recently-added.component.ts
@@ -1,5 +1,6 @@
1import { Component, OnInit } from '@angular/core' 1import { Component, OnInit } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router' 2import { ActivatedRoute, Router } from '@angular/router'
3import { immutableAssign } from '@app/shared/misc/utils'
3import { NotificationsService } from 'angular2-notifications' 4import { NotificationsService } from 'angular2-notifications'
4import { AuthService } from '../../core/auth' 5import { AuthService } from '../../core/auth'
5import { AbstractVideoList } from '../../shared/video/abstract-video-list' 6import { AbstractVideoList } from '../../shared/video/abstract-video-list'
@@ -28,7 +29,9 @@ export class VideoRecentlyAddedComponent extends AbstractVideoList implements On
28 super.ngOnInit() 29 super.ngOnInit()
29 } 30 }
30 31
31 getVideosObservable () { 32 getVideosObservable (page: number) {
32 return this.videoService.getVideos(this.pagination, this.sort) 33 const newPagination = immutableAssign(this.pagination, { currentPage: page })
34
35 return this.videoService.getVideos(newPagination, this.sort)
33 } 36 }
34} 37}
diff --git a/client/src/app/videos/video-list/video-search.component.ts b/client/src/app/videos/video-list/video-search.component.ts
index 67726afdc..241b97bc7 100644
--- a/client/src/app/videos/video-list/video-search.component.ts
+++ b/client/src/app/videos/video-list/video-search.component.ts
@@ -1,5 +1,6 @@
1import { Component, OnDestroy, OnInit } from '@angular/core' 1import { Component, OnDestroy, OnInit } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router' 2import { ActivatedRoute, Router } from '@angular/router'
3import { immutableAssign } from '@app/shared/misc/utils'
3import { NotificationsService } from 'angular2-notifications' 4import { NotificationsService } from 'angular2-notifications'
4import { Subscription } from 'rxjs/Subscription' 5import { Subscription } from 'rxjs/Subscription'
5import { AuthService } from '../../core/auth' 6import { AuthService } from '../../core/auth'
@@ -16,7 +17,7 @@ export class VideoSearchComponent extends AbstractVideoList implements OnInit, O
16 currentRoute = '/videos/search' 17 currentRoute = '/videos/search'
17 loadOnInit = false 18 loadOnInit = false
18 19
19 protected otherParams = { 20 protected otherRouteParams = {
20 search: '' 21 search: ''
21 } 22 }
22 private subActivatedRoute: Subscription 23 private subActivatedRoute: Subscription
@@ -35,9 +36,9 @@ export class VideoSearchComponent extends AbstractVideoList implements OnInit, O
35 this.subActivatedRoute = this.route.queryParams.subscribe( 36 this.subActivatedRoute = this.route.queryParams.subscribe(
36 queryParams => { 37 queryParams => {
37 const querySearch = queryParams['search'] 38 const querySearch = queryParams['search']
38 if (!querySearch || this.otherParams.search === querySearch) return 39 if (!querySearch || this.otherRouteParams.search === querySearch) return
39 40
40 this.otherParams.search = querySearch 41 this.otherRouteParams.search = querySearch
41 this.reloadVideos() 42 this.reloadVideos()
42 }, 43 },
43 44
@@ -51,7 +52,8 @@ export class VideoSearchComponent extends AbstractVideoList implements OnInit, O
51 } 52 }
52 } 53 }
53 54
54 getVideosObservable () { 55 getVideosObservable (page: number) {
55 return this.videoService.searchVideos(this.otherParams.search, this.pagination, this.sort) 56 const newPagination = immutableAssign(this.pagination, { currentPage: page })
57 return this.videoService.searchVideos(this.otherRouteParams.search, newPagination, this.sort)
56 } 58 }
57} 59}
diff --git a/client/src/app/videos/video-list/video-trending.component.ts b/client/src/app/videos/video-list/video-trending.component.ts
index fc48086d6..a42457273 100644
--- a/client/src/app/videos/video-list/video-trending.component.ts
+++ b/client/src/app/videos/video-list/video-trending.component.ts
@@ -1,5 +1,6 @@
1import { Component, OnInit } from '@angular/core' 1import { Component, OnInit } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router' 2import { ActivatedRoute, Router } from '@angular/router'
3import { immutableAssign } from '@app/shared/misc/utils'
3import { NotificationsService } from 'angular2-notifications' 4import { NotificationsService } from 'angular2-notifications'
4import { AuthService } from '../../core/auth' 5import { AuthService } from '../../core/auth'
5import { AbstractVideoList } from '../../shared/video/abstract-video-list' 6import { AbstractVideoList } from '../../shared/video/abstract-video-list'
@@ -28,7 +29,8 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit
28 super.ngOnInit() 29 super.ngOnInit()
29 } 30 }
30 31
31 getVideosObservable () { 32 getVideosObservable (page: number) {
32 return this.videoService.getVideos(this.pagination, this.sort) 33 const newPagination = immutableAssign(this.pagination, { currentPage: page })
34 return this.videoService.getVideos(newPagination, this.sort)
33 } 35 }
34} 36}