]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/videos/video-list/video-trending.component.ts
Hide big play button on autoplay
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / video-list / video-trending.component.ts
CommitLineData
9af61e84 1import { Component, OnDestroy, OnInit } from '@angular/core'
9bf9d2a5 2import { ActivatedRoute, Router } from '@angular/router'
0cd4344f 3import { immutableAssign } from '@app/shared/misc/utils'
9bf9d2a5 4import { NotificationsService } from 'angular2-notifications'
b2731bff 5import { AuthService } from '../../core/auth'
7bfd1b1e 6import { AbstractVideoList } from '../../shared/video/abstract-video-list'
f3aaa9a9
C
7import { SortField } from '../../shared/video/sort-field.type'
8import { VideoService } from '../../shared/video/video.service'
244e76a5
RK
9import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum'
10import * as url from 'url'
9bf9d2a5
C
11
12@Component({
13 selector: 'my-videos-trending',
202f6b6c
C
14 styleUrls: [ '../../shared/video/abstract-video-list.scss' ],
15 templateUrl: '../../shared/video/abstract-video-list.html'
9bf9d2a5 16})
9af61e84 17export class VideoTrendingComponent extends AbstractVideoList implements OnInit, OnDestroy {
9bf9d2a5 18 titlePage = 'Trending'
2bbb3412 19 currentRoute = '/videos/trending'
f3aaa9a9 20 defaultSort: SortField = '-views'
9bf9d2a5
C
21
22 constructor (protected router: Router,
23 protected route: ActivatedRoute,
24 protected notificationsService: NotificationsService,
b2731bff 25 protected authService: AuthService,
9bf9d2a5
C
26 private videoService: VideoService) {
27 super()
28 }
29
30 ngOnInit () {
31 super.ngOnInit()
244e76a5 32 this.generateSyndicationList()
9bf9d2a5
C
33 }
34
9af61e84
C
35 ngOnDestroy () {
36 super.ngOnDestroy()
37 }
38
0cd4344f
C
39 getVideosObservable (page: number) {
40 const newPagination = immutableAssign(this.pagination, { currentPage: page })
41 return this.videoService.getVideos(newPagination, this.sort)
9bf9d2a5 42 }
244e76a5
RK
43
44 generateSyndicationList () {
45 const feeds = this.videoService.getFeed('local')
46 this.syndicationItems['rss 2.0'] = feeds[FeedFormat.RSS]
47 this.syndicationItems['atom 1.0'] = feeds[FeedFormat.ATOM]
48 this.syndicationItems['json 1.0'] = feeds[FeedFormat.JSON]
49 }
9bf9d2a5 50}