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'
22 useUserVideoLanguagePreferences = true
26 protected route: ActivatedRoute,
27 protected serverService: ServerService,
28 protected router: Router,
29 protected notifier: Notifier,
30 protected authService: AuthService,
31 protected screenService: ScreenService,
32 private videoService: VideoService
36 this.titlePage = i18n('Recently added')
42 this.generateSyndicationList()
49 getVideosObservable (page: number) {
50 const newPagination = immutableAssign(this.pagination, { currentPage: page })
52 return this.videoService.getVideos({
53 videoPagination: newPagination,
56 categoryOneOf: this.categoryOneOf,
57 languageOneOf: this.languageOneOf
61 generateSyndicationList () {
62 this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, undefined, this.categoryOneOf)