]>
Commit | Line | Data |
---|---|---|
9af61e84 | 1 | import { Component, OnDestroy, OnInit } from '@angular/core' |
9bf9d2a5 | 2 | import { ActivatedRoute, Router } from '@angular/router' |
2a2c19df | 3 | import { Location } from '@angular/common' |
0cd4344f | 4 | import { immutableAssign } from '@app/shared/misc/utils' |
9bf9d2a5 | 5 | import { NotificationsService } from 'angular2-notifications' |
b2731bff | 6 | import { AuthService } from '../../core/auth' |
7bfd1b1e | 7 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' |
7b87d2d5 | 8 | import { VideoSortField } from '../../shared/video/sort-field.type' |
f3aaa9a9 | 9 | import { VideoService } from '../../shared/video/video.service' |
989e526a | 10 | import { I18n } from '@ngx-translate/i18n-polyfill' |
bbe0f064 | 11 | import { ScreenService } from '@app/shared/misc/screen.service' |
9bf9d2a5 C |
12 | |
13 | @Component({ | |
14 | selector: 'my-videos-trending', | |
202f6b6c C |
15 | styleUrls: [ '../../shared/video/abstract-video-list.scss' ], |
16 | templateUrl: '../../shared/video/abstract-video-list.html' | |
9bf9d2a5 | 17 | }) |
9af61e84 | 18 | export class VideoTrendingComponent extends AbstractVideoList implements OnInit, OnDestroy { |
989e526a | 19 | titlePage: string |
2bbb3412 | 20 | currentRoute = '/videos/trending' |
9a629c6e | 21 | defaultSort: VideoSortField = '-trending' |
9bf9d2a5 | 22 | |
989e526a C |
23 | constructor ( |
24 | protected router: Router, | |
25 | protected route: ActivatedRoute, | |
26 | protected notificationsService: NotificationsService, | |
27 | protected authService: AuthService, | |
28 | protected location: Location, | |
bbe0f064 | 29 | protected screenService: ScreenService, |
b1d40cff C |
30 | protected i18n: I18n, |
31 | private videoService: VideoService | |
989e526a | 32 | ) { |
9bf9d2a5 | 33 | super() |
989e526a C |
34 | |
35 | this.titlePage = i18n('Trending') | |
9bf9d2a5 C |
36 | } |
37 | ||
38 | ngOnInit () { | |
39 | super.ngOnInit() | |
cc1561f9 | 40 | |
244e76a5 | 41 | this.generateSyndicationList() |
9bf9d2a5 C |
42 | } |
43 | ||
9af61e84 C |
44 | ngOnDestroy () { |
45 | super.ngOnDestroy() | |
46 | } | |
47 | ||
0cd4344f C |
48 | getVideosObservable (page: number) { |
49 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) | |
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 | } |