]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/videos/video-list/video-trending.component.ts
Add ability to schedule video publication
[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'
2a2c19df 3import { Location } from '@angular/common'
0cd4344f 4import { immutableAssign } from '@app/shared/misc/utils'
9bf9d2a5 5import { NotificationsService } from 'angular2-notifications'
b2731bff 6import { AuthService } from '../../core/auth'
7bfd1b1e 7import { AbstractVideoList } from '../../shared/video/abstract-video-list'
7b87d2d5 8import { VideoSortField } from '../../shared/video/sort-field.type'
f3aaa9a9 9import { VideoService } from '../../shared/video/video.service'
989e526a 10import { I18n } from '@ngx-translate/i18n-polyfill'
bbe0f064 11import { ScreenService } from '@app/shared/misc/screen.service'
9bf9d2a5
C
12
13@Component({
14 selector: 'my-videos-trending',
202f6b6c
C
15 styleUrls: [ '../../shared/video/abstract-video-list.scss' ],
16 templateUrl: '../../shared/video/abstract-video-list.html'
9bf9d2a5 17})
9af61e84 18export class VideoTrendingComponent extends AbstractVideoList implements OnInit, OnDestroy {
989e526a 19 titlePage: string
2bbb3412 20 currentRoute = '/videos/trending'
7b87d2d5 21 defaultSort: VideoSortField = '-views'
9bf9d2a5 22
989e526a
C
23 constructor (
24 protected router: Router,
25 protected route: ActivatedRoute,
26 protected notificationsService: NotificationsService,
27 protected authService: AuthService,
28 protected location: Location,
bbe0f064 29 protected screenService: ScreenService,
b1d40cff
C
30 protected i18n: I18n,
31 private videoService: VideoService
989e526a 32 ) {
9bf9d2a5 33 super()
989e526a
C
34
35 this.titlePage = i18n('Trending')
9bf9d2a5
C
36 }
37
38 ngOnInit () {
39 super.ngOnInit()
cc1561f9 40
244e76a5 41 this.generateSyndicationList()
9bf9d2a5
C
42 }
43
9af61e84
C
44 ngOnDestroy () {
45 super.ngOnDestroy()
46 }
47
0cd4344f
C
48 getVideosObservable (page: number) {
49 const newPagination = immutableAssign(this.pagination, { currentPage: page })
50 return this.videoService.getVideos(newPagination, this.sort)
9bf9d2a5 51 }
244e76a5
RK
52
53 generateSyndicationList () {
7b87d2d5 54 this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort)
244e76a5 55 }
9bf9d2a5 56}