]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/videos/video-list/video-recently-added.component.ts
Merge branch 'release/v1.3.0' into develop
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / video-list / video-recently-added.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'
b2731bff 4import { AuthService } from '../../core/auth'
202f6b6c 5import { AbstractVideoList } from '../../shared/video/abstract-video-list'
7b87d2d5 6import { VideoSortField } from '../../shared/video/sort-field.type'
f3aaa9a9 7import { VideoService } from '../../shared/video/video.service'
989e526a 8import { I18n } from '@ngx-translate/i18n-polyfill'
bbe0f064 9import { ScreenService } from '@app/shared/misc/screen.service'
489290b8 10import { Notifier, ServerService } from '@app/core'
9bf9d2a5
C
11
12@Component({
13 selector: 'my-videos-recently-added',
202f6b6c
C
14 styleUrls: [ '../../shared/video/abstract-video-list.scss' ],
15 templateUrl: '../../shared/video/abstract-video-list.html'
9bf9d2a5 16})
9af61e84 17export class VideoRecentlyAddedComponent extends AbstractVideoList implements OnInit, OnDestroy {
989e526a 18 titlePage: string
136cce4d 19 sort: VideoSortField = '-publishedAt'
34c7f429 20 groupByDate = true
9bf9d2a5 21
989e526a 22 constructor (
34c7f429 23 protected i18n: I18n,
989e526a 24 protected route: ActivatedRoute,
489290b8
C
25 protected serverService: ServerService,
26 protected router: Router,
f8b2c1b4 27 protected notifier: Notifier,
989e526a 28 protected authService: AuthService,
bbe0f064 29 protected screenService: ScreenService,
b1d40cff 30 private videoService: VideoService
989e526a 31 ) {
9bf9d2a5 32 super()
989e526a
C
33
34 this.titlePage = i18n('Recently added')
9bf9d2a5
C
35 }
36
37 ngOnInit () {
38 super.ngOnInit()
cc1561f9 39
244e76a5 40 this.generateSyndicationList()
9bf9d2a5
C
41 }
42
9af61e84
C
43 ngOnDestroy () {
44 super.ngOnDestroy()
45 }
46
0cd4344f
C
47 getVideosObservable (page: number) {
48 const newPagination = immutableAssign(this.pagination, { currentPage: page })
49
d59cba29 50 return this.videoService.getVideos(newPagination, this.sort, undefined, this.categoryOneOf)
9bf9d2a5 51 }
244e76a5
RK
52
53 generateSyndicationList () {
d59cba29 54 this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, undefined, this.categoryOneOf)
244e76a5 55 }
9bf9d2a5 56}