]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - client/src/app/videos/video-list/video-recently-added.component.ts
Merge branch 'release/v1.2.0'
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / video-list / video-recently-added.component.ts
... / ...
CommitLineData
1import { Component, OnDestroy, OnInit } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router'
3import { Location } from '@angular/common'
4import { immutableAssign } from '@app/shared/misc/utils'
5import { AuthService } from '../../core/auth'
6import { AbstractVideoList } from '../../shared/video/abstract-video-list'
7import { VideoSortField } from '../../shared/video/sort-field.type'
8import { VideoService } from '../../shared/video/video.service'
9import { I18n } from '@ngx-translate/i18n-polyfill'
10import { ScreenService } from '@app/shared/misc/screen.service'
11import { Notifier } from '@app/core'
12
13@Component({
14 selector: 'my-videos-recently-added',
15 styleUrls: [ '../../shared/video/abstract-video-list.scss' ],
16 templateUrl: '../../shared/video/abstract-video-list.html'
17})
18export class VideoRecentlyAddedComponent extends AbstractVideoList implements OnInit, OnDestroy {
19 titlePage: string
20 currentRoute = '/videos/recently-added'
21 sort: VideoSortField = '-publishedAt'
22
23 constructor (
24 protected router: Router,
25 protected route: ActivatedRoute,
26 protected location: Location,
27 protected notifier: Notifier,
28 protected authService: AuthService,
29 protected i18n: I18n,
30 protected screenService: ScreenService,
31 private videoService: VideoService
32 ) {
33 super()
34
35 this.titlePage = i18n('Recently added')
36 }
37
38 ngOnInit () {
39 super.ngOnInit()
40
41 this.generateSyndicationList()
42 }
43
44 ngOnDestroy () {
45 super.ngOnDestroy()
46 }
47
48 getVideosObservable (page: number) {
49 const newPagination = immutableAssign(this.pagination, { currentPage: page })
50
51 return this.videoService.getVideos(newPagination, this.sort, undefined, this.categoryOneOf)
52 }
53
54 generateSyndicationList () {
55 this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, undefined, this.categoryOneOf)
56 }
57}