]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/videos/video-list/video-recently-added.component.ts
Merge branch 'master' into develop
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / video-list / video-recently-added.component.ts
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'
11
12 @Component({
13 selector: 'my-videos-recently-added',
14 styleUrls: [ '../../shared/video/abstract-video-list.scss' ],
15 templateUrl: '../../shared/video/abstract-video-list.html'
16 })
17 export class VideoRecentlyAddedComponent extends AbstractVideoList implements OnInit, OnDestroy {
18 titlePage: string
19 sort: VideoSortField = '-publishedAt'
20
21 constructor (
22 protected route: ActivatedRoute,
23 protected serverService: ServerService,
24 protected router: Router,
25 protected notifier: Notifier,
26 protected authService: AuthService,
27 protected screenService: ScreenService,
28 private i18n: I18n,
29 private videoService: VideoService
30 ) {
31 super()
32
33 this.titlePage = i18n('Recently added')
34 }
35
36 ngOnInit () {
37 super.ngOnInit()
38
39 this.generateSyndicationList()
40 }
41
42 ngOnDestroy () {
43 super.ngOnDestroy()
44 }
45
46 getVideosObservable (page: number) {
47 const newPagination = immutableAssign(this.pagination, { currentPage: page })
48
49 return this.videoService.getVideos(newPagination, this.sort, undefined, this.categoryOneOf)
50 }
51
52 generateSyndicationList () {
53 this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, undefined, this.categoryOneOf)
54 }
55 }