+
+ loadMoreChannels () {
+ this.videoChannelService.listAccountVideoChannels(this.account, this.channelPagination)
+ .pipe(
+ tap(res => this.channelPagination.totalItems = res.total),
+ switchMap(res => from(res.data)),
+ concatMap(videoChannel => {
+ return this.videoService.getVideoChannelVideos(videoChannel, this.videosPagination, this.videosSort)
+ .pipe(map(data => ({ videoChannel, videos: data.data })))
+ })
+ )
+ .subscribe(({ videoChannel, videos }) => {
+ this.videoChannels.push(videoChannel)
+
+ this.videos[videoChannel.id] = videos
+
+ this.onChannelDataSubject.next([ videoChannel ])
+ })
+ }
+
+ getVideosOf (videoChannel: VideoChannel) {
+ const numberOfVideos = this.screenService.getNumberOfAvailableMiniatures()
+
+ // 2 rows
+ return this.videos[ videoChannel.id ].slice(0, numberOfVideos * 2)
+ }
+
+ onNearOfBottom () {
+ if (!hasMoreItems(this.channelPagination)) return
+
+ this.channelPagination.currentPage += 1
+
+ this.loadMoreChannels()
+ }
+
+ getVideoChannelLink (videoChannel: VideoChannel) {
+ return [ '/video-channels', videoChannel.nameWithHost ]
+ }