1 import { Component, OnInit } from '@angular/core'
2 import { ActivatedRoute, Router } from '@angular/router'
3 import { AuthService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core'
4 import { HooksService } from '@app/core/plugins/hooks.service'
5 import { immutableAssign } from '@app/helpers'
6 import { VideoService } from '@app/shared/shared-main'
7 import { AbstractVideoList } from '@app/shared/shared-video-miniature'
8 import { VideoSortField } from '@shared/models'
11 selector: 'my-videos-most-liked',
12 styleUrls: [ '../../shared/shared-video-miniature/abstract-video-list.scss' ],
13 templateUrl: '../../shared/shared-video-miniature/abstract-video-list.html'
15 export class VideoMostLikedComponent extends AbstractVideoList implements OnInit {
17 defaultSort: VideoSortField = '-likes'
19 useUserVideoPreferences = true
22 protected router: Router,
23 protected serverService: ServerService,
24 protected route: ActivatedRoute,
25 protected notifier: Notifier,
26 protected authService: AuthService,
27 protected userService: UserService,
28 protected screenService: ScreenService,
29 protected storageService: LocalStorageService,
30 private videoService: VideoService,
31 private hooks: HooksService
39 this.generateSyndicationList()
41 this.titlePage = $localize`Most liked videos`
42 this.titleTooltip = $localize`Videos that have the most likes.`
45 getVideosObservable (page: number) {
46 const newPagination = immutableAssign(this.pagination, { currentPage: page })
48 videoPagination: newPagination,
50 categoryOneOf: this.categoryOneOf,
51 languageOneOf: this.languageOneOf,
52 nsfwPolicy: this.nsfwPolicy,
56 return this.hooks.wrapObsFun(
57 this.videoService.getVideos.bind(this.videoService),
60 'filter:api.most-liked-videos.videos.list.params',
61 'filter:api.most-liked-videos.videos.list.result'
65 generateSyndicationList () {
66 this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, undefined, this.categoryOneOf)