1 import { Component, OnDestroy, OnInit } from '@angular/core'
2 import { ActivatedRoute, Router } from '@angular/router'
3 import { Location } from '@angular/common'
4 import { immutableAssign } from '@app/shared/misc/utils'
5 import { NotificationsService } from 'angular2-notifications'
6 import { AuthService } from '../../core/auth'
7 import { AbstractVideoList } from '../../shared/video/abstract-video-list'
8 import { VideoSortField } from '../../shared/video/sort-field.type'
9 import { VideoService } from '../../shared/video/video.service'
10 import { I18n } from '@ngx-translate/i18n-polyfill'
13 selector: 'my-videos-trending',
14 styleUrls: [ '../../shared/video/abstract-video-list.scss' ],
15 templateUrl: '../../shared/video/abstract-video-list.html'
17 export class VideoTrendingComponent extends AbstractVideoList implements OnInit, OnDestroy {
19 currentRoute = '/videos/trending'
20 defaultSort: VideoSortField = '-views'
23 protected router: Router,
24 protected route: ActivatedRoute,
25 protected notificationsService: NotificationsService,
26 protected authService: AuthService,
27 protected location: Location,
29 private videoService: VideoService
33 this.titlePage = i18n('Trending')
39 this.generateSyndicationList()
46 getVideosObservable (page: number) {
47 const newPagination = immutableAssign(this.pagination, { currentPage: page })
48 return this.videoService.getVideos(newPagination, this.sort)
51 generateSyndicationList () {
52 this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort)