diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2021-01-22 00:12:44 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-01-28 15:55:34 +0100 |
commit | 5bcbcbe338ef5a1ed14f084311d013fbb25dabcf (patch) | |
tree | b0f6382b30b67f1f7adddaf7d12af9adae0c9f5d /client/src/app/+videos | |
parent | 7a4994873c0b3394d04e16e877fc7418bc8b146a (diff) | |
download | PeerTube-5bcbcbe338ef5a1ed14f084311d013fbb25dabcf.tar.gz PeerTube-5bcbcbe338ef5a1ed14f084311d013fbb25dabcf.tar.zst PeerTube-5bcbcbe338ef5a1ed14f084311d013fbb25dabcf.zip |
modularize abstract video list header and implement video hotness recommendation variant
Diffstat (limited to 'client/src/app/+videos')
13 files changed, 245 insertions, 23 deletions
diff --git a/client/src/app/+videos/video-list/index.ts b/client/src/app/+videos/video-list/index.ts index af1bd58b7..dc27e29e2 100644 --- a/client/src/app/+videos/video-list/index.ts +++ b/client/src/app/+videos/video-list/index.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | export * from './overview' | 1 | export * from './overview' |
2 | export * from './trending' | ||
2 | export * from './video-local.component' | 3 | export * from './video-local.component' |
3 | export * from './video-recently-added.component' | 4 | export * from './video-recently-added.component' |
4 | export * from './video-trending.component' | ||
5 | export * from './video-most-liked.component' | ||
diff --git a/client/src/app/+videos/video-list/trending/index.ts b/client/src/app/+videos/video-list/trending/index.ts new file mode 100644 index 000000000..8bae205a5 --- /dev/null +++ b/client/src/app/+videos/video-list/trending/index.ts | |||
@@ -0,0 +1,4 @@ | |||
1 | export * from './video-trending-header.component' | ||
2 | export * from './video-trending.component' | ||
3 | export * from './video-hot.component' | ||
4 | export * from './video-most-liked.component' | ||
diff --git a/client/src/app/+videos/video-list/trending/video-hot.component.ts b/client/src/app/+videos/video-list/trending/video-hot.component.ts new file mode 100644 index 000000000..1617eb21e --- /dev/null +++ b/client/src/app/+videos/video-list/trending/video-hot.component.ts | |||
@@ -0,0 +1,85 @@ | |||
1 | import { Component, ComponentFactoryResolver, Injector, 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 { VideoService } from '@app/shared/shared-main' | ||
7 | import { AbstractVideoList } from '@app/shared/shared-video-miniature' | ||
8 | import { VideoSortField } from '@shared/models' | ||
9 | import { VideoTrendingHeaderComponent } from './video-trending-header.component' | ||
10 | |||
11 | @Component({ | ||
12 | selector: 'my-videos-hot', | ||
13 | styleUrls: [ '../../../shared/shared-video-miniature/abstract-video-list.scss' ], | ||
14 | templateUrl: '../../../shared/shared-video-miniature/abstract-video-list.html' | ||
15 | }) | ||
16 | export class VideoHotComponent extends AbstractVideoList implements OnInit, OnDestroy { | ||
17 | HeaderComponent = VideoTrendingHeaderComponent | ||
18 | titlePage: string | ||
19 | defaultSort: VideoSortField = '-hot' | ||
20 | |||
21 | useUserVideoPreferences = true | ||
22 | |||
23 | constructor ( | ||
24 | protected router: Router, | ||
25 | protected serverService: ServerService, | ||
26 | protected route: ActivatedRoute, | ||
27 | protected notifier: Notifier, | ||
28 | protected authService: AuthService, | ||
29 | protected userService: UserService, | ||
30 | protected screenService: ScreenService, | ||
31 | protected storageService: LocalStorageService, | ||
32 | protected cfr: ComponentFactoryResolver, | ||
33 | private videoService: VideoService, | ||
34 | private hooks: HooksService | ||
35 | ) { | ||
36 | super() | ||
37 | |||
38 | this.headerComponentInjector = this.getInjector() | ||
39 | } | ||
40 | |||
41 | ngOnInit () { | ||
42 | super.ngOnInit() | ||
43 | |||
44 | this.generateSyndicationList() | ||
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 | categoryOneOf: this.categoryOneOf, | ||
57 | languageOneOf: this.languageOneOf, | ||
58 | nsfwPolicy: this.nsfwPolicy, | ||
59 | skipCount: true | ||
60 | } | ||
61 | |||
62 | return this.hooks.wrapObsFun( | ||
63 | this.videoService.getVideos.bind(this.videoService), | ||
64 | params, | ||
65 | 'common', | ||
66 | 'filter:api.trending-videos.videos.list.params', | ||
67 | 'filter:api.trending-videos.videos.list.result' | ||
68 | ) | ||
69 | } | ||
70 | |||
71 | generateSyndicationList () { | ||
72 | this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, undefined, this.categoryOneOf) | ||
73 | } | ||
74 | |||
75 | getInjector () { | ||
76 | return Injector.create({ | ||
77 | providers: [{ | ||
78 | provide: 'data', | ||
79 | useValue: { | ||
80 | model: this.defaultSort | ||
81 | } | ||
82 | }] | ||
83 | }) | ||
84 | } | ||
85 | } | ||
diff --git a/client/src/app/+videos/video-list/video-most-liked.component.ts b/client/src/app/+videos/video-list/trending/video-most-liked.component.ts index 93408d76b..1781cc6aa 100644 --- a/client/src/app/+videos/video-list/video-most-liked.component.ts +++ b/client/src/app/+videos/video-list/trending/video-most-liked.component.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, ComponentFactoryResolver, Injector, OnInit } from '@angular/core' |
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { AuthService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core' | 3 | import { AuthService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core' |
4 | import { HooksService } from '@app/core/plugins/hooks.service' | 4 | import { HooksService } from '@app/core/plugins/hooks.service' |
@@ -6,13 +6,15 @@ import { immutableAssign } from '@app/helpers' | |||
6 | import { VideoService } from '@app/shared/shared-main' | 6 | import { VideoService } from '@app/shared/shared-main' |
7 | import { AbstractVideoList } from '@app/shared/shared-video-miniature' | 7 | import { AbstractVideoList } from '@app/shared/shared-video-miniature' |
8 | import { VideoSortField } from '@shared/models' | 8 | import { VideoSortField } from '@shared/models' |
9 | import { VideoTrendingHeaderComponent } from './video-trending-header.component' | ||
9 | 10 | ||
10 | @Component({ | 11 | @Component({ |
11 | selector: 'my-videos-most-liked', | 12 | selector: 'my-videos-most-liked', |
12 | styleUrls: [ '../../shared/shared-video-miniature/abstract-video-list.scss' ], | 13 | styleUrls: [ '../../../shared/shared-video-miniature/abstract-video-list.scss' ], |
13 | templateUrl: '../../shared/shared-video-miniature/abstract-video-list.html' | 14 | templateUrl: '../../../shared/shared-video-miniature/abstract-video-list.html' |
14 | }) | 15 | }) |
15 | export class VideoMostLikedComponent extends AbstractVideoList implements OnInit { | 16 | export class VideoMostLikedComponent extends AbstractVideoList implements OnInit { |
17 | HeaderComponent = VideoTrendingHeaderComponent | ||
16 | titlePage: string | 18 | titlePage: string |
17 | defaultSort: VideoSortField = '-likes' | 19 | defaultSort: VideoSortField = '-likes' |
18 | 20 | ||
@@ -27,19 +29,19 @@ export class VideoMostLikedComponent extends AbstractVideoList implements OnInit | |||
27 | protected userService: UserService, | 29 | protected userService: UserService, |
28 | protected screenService: ScreenService, | 30 | protected screenService: ScreenService, |
29 | protected storageService: LocalStorageService, | 31 | protected storageService: LocalStorageService, |
32 | protected cfr: ComponentFactoryResolver, | ||
30 | private videoService: VideoService, | 33 | private videoService: VideoService, |
31 | private hooks: HooksService | 34 | private hooks: HooksService |
32 | ) { | 35 | ) { |
33 | super() | 36 | super() |
37 | |||
38 | this.headerComponentInjector = this.getInjector() | ||
34 | } | 39 | } |
35 | 40 | ||
36 | ngOnInit () { | 41 | ngOnInit () { |
37 | super.ngOnInit() | 42 | super.ngOnInit() |
38 | 43 | ||
39 | this.generateSyndicationList() | 44 | this.generateSyndicationList() |
40 | |||
41 | this.titlePage = $localize`Most liked videos` | ||
42 | this.titleTooltip = $localize`Videos that have the most likes.` | ||
43 | } | 45 | } |
44 | 46 | ||
45 | getVideosObservable (page: number) { | 47 | getVideosObservable (page: number) { |
@@ -65,4 +67,15 @@ export class VideoMostLikedComponent extends AbstractVideoList implements OnInit | |||
65 | generateSyndicationList () { | 67 | generateSyndicationList () { |
66 | this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, undefined, this.categoryOneOf) | 68 | this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, undefined, this.categoryOneOf) |
67 | } | 69 | } |
70 | |||
71 | getInjector () { | ||
72 | return Injector.create({ | ||
73 | providers: [{ | ||
74 | provide: 'data', | ||
75 | useValue: { | ||
76 | model: this.defaultSort | ||
77 | } | ||
78 | }] | ||
79 | }) | ||
80 | } | ||
68 | } | 81 | } |
diff --git a/client/src/app/+videos/video-list/trending/video-trending-header.component.html b/client/src/app/+videos/video-list/trending/video-trending-header.component.html new file mode 100644 index 000000000..6319ee6d3 --- /dev/null +++ b/client/src/app/+videos/video-list/trending/video-trending-header.component.html | |||
@@ -0,0 +1,6 @@ | |||
1 | <div class="btn-group btn-group-toggle" ngbRadioGroup name="radioBasic" [(ngModel)]="data.model" (ngModelChange)="setSort()"> | ||
2 | <label *ngFor="let button of buttons" ngbButtonLabel class="btn-light" placement="bottom" [ngbTooltip]="button.tooltip" container="body"> | ||
3 | <my-global-icon [iconName]="button.iconName"></my-global-icon> | ||
4 | <input ngbButton type="radio" [value]="button.value"> {{ button.label }} | ||
5 | </label> | ||
6 | </div> \ No newline at end of file | ||
diff --git a/client/src/app/+videos/video-list/trending/video-trending-header.component.scss b/client/src/app/+videos/video-list/trending/video-trending-header.component.scss new file mode 100644 index 000000000..923a1d67a --- /dev/null +++ b/client/src/app/+videos/video-list/trending/video-trending-header.component.scss | |||
@@ -0,0 +1,17 @@ | |||
1 | .btn-group label { | ||
2 | border: 1px solid transparent; | ||
3 | border-radius: 9999px !important; | ||
4 | padding: 5px 16px; | ||
5 | opacity: .8; | ||
6 | |||
7 | &:not(:first-child) { | ||
8 | margin-left: .5rem; | ||
9 | } | ||
10 | |||
11 | my-global-icon { | ||
12 | position: relative; | ||
13 | top: -2px; | ||
14 | height: 1rem; | ||
15 | margin-right: .1rem; | ||
16 | } | ||
17 | } \ No newline at end of file | ||
diff --git a/client/src/app/+videos/video-list/trending/video-trending-header.component.ts b/client/src/app/+videos/video-list/trending/video-trending-header.component.ts new file mode 100644 index 000000000..125f14e33 --- /dev/null +++ b/client/src/app/+videos/video-list/trending/video-trending-header.component.ts | |||
@@ -0,0 +1,59 @@ | |||
1 | import { Component, Inject } from '@angular/core' | ||
2 | import { Router } from '@angular/router' | ||
3 | import { VideoListHeaderComponent } from '@app/shared/shared-video-miniature' | ||
4 | import { GlobalIconName } from '@app/shared/shared-icons' | ||
5 | import { VideoSortField } from '@shared/models' | ||
6 | |||
7 | interface VideoTrendingHeaderItem { | ||
8 | label: string | ||
9 | iconName: GlobalIconName | ||
10 | value: VideoSortField | ||
11 | path: string | ||
12 | tooltip?: string | ||
13 | } | ||
14 | |||
15 | @Component({ | ||
16 | selector: 'video-trending-title-page', | ||
17 | host: { 'class': 'title-page title-page-single' }, | ||
18 | styleUrls: [ './video-trending-header.component.scss' ], | ||
19 | templateUrl: './video-trending-header.component.html' | ||
20 | }) | ||
21 | export class VideoTrendingHeaderComponent extends VideoListHeaderComponent { | ||
22 | buttons: VideoTrendingHeaderItem[] | ||
23 | |||
24 | constructor ( | ||
25 | @Inject('data') public data: any, | ||
26 | private router: Router | ||
27 | ) { | ||
28 | super(data) | ||
29 | |||
30 | this.buttons = [ | ||
31 | { | ||
32 | label: $localize`:A variant of Trending videos based on the number of recent interactions:Hot`, | ||
33 | iconName: 'flame', | ||
34 | value: '-hot', | ||
35 | path: 'hot', | ||
36 | tooltip: $localize`Videos totalizing the most interactions for recent videos`, | ||
37 | }, | ||
38 | { | ||
39 | label: $localize`:Main variant of Trending videos based on number of recent views:Views`, | ||
40 | iconName: 'trending', | ||
41 | value: '-trending', | ||
42 | path: 'trending', | ||
43 | tooltip: $localize`Videos totalizing the most views during the last 24 hours`, | ||
44 | }, | ||
45 | { | ||
46 | label: $localize`:a variant of Trending videos based on the number of likes:Likes`, | ||
47 | iconName: 'like', | ||
48 | value: '-likes', | ||
49 | path: 'most-liked', | ||
50 | tooltip: $localize`Videos that have the most likes` | ||
51 | } | ||
52 | ] | ||
53 | } | ||
54 | |||
55 | setSort () { | ||
56 | const path = this.buttons.find(b => b.value === this.data.model).path | ||
57 | this.router.navigate([ `/videos/${path}` ]) | ||
58 | } | ||
59 | } | ||
diff --git a/client/src/app/+videos/video-list/video-trending.component.ts b/client/src/app/+videos/video-list/trending/video-trending.component.ts index a188795d1..e77231586 100644 --- a/client/src/app/+videos/video-list/video-trending.component.ts +++ b/client/src/app/+videos/video-list/trending/video-trending.component.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { Component, OnDestroy, OnInit } from '@angular/core' | 1 | import { Component, ComponentFactoryResolver, Injector, OnDestroy, OnInit } from '@angular/core' |
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { AuthService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core' | 3 | import { AuthService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core' |
4 | import { HooksService } from '@app/core/plugins/hooks.service' | 4 | import { HooksService } from '@app/core/plugins/hooks.service' |
@@ -6,13 +6,15 @@ import { immutableAssign } from '@app/helpers' | |||
6 | import { VideoService } from '@app/shared/shared-main' | 6 | import { VideoService } from '@app/shared/shared-main' |
7 | import { AbstractVideoList } from '@app/shared/shared-video-miniature' | 7 | import { AbstractVideoList } from '@app/shared/shared-video-miniature' |
8 | import { VideoSortField } from '@shared/models' | 8 | import { VideoSortField } from '@shared/models' |
9 | import { VideoTrendingHeaderComponent } from './video-trending-header.component' | ||
9 | 10 | ||
10 | @Component({ | 11 | @Component({ |
11 | selector: 'my-videos-trending', | 12 | selector: 'my-videos-trending', |
12 | styleUrls: [ '../../shared/shared-video-miniature/abstract-video-list.scss' ], | 13 | styleUrls: [ '../../../shared/shared-video-miniature/abstract-video-list.scss' ], |
13 | templateUrl: '../../shared/shared-video-miniature/abstract-video-list.html' | 14 | templateUrl: '../../../shared/shared-video-miniature/abstract-video-list.html' |
14 | }) | 15 | }) |
15 | export class VideoTrendingComponent extends AbstractVideoList implements OnInit, OnDestroy { | 16 | export class VideoTrendingComponent extends AbstractVideoList implements OnInit, OnDestroy { |
17 | HeaderComponent = VideoTrendingHeaderComponent | ||
16 | titlePage: string | 18 | titlePage: string |
17 | defaultSort: VideoSortField = '-trending' | 19 | defaultSort: VideoSortField = '-trending' |
18 | 20 | ||
@@ -27,10 +29,13 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit, | |||
27 | protected userService: UserService, | 29 | protected userService: UserService, |
28 | protected screenService: ScreenService, | 30 | protected screenService: ScreenService, |
29 | protected storageService: LocalStorageService, | 31 | protected storageService: LocalStorageService, |
32 | protected cfr: ComponentFactoryResolver, | ||
30 | private videoService: VideoService, | 33 | private videoService: VideoService, |
31 | private hooks: HooksService | 34 | private hooks: HooksService |
32 | ) { | 35 | ) { |
33 | super() | 36 | super() |
37 | |||
38 | this.headerComponentInjector = this.getInjector() | ||
34 | } | 39 | } |
35 | 40 | ||
36 | ngOnInit () { | 41 | ngOnInit () { |
@@ -43,13 +48,13 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit, | |||
43 | const trendingDays = config.trending.videos.intervalDays | 48 | const trendingDays = config.trending.videos.intervalDays |
44 | 49 | ||
45 | if (trendingDays === 1) { | 50 | if (trendingDays === 1) { |
46 | this.titlePage = $localize`Trending for the last 24 hours` | ||
47 | this.titleTooltip = $localize`Trending videos are those totalizing the greatest number of views during the last 24 hours` | 51 | this.titleTooltip = $localize`Trending videos are those totalizing the greatest number of views during the last 24 hours` |
48 | return | 52 | } else { |
53 | this.titleTooltip = $localize`Trending videos are those totalizing the greatest number of views during the last ${trendingDays} days` | ||
49 | } | 54 | } |
50 | 55 | ||
51 | this.titlePage = $localize`Trending for the last ${trendingDays} days` | 56 | this.headerComponentInjector = this.getInjector() |
52 | this.titleTooltip = $localize`Trending videos are those totalizing the greatest number of views during the last ${trendingDays} days` | 57 | this.setHeader() |
53 | }) | 58 | }) |
54 | } | 59 | } |
55 | 60 | ||
@@ -80,4 +85,15 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit, | |||
80 | generateSyndicationList () { | 85 | generateSyndicationList () { |
81 | this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, undefined, this.categoryOneOf) | 86 | this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, undefined, this.categoryOneOf) |
82 | } | 87 | } |
88 | |||
89 | getInjector () { | ||
90 | return Injector.create({ | ||
91 | providers: [{ | ||
92 | provide: 'data', | ||
93 | useValue: { | ||
94 | model: this.defaultSort | ||
95 | } | ||
96 | }] | ||
97 | }) | ||
98 | } | ||
83 | } | 99 | } |
diff --git a/client/src/app/+videos/video-list/video-local.component.ts b/client/src/app/+videos/video-list/video-local.component.ts index 20dd61db9..af7eecff4 100644 --- a/client/src/app/+videos/video-list/video-local.component.ts +++ b/client/src/app/+videos/video-list/video-local.component.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { Component, OnDestroy, OnInit } from '@angular/core' | 1 | import { Component, ComponentFactoryResolver, OnDestroy, OnInit } from '@angular/core' |
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { AuthService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core' | 3 | import { AuthService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core' |
4 | import { HooksService } from '@app/core/plugins/hooks.service' | 4 | import { HooksService } from '@app/core/plugins/hooks.service' |
@@ -28,6 +28,7 @@ export class VideoLocalComponent extends AbstractVideoList implements OnInit, On | |||
28 | protected userService: UserService, | 28 | protected userService: UserService, |
29 | protected screenService: ScreenService, | 29 | protected screenService: ScreenService, |
30 | protected storageService: LocalStorageService, | 30 | protected storageService: LocalStorageService, |
31 | protected cfr: ComponentFactoryResolver, | ||
31 | private videoService: VideoService, | 32 | private videoService: VideoService, |
32 | private hooks: HooksService | 33 | private hooks: HooksService |
33 | ) { | 34 | ) { |
diff --git a/client/src/app/+videos/video-list/video-recently-added.component.ts b/client/src/app/+videos/video-list/video-recently-added.component.ts index 34db6aabd..2f4908074 100644 --- a/client/src/app/+videos/video-list/video-recently-added.component.ts +++ b/client/src/app/+videos/video-list/video-recently-added.component.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { Component, OnDestroy, OnInit } from '@angular/core' | 1 | import { Component, ComponentFactoryResolver, OnDestroy, OnInit } from '@angular/core' |
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { AuthService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core' | 3 | import { AuthService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core' |
4 | import { HooksService } from '@app/core/plugins/hooks.service' | 4 | import { HooksService } from '@app/core/plugins/hooks.service' |
@@ -28,6 +28,7 @@ export class VideoRecentlyAddedComponent extends AbstractVideoList implements On | |||
28 | protected userService: UserService, | 28 | protected userService: UserService, |
29 | protected screenService: ScreenService, | 29 | protected screenService: ScreenService, |
30 | protected storageService: LocalStorageService, | 30 | protected storageService: LocalStorageService, |
31 | protected cfr: ComponentFactoryResolver, | ||
31 | private videoService: VideoService, | 32 | private videoService: VideoService, |
32 | private hooks: HooksService | 33 | private hooks: HooksService |
33 | ) { | 34 | ) { |
diff --git a/client/src/app/+videos/video-list/video-user-subscriptions.component.ts b/client/src/app/+videos/video-list/video-user-subscriptions.component.ts index 62d862ec9..e352a2b2c 100644 --- a/client/src/app/+videos/video-list/video-user-subscriptions.component.ts +++ b/client/src/app/+videos/video-list/video-user-subscriptions.component.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | 1 | ||
2 | import { switchMap } from 'rxjs/operators' | 2 | import { switchMap } from 'rxjs/operators' |
3 | import { Component, OnDestroy, OnInit } from '@angular/core' | 3 | import { Component, ComponentFactoryResolver, OnDestroy, OnInit } from '@angular/core' |
4 | import { ActivatedRoute, Router } from '@angular/router' | 4 | import { ActivatedRoute, Router } from '@angular/router' |
5 | import { AuthService, LocalStorageService, Notifier, ScopedTokensService, ScreenService, ServerService, UserService } from '@app/core' | 5 | import { AuthService, LocalStorageService, Notifier, ScopedTokensService, ScreenService, ServerService, UserService } from '@app/core' |
6 | import { HooksService } from '@app/core/plugins/hooks.service' | 6 | import { HooksService } from '@app/core/plugins/hooks.service' |
@@ -33,6 +33,7 @@ export class VideoUserSubscriptionsComponent extends AbstractVideoList implement | |||
33 | protected screenService: ScreenService, | 33 | protected screenService: ScreenService, |
34 | protected storageService: LocalStorageService, | 34 | protected storageService: LocalStorageService, |
35 | private userSubscription: UserSubscriptionService, | 35 | private userSubscription: UserSubscriptionService, |
36 | protected cfr: ComponentFactoryResolver, | ||
36 | private hooks: HooksService, | 37 | private hooks: HooksService, |
37 | private videoService: VideoService, | 38 | private videoService: VideoService, |
38 | private scopedTokensService: ScopedTokensService | 39 | private scopedTokensService: ScopedTokensService |
@@ -102,7 +103,8 @@ export class VideoUserSubscriptionsComponent extends AbstractVideoList implement | |||
102 | } | 103 | } |
103 | 104 | ||
104 | generateSyndicationList () { | 105 | generateSyndicationList () { |
105 | // not implemented yet | 106 | /* method disabled: the view provides its own */ |
107 | throw new Error('Method not implemented.') | ||
106 | } | 108 | } |
107 | 109 | ||
108 | activateCopiedMessage () { | 110 | activateCopiedMessage () { |
diff --git a/client/src/app/+videos/videos-routing.module.ts b/client/src/app/+videos/videos-routing.module.ts index f658182e0..b6850b436 100644 --- a/client/src/app/+videos/videos-routing.module.ts +++ b/client/src/app/+videos/videos-routing.module.ts | |||
@@ -3,10 +3,11 @@ import { RouterModule, Routes } from '@angular/router' | |||
3 | import { LoginGuard } from '@app/core' | 3 | import { LoginGuard } from '@app/core' |
4 | import { MetaGuard } from '@ngx-meta/core' | 4 | import { MetaGuard } from '@ngx-meta/core' |
5 | import { VideoOverviewComponent } from './video-list/overview/video-overview.component' | 5 | import { VideoOverviewComponent } from './video-list/overview/video-overview.component' |
6 | import { VideoHotComponent } from './video-list/trending/video-hot.component' | ||
7 | import { VideoMostLikedComponent } from './video-list/trending/video-most-liked.component' | ||
8 | import { VideoTrendingComponent } from './video-list/trending/video-trending.component' | ||
6 | import { VideoLocalComponent } from './video-list/video-local.component' | 9 | import { VideoLocalComponent } from './video-list/video-local.component' |
7 | import { VideoMostLikedComponent } from './video-list/video-most-liked.component' | ||
8 | import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component' | 10 | import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component' |
9 | import { VideoTrendingComponent } from './video-list/video-trending.component' | ||
10 | import { VideoUserSubscriptionsComponent } from './video-list/video-user-subscriptions.component' | 11 | import { VideoUserSubscriptionsComponent } from './video-list/video-user-subscriptions.component' |
11 | import { VideosComponent } from './videos.component' | 12 | import { VideosComponent } from './videos.component' |
12 | 13 | ||
@@ -39,6 +40,19 @@ const videosRoutes: Routes = [ | |||
39 | } | 40 | } |
40 | }, | 41 | }, |
41 | { | 42 | { |
43 | path: 'hot', | ||
44 | component: VideoHotComponent, | ||
45 | data: { | ||
46 | meta: { | ||
47 | title: $localize`Hot videos` | ||
48 | }, | ||
49 | reuse: { | ||
50 | enabled: true, | ||
51 | key: 'hot-videos-list' | ||
52 | } | ||
53 | } | ||
54 | }, | ||
55 | { | ||
42 | path: 'most-liked', | 56 | path: 'most-liked', |
43 | component: VideoMostLikedComponent, | 57 | component: VideoMostLikedComponent, |
44 | data: { | 58 | data: { |
diff --git a/client/src/app/+videos/videos.module.ts b/client/src/app/+videos/videos.module.ts index 1cf68bf83..4c88a0397 100644 --- a/client/src/app/+videos/videos.module.ts +++ b/client/src/app/+videos/videos.module.ts | |||
@@ -1,3 +1,4 @@ | |||
1 | import { CommonModule } from '@angular/common' | ||
1 | import { NgModule } from '@angular/core' | 2 | import { NgModule } from '@angular/core' |
2 | import { SharedFormModule } from '@app/shared/shared-forms' | 3 | import { SharedFormModule } from '@app/shared/shared-forms' |
3 | import { SharedGlobalIconModule } from '@app/shared/shared-icons' | 4 | import { SharedGlobalIconModule } from '@app/shared/shared-icons' |
@@ -6,10 +7,12 @@ import { SharedUserSubscriptionModule } from '@app/shared/shared-user-subscripti | |||
6 | import { SharedVideoMiniatureModule } from '@app/shared/shared-video-miniature' | 7 | import { SharedVideoMiniatureModule } from '@app/shared/shared-video-miniature' |
7 | import { OverviewService } from './video-list' | 8 | import { OverviewService } from './video-list' |
8 | import { VideoOverviewComponent } from './video-list/overview/video-overview.component' | 9 | import { VideoOverviewComponent } from './video-list/overview/video-overview.component' |
10 | import { VideoTrendingHeaderComponent } from './video-list/trending/video-trending-header.component' | ||
11 | import { VideoHotComponent } from './video-list/trending/video-hot.component' | ||
12 | import { VideoTrendingComponent } from './video-list/trending/video-trending.component' | ||
13 | import { VideoMostLikedComponent } from './video-list/trending/video-most-liked.component' | ||
9 | import { VideoLocalComponent } from './video-list/video-local.component' | 14 | import { VideoLocalComponent } from './video-list/video-local.component' |
10 | import { VideoMostLikedComponent } from './video-list/video-most-liked.component' | ||
11 | import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component' | 15 | import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component' |
12 | import { VideoTrendingComponent } from './video-list/video-trending.component' | ||
13 | import { VideoUserSubscriptionsComponent } from './video-list/video-user-subscriptions.component' | 16 | import { VideoUserSubscriptionsComponent } from './video-list/video-user-subscriptions.component' |
14 | import { VideosRoutingModule } from './videos-routing.module' | 17 | import { VideosRoutingModule } from './videos-routing.module' |
15 | import { VideosComponent } from './videos.component' | 18 | import { VideosComponent } from './videos.component' |
@@ -28,7 +31,9 @@ import { VideosComponent } from './videos.component' | |||
28 | declarations: [ | 31 | declarations: [ |
29 | VideosComponent, | 32 | VideosComponent, |
30 | 33 | ||
34 | VideoTrendingHeaderComponent, | ||
31 | VideoTrendingComponent, | 35 | VideoTrendingComponent, |
36 | VideoHotComponent, | ||
32 | VideoMostLikedComponent, | 37 | VideoMostLikedComponent, |
33 | VideoRecentlyAddedComponent, | 38 | VideoRecentlyAddedComponent, |
34 | VideoLocalComponent, | 39 | VideoLocalComponent, |