1 import { Component, OnDestroy, OnInit } from '@angular/core'
2 import { ActivatedRoute, Router } from '@angular/router'
3 import { immutableAssign } from '@app/shared/misc/utils'
4 import { AuthService } from '../../core/auth'
5 import { AbstractVideoList } from '../../shared/video/abstract-video-list'
6 import { VideoSortField } from '../../shared/video/sort-field.type'
7 import { VideoService } from '../../shared/video/video.service'
8 import { I18n } from '@ngx-translate/i18n-polyfill'
9 import { ScreenService } from '@app/shared/misc/screen.service'
10 import { Notifier, ServerService } from '@app/core'
13 selector: 'my-videos-recently-added',
14 styleUrls: [ '../../shared/video/abstract-video-list.scss' ],
15 templateUrl: '../../shared/video/abstract-video-list.html'
17 export class VideoRecentlyAddedComponent extends AbstractVideoList implements OnInit, OnDestroy {
19 sort: VideoSortField = '-publishedAt'
24 protected route: ActivatedRoute,
25 protected serverService: ServerService,
26 protected router: Router,
27 protected notifier: Notifier,
28 protected authService: AuthService,
29 protected screenService: ScreenService,
30 private videoService: VideoService
34 this.titlePage = i18n('Recently added')
40 this.generateSyndicationList()
47 getVideosObservable (page: number) {
48 const newPagination = immutableAssign(this.pagination, { currentPage: page })
50 return this.videoService.getVideos(newPagination, this.sort, undefined, this.categoryOneOf)
53 generateSyndicationList () {
54 this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, undefined, this.categoryOneOf)