]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/videos/video-list/video-recently-added.component.ts
Handle actions in other videos section
[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'
9bf9d2a5 20
989e526a 21 constructor (
989e526a 22 protected route: ActivatedRoute,
489290b8
C
23 protected serverService: ServerService,
24 protected router: Router,
f8b2c1b4 25 protected notifier: Notifier,
989e526a 26 protected authService: AuthService,
bbe0f064 27 protected screenService: ScreenService,
489290b8 28 private i18n: I18n,
b1d40cff 29 private videoService: VideoService
989e526a 30 ) {
9bf9d2a5 31 super()
989e526a
C
32
33 this.titlePage = i18n('Recently added')
9bf9d2a5
C
34 }
35
36 ngOnInit () {
37 super.ngOnInit()
cc1561f9 38
244e76a5 39 this.generateSyndicationList()
9bf9d2a5
C
40 }
41
9af61e84
C
42 ngOnDestroy () {
43 super.ngOnDestroy()
44 }
45
0cd4344f
C
46 getVideosObservable (page: number) {
47 const newPagination = immutableAssign(this.pagination, { currentPage: page })
48
d59cba29 49 return this.videoService.getVideos(newPagination, this.sort, undefined, this.categoryOneOf)
9bf9d2a5 50 }
244e76a5
RK
51
52 generateSyndicationList () {
d59cba29 53 this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, undefined, this.categoryOneOf)
244e76a5 54 }
9bf9d2a5 55}