]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/videos/video-list/video-most-liked.component.ts
Media queries to use variables when possible
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / video-list / video-most-liked.component.ts
CommitLineData
c07eb946
JM
1import { Component, OnInit } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router'
3import { immutableAssign } from '@app/shared/misc/utils'
4import { AuthService } from '../../core/auth'
5import { AbstractVideoList } from '../../shared/video/abstract-video-list'
6import { VideoSortField } from '../../shared/video/sort-field.type'
7import { VideoService } from '../../shared/video/video.service'
8import { I18n } from '@ngx-translate/i18n-polyfill'
9import { ScreenService } from '@app/shared/misc/screen.service'
10import { Notifier, ServerService } from '@app/core'
11import { HooksService } from '@app/core/plugins/hooks.service'
12
13@Component({
14 selector: 'my-videos-most-liked',
15 styleUrls: [ '../../shared/video/abstract-video-list.scss' ],
16 templateUrl: '../../shared/video/abstract-video-list.html'
17})
18export class VideoMostLikedComponent extends AbstractVideoList implements OnInit {
19 titlePage: string
20 defaultSort: VideoSortField = '-likes'
21
22 useUserVideoLanguagePreferences = true
23
24 constructor (
25 protected i18n: I18n,
26 protected router: Router,
27 protected serverService: ServerService,
28 protected route: ActivatedRoute,
29 protected notifier: Notifier,
30 protected authService: AuthService,
31 protected screenService: ScreenService,
32 private videoService: VideoService,
33 private hooks: HooksService
34 ) {
35 super()
36 }
37
38 ngOnInit () {
39 super.ngOnInit()
40
41 this.generateSyndicationList()
42
ba430d75
C
43 this.titlePage = this.i18n('Most liked videos')
44 this.titleTooltip = this.i18n('Videos that have the higher number of likes.')
c07eb946
JM
45 }
46
47 getVideosObservable (page: number) {
48 const newPagination = immutableAssign(this.pagination, { currentPage: page })
49 const params = {
50 videoPagination: newPagination,
51 sort: this.sort,
52 categoryOneOf: this.categoryOneOf,
440d39c5
C
53 languageOneOf: this.languageOneOf,
54 skipCount: true
c07eb946
JM
55 }
56
57 return this.hooks.wrapObsFun(
58 this.videoService.getVideos.bind(this.videoService),
59 params,
60 'common',
61 'filter:api.most-liked-videos.videos.list.params',
62 'filter:api.most-liked-videos.videos.list.result'
63 )
64 }
65
66 generateSyndicationList () {
67 this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, undefined, this.categoryOneOf)
68 }
69}