]>
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 | |
989e526a | 22 | constructor ( |
34c7f429 | 23 | protected i18n: I18n, |
989e526a | 24 | protected route: ActivatedRoute, |
489290b8 C |
25 | protected serverService: ServerService, |
26 | protected router: Router, | |
f8b2c1b4 | 27 | protected notifier: Notifier, |
989e526a | 28 | protected authService: AuthService, |
bbe0f064 | 29 | protected screenService: ScreenService, |
b1d40cff | 30 | private videoService: VideoService |
989e526a | 31 | ) { |
9bf9d2a5 | 32 | super() |
989e526a C |
33 | |
34 | this.titlePage = i18n('Recently added') | |
9bf9d2a5 C |
35 | } |
36 | ||
37 | ngOnInit () { | |
38 | super.ngOnInit() | |
cc1561f9 | 39 | |
244e76a5 | 40 | this.generateSyndicationList() |
9bf9d2a5 C |
41 | } |
42 | ||
9af61e84 C |
43 | ngOnDestroy () { |
44 | super.ngOnDestroy() | |
45 | } | |
46 | ||
0cd4344f C |
47 | getVideosObservable (page: number) { |
48 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) | |
49 | ||
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 | } |