]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/videos/video-list/video-user-subscriptions.component.ts
Add button in subscriptions to go to subscriptions list
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / video-list / video-user-subscriptions.component.ts
1 import { Component, OnDestroy, OnInit } from '@angular/core'
2 import { ActivatedRoute, Router } from '@angular/router'
3 import { immutableAssign } from '@app/shared/misc/utils'
4 import { AuthService } from '../../core/auth'
5 import { AbstractVideoList } from '../../shared/video/abstract-video-list'
6 import { VideoSortField } from '../../shared/video/sort-field.type'
7 import { VideoService } from '../../shared/video/video.service'
8 import { I18n } from '@ngx-translate/i18n-polyfill'
9 import { ScreenService } from '@app/shared/misc/screen.service'
10 import { OwnerDisplayType } from '@app/shared/video/video-miniature.component'
11 import { Notifier, ServerService } from '@app/core'
12 import { HooksService } from '@app/core/plugins/hooks.service'
13
14 @Component({
15 selector: 'my-videos-user-subscriptions',
16 styleUrls: [ '../../shared/video/abstract-video-list.scss' ],
17 templateUrl: '../../shared/video/abstract-video-list.html'
18 })
19 export class VideoUserSubscriptionsComponent extends AbstractVideoList implements OnInit, OnDestroy {
20 titlePage: string
21 sort = '-publishedAt' as VideoSortField
22 ownerDisplayType: OwnerDisplayType = 'auto'
23 groupByDate = true
24
25 constructor (
26 protected i18n: I18n,
27 protected router: Router,
28 protected serverService: ServerService,
29 protected route: ActivatedRoute,
30 protected notifier: Notifier,
31 protected authService: AuthService,
32 protected screenService: ScreenService,
33 private videoService: VideoService,
34 private hooks: HooksService
35 ) {
36 super()
37
38 this.titlePage = i18n('Videos from your subscriptions')
39 this.actions.push({
40 routerLink: '/my-account/subscriptions',
41 label: i18n('Subscriptions'),
42 iconName: 'cog'
43 })
44 }
45
46 ngOnInit () {
47 super.ngOnInit()
48 }
49
50 ngOnDestroy () {
51 super.ngOnDestroy()
52 }
53
54 getVideosObservable (page: number) {
55 const newPagination = immutableAssign(this.pagination, { currentPage: page })
56 const params = {
57 videoPagination: newPagination,
58 sort: this.sort
59 }
60
61 return this.hooks.wrapObsFun(
62 this.videoService.getUserSubscriptionVideos.bind(this.videoService),
63 params,
64 'common',
65 'filter:api.user-subscriptions-videos.videos.list.params',
66 'filter:api.user-subscriptions-videos.videos.list.result'
67 )
68 }
69
70 generateSyndicationList () {
71 // not implemented yet
72 }
73 }