]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/+videos/video-list/video-recently-added.component.ts
Add ability to disable peertube button link in embed
[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'
67ed6552 3import { AuthService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core'
93cae479 4import { HooksService } from '@app/core/plugins/hooks.service'
67ed6552
C
5import { immutableAssign } from '@app/helpers'
6import { VideoService } from '@app/shared/shared-main'
7import { AbstractVideoList } from '@app/shared/shared-video-miniature'
8import { I18n } from '@ngx-translate/i18n-polyfill'
9import { VideoSortField } from '@shared/models'
9bf9d2a5
C
10
11@Component({
12 selector: 'my-videos-recently-added',
67ed6552
C
13 styleUrls: [ '../../shared/shared-video-miniature/abstract-video-list.scss' ],
14 templateUrl: '../../shared/shared-video-miniature/abstract-video-list.html'
9bf9d2a5 15})
9af61e84 16export class VideoRecentlyAddedComponent extends AbstractVideoList implements OnInit, OnDestroy {
989e526a 17 titlePage: string
136cce4d 18 sort: VideoSortField = '-publishedAt'
34c7f429 19 groupByDate = true
9bf9d2a5 20
5c20a455 21 useUserVideoPreferences = true
3caf77d3 22
989e526a 23 constructor (
34c7f429 24 protected i18n: I18n,
989e526a 25 protected route: ActivatedRoute,
489290b8
C
26 protected serverService: ServerService,
27 protected router: Router,
f8b2c1b4 28 protected notifier: Notifier,
989e526a 29 protected authService: AuthService,
d3217560 30 protected userService: UserService,
bbe0f064 31 protected screenService: ScreenService,
d3217560 32 protected storageService: LocalStorageService,
93cae479
C
33 private videoService: VideoService,
34 private hooks: HooksService
989e526a 35 ) {
9bf9d2a5 36 super()
989e526a
C
37
38 this.titlePage = i18n('Recently added')
9bf9d2a5
C
39 }
40
41 ngOnInit () {
42 super.ngOnInit()
cc1561f9 43
244e76a5 44 this.generateSyndicationList()
9bf9d2a5
C
45 }
46
9af61e84
C
47 ngOnDestroy () {
48 super.ngOnDestroy()
49 }
50
0cd4344f
C
51 getVideosObservable (page: number) {
52 const newPagination = immutableAssign(this.pagination, { currentPage: page })
93cae479 53 const params = {
3caf77d3
C
54 videoPagination: newPagination,
55 sort: this.sort,
3caf77d3 56 categoryOneOf: this.categoryOneOf,
440d39c5 57 languageOneOf: this.languageOneOf,
5c20a455 58 nsfwPolicy: this.nsfwPolicy,
440d39c5 59 skipCount: true
93cae479
C
60 }
61
62 return this.hooks.wrapObsFun(
63 this.videoService.getVideos.bind(this.videoService),
64 params,
65 'common',
7663e55a
C
66 'filter:api.recently-added-videos.videos.list.params',
67 'filter:api.recently-added-videos.videos.list.result'
93cae479 68 )
9bf9d2a5 69 }
244e76a5
RK
70
71 generateSyndicationList () {
d59cba29 72 this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, undefined, this.categoryOneOf)
244e76a5 73 }
9bf9d2a5 74}