]>
Commit | Line | Data |
---|---|---|
9af61e84 | 1 | import { Component, OnDestroy, OnInit } from '@angular/core' |
9bf9d2a5 | 2 | import { ActivatedRoute, Router } from '@angular/router' |
0cd4344f | 3 | import { immutableAssign } from '@app/shared/misc/utils' |
b2731bff | 4 | import { AuthService } from '../../core/auth' |
202f6b6c | 5 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' |
7b87d2d5 | 6 | import { VideoSortField } from '../../shared/video/sort-field.type' |
f3aaa9a9 | 7 | import { VideoService } from '../../shared/video/video.service' |
989e526a | 8 | import { I18n } from '@ngx-translate/i18n-polyfill' |
bbe0f064 | 9 | import { ScreenService } from '@app/shared/misc/screen.service' |
489290b8 | 10 | import { 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 | 17 | export class VideoRecentlyAddedComponent extends AbstractVideoList implements OnInit, OnDestroy { |
989e526a | 18 | titlePage: string |
136cce4d | 19 | sort: VideoSortField = '-publishedAt' |
34c7f429 | 20 | groupByDate = true |
9bf9d2a5 | 21 | |
3caf77d3 C |
22 | useUserVideoLanguagePreferences = true |
23 | ||
989e526a | 24 | constructor ( |
34c7f429 | 25 | protected i18n: I18n, |
989e526a | 26 | protected route: ActivatedRoute, |
489290b8 C |
27 | protected serverService: ServerService, |
28 | protected router: Router, | |
f8b2c1b4 | 29 | protected notifier: Notifier, |
989e526a | 30 | protected authService: AuthService, |
bbe0f064 | 31 | protected screenService: ScreenService, |
b1d40cff | 32 | private videoService: VideoService |
989e526a | 33 | ) { |
9bf9d2a5 | 34 | super() |
989e526a C |
35 | |
36 | this.titlePage = i18n('Recently added') | |
9bf9d2a5 C |
37 | } |
38 | ||
39 | ngOnInit () { | |
40 | super.ngOnInit() | |
cc1561f9 | 41 | |
244e76a5 | 42 | this.generateSyndicationList() |
9bf9d2a5 C |
43 | } |
44 | ||
9af61e84 C |
45 | ngOnDestroy () { |
46 | super.ngOnDestroy() | |
47 | } | |
48 | ||
0cd4344f C |
49 | getVideosObservable (page: number) { |
50 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) | |
51 | ||
3caf77d3 C |
52 | return this.videoService.getVideos({ |
53 | videoPagination: newPagination, | |
54 | sort: this.sort, | |
55 | filter: undefined, | |
56 | categoryOneOf: this.categoryOneOf, | |
57 | languageOneOf: this.languageOneOf | |
58 | }) | |
9bf9d2a5 | 59 | } |
244e76a5 RK |
60 | |
61 | generateSyndicationList () { | |
d59cba29 | 62 | this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, undefined, this.categoryOneOf) |
244e76a5 | 63 | } |
9bf9d2a5 | 64 | } |