]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/+videos/video-list/video-user-subscriptions.component.ts
Reorganize left menu and account menu
[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 { 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 { UserSubscriptionService } from '@app/shared/shared-user-subscription'
7 import { AbstractVideoList, OwnerDisplayType } from '@app/shared/shared-video-miniature'
8 import { VideoSortField } from '@shared/models'
9
10 @Component({
11 selector: 'my-videos-user-subscriptions',
12 styleUrls: [ '../../shared/shared-video-miniature/abstract-video-list.scss' ],
13 templateUrl: '../../shared/shared-video-miniature/abstract-video-list.html'
14 })
15 export class VideoUserSubscriptionsComponent extends AbstractVideoList implements OnInit, OnDestroy {
16 titlePage: string
17 sort = '-publishedAt' as VideoSortField
18 ownerDisplayType: OwnerDisplayType = 'auto'
19 groupByDate = true
20
21 constructor (
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 userSubscription: UserSubscriptionService,
31 private hooks: HooksService
32 ) {
33 super()
34
35 this.titlePage = $localize`Videos from your subscriptions`
36 this.actions.push({
37 routerLink: '/my-library/subscriptions',
38 label: $localize`Subscriptions`,
39 iconName: 'cog'
40 })
41 }
42
43 ngOnInit () {
44 super.ngOnInit()
45 }
46
47 ngOnDestroy () {
48 super.ngOnDestroy()
49 }
50
51 getVideosObservable (page: number) {
52 const newPagination = immutableAssign(this.pagination, { currentPage: page })
53 const params = {
54 videoPagination: newPagination,
55 sort: this.sort,
56 skipCount: true
57 }
58
59 return this.hooks.wrapObsFun(
60 this.userSubscription.getUserSubscriptionVideos.bind(this.userSubscription),
61 params,
62 'common',
63 'filter:api.user-subscriptions-videos.videos.list.params',
64 'filter:api.user-subscriptions-videos.videos.list.result'
65 )
66 }
67
68 generateSyndicationList () {
69 // not implemented yet
70 }
71 }