diff options
Diffstat (limited to 'client/src/app/+videos')
-rw-r--r-- | client/src/app/+videos/video-list/trending/index.ts | 4 | ||||
-rw-r--r-- | client/src/app/+videos/video-list/trending/video-hot.component.ts | 85 | ||||
-rw-r--r-- | client/src/app/+videos/video-list/trending/video-most-liked.component.ts | 81 | ||||
-rw-r--r-- | client/src/app/+videos/video-list/trending/video-trending-header.component.html | 10 | ||||
-rw-r--r-- | client/src/app/+videos/video-list/trending/video-trending-header.component.ts | 67 | ||||
-rw-r--r-- | client/src/app/+videos/video-list/trending/video-trending.component.ts (renamed from client/src/app/+videos/video-list/trending/video-most-viewed.component.ts) | 42 | ||||
-rw-r--r-- | client/src/app/+videos/videos-routing.module.ts | 42 | ||||
-rw-r--r-- | client/src/app/+videos/videos.module.ts | 10 |
8 files changed, 85 insertions, 256 deletions
diff --git a/client/src/app/+videos/video-list/trending/index.ts b/client/src/app/+videos/video-list/trending/index.ts index 93f4b1df6..70835885a 100644 --- a/client/src/app/+videos/video-list/trending/index.ts +++ b/client/src/app/+videos/video-list/trending/index.ts | |||
@@ -1,4 +1,2 @@ | |||
1 | export * from './video-trending-header.component' | 1 | export * from './video-trending-header.component' |
2 | export * from './video-hot.component' | 2 | export * from './video-trending.component' |
3 | export * from './video-most-viewed.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 deleted file mode 100644 index 1617eb21e..000000000 --- a/client/src/app/+videos/video-list/trending/video-hot.component.ts +++ /dev/null | |||
@@ -1,85 +0,0 @@ | |||
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/trending/video-most-liked.component.ts b/client/src/app/+videos/video-list/trending/video-most-liked.component.ts deleted file mode 100644 index 1781cc6aa..000000000 --- a/client/src/app/+videos/video-list/trending/video-most-liked.component.ts +++ /dev/null | |||
@@ -1,81 +0,0 @@ | |||
1 | import { Component, ComponentFactoryResolver, Injector, 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-most-liked', | ||
13 | styleUrls: [ '../../../shared/shared-video-miniature/abstract-video-list.scss' ], | ||
14 | templateUrl: '../../../shared/shared-video-miniature/abstract-video-list.html' | ||
15 | }) | ||
16 | export class VideoMostLikedComponent extends AbstractVideoList implements OnInit { | ||
17 | HeaderComponent = VideoTrendingHeaderComponent | ||
18 | titlePage: string | ||
19 | defaultSort: VideoSortField = '-likes' | ||
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 | getVideosObservable (page: number) { | ||
48 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) | ||
49 | const params = { | ||
50 | videoPagination: newPagination, | ||
51 | sort: this.sort, | ||
52 | categoryOneOf: this.categoryOneOf, | ||
53 | languageOneOf: this.languageOneOf, | ||
54 | nsfwPolicy: this.nsfwPolicy, | ||
55 | skipCount: true | ||
56 | } | ||
57 | |||
58 | return this.hooks.wrapObsFun( | ||
59 | this.videoService.getVideos.bind(this.videoService), | ||
60 | params, | ||
61 | 'common', | ||
62 | 'filter:api.most-liked-videos.videos.list.params', | ||
63 | 'filter:api.most-liked-videos.videos.list.result' | ||
64 | ) | ||
65 | } | ||
66 | |||
67 | generateSyndicationList () { | ||
68 | this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, undefined, this.categoryOneOf) | ||
69 | } | ||
70 | |||
71 | getInjector () { | ||
72 | return Injector.create({ | ||
73 | providers: [{ | ||
74 | provide: 'data', | ||
75 | useValue: { | ||
76 | model: this.defaultSort | ||
77 | } | ||
78 | }] | ||
79 | }) | ||
80 | } | ||
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 index a025bf1a2..7eb1e4f95 100644 --- 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 | |||
@@ -1,6 +1,8 @@ | |||
1 | <div class="btn-group btn-group-toggle" ngbRadioGroup name="radioBasic" [(ngModel)]="data.model" (ngModelChange)="setSort()"> | 1 | <div class="btn-group btn-group-toggle" ngbRadioGroup name="radioBasic" [(ngModel)]="data.model" (ngModelChange)="setSort()"> |
2 | <label *ngFor="let button of visibleButtons" ngbButtonLabel class="btn-light" placement="bottom" [ngbTooltip]="button.tooltip" container="body"> | 2 | <ng-container *ngFor="let button of buttons"> |
3 | <my-global-icon [iconName]="button.iconName"></my-global-icon> | 3 | <label *ngIf="!button.hidden" ngbButtonLabel class="btn-light" placement="bottom" [ngbTooltip]="button.tooltip" container="body"> |
4 | <input ngbButton type="radio" [value]="button.value"> {{ button.label }} | 4 | <my-global-icon [iconName]="button.iconName"></my-global-icon> |
5 | </label> | 5 | <input ngbButton type="radio" [value]="button.value"> {{ button.label }} |
6 | </label> | ||
7 | </ng-container> | ||
6 | </div> \ No newline at end of file | 8 | </div> \ 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 index e49b61c68..33eaa2c1e 100644 --- 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 | |||
@@ -1,30 +1,34 @@ | |||
1 | import { Component, Inject, OnInit } from '@angular/core' | 1 | import { Component, HostBinding, Inject, OnDestroy, OnInit } from '@angular/core' |
2 | import { Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { VideoListHeaderComponent } from '@app/shared/shared-video-miniature' | 3 | import { VideoListHeaderComponent } from '@app/shared/shared-video-miniature' |
4 | import { GlobalIconName } from '@app/shared/shared-icons' | 4 | import { GlobalIconName } from '@app/shared/shared-icons' |
5 | import { VideoSortField } from '@shared/models' | ||
6 | import { ServerService } from '@app/core/server/server.service' | 5 | import { ServerService } from '@app/core/server/server.service' |
6 | import { Subscription } from 'rxjs' | ||
7 | import { RedirectService } from '@app/core' | ||
7 | 8 | ||
8 | interface VideoTrendingHeaderItem { | 9 | interface VideoTrendingHeaderItem { |
9 | label: string | 10 | label: string |
10 | iconName: GlobalIconName | 11 | iconName: GlobalIconName |
11 | value: VideoSortField | 12 | value: string |
12 | path: string | ||
13 | tooltip?: string | 13 | tooltip?: string |
14 | hidden?: boolean | 14 | hidden?: boolean |
15 | } | 15 | } |
16 | 16 | ||
17 | @Component({ | 17 | @Component({ |
18 | selector: 'video-trending-title-page', | 18 | selector: 'video-trending-title-page', |
19 | host: { 'class': 'title-page title-page-single' }, | ||
20 | styleUrls: [ './video-trending-header.component.scss' ], | 19 | styleUrls: [ './video-trending-header.component.scss' ], |
21 | templateUrl: './video-trending-header.component.html' | 20 | templateUrl: './video-trending-header.component.html' |
22 | }) | 21 | }) |
23 | export class VideoTrendingHeaderComponent extends VideoListHeaderComponent implements OnInit { | 22 | export class VideoTrendingHeaderComponent extends VideoListHeaderComponent implements OnInit, OnDestroy { |
23 | @HostBinding('class') class = 'title-page title-page-single' | ||
24 | |||
24 | buttons: VideoTrendingHeaderItem[] | 25 | buttons: VideoTrendingHeaderItem[] |
25 | 26 | ||
27 | private algorithmChangeSub: Subscription | ||
28 | |||
26 | constructor ( | 29 | constructor ( |
27 | @Inject('data') public data: any, | 30 | @Inject('data') public data: any, |
31 | private route: ActivatedRoute, | ||
28 | private router: Router, | 32 | private router: Router, |
29 | private serverService: ServerService | 33 | private serverService: ServerService |
30 | ) { | 34 | ) { |
@@ -34,23 +38,20 @@ export class VideoTrendingHeaderComponent extends VideoListHeaderComponent imple | |||
34 | { | 38 | { |
35 | label: $localize`:A variant of Trending videos based on the number of recent interactions:Hot`, | 39 | label: $localize`:A variant of Trending videos based on the number of recent interactions:Hot`, |
36 | iconName: 'flame', | 40 | iconName: 'flame', |
37 | value: '-hot', | 41 | value: 'hot', |
38 | path: 'hot', | ||
39 | tooltip: $localize`Videos totalizing the most interactions for recent videos`, | 42 | tooltip: $localize`Videos totalizing the most interactions for recent videos`, |
40 | hidden: true | 43 | hidden: true |
41 | }, | 44 | }, |
42 | { | 45 | { |
43 | label: $localize`:Main variant of Trending videos based on number of recent views:Views`, | 46 | label: $localize`:Main variant of Trending videos based on number of recent views:Views`, |
44 | iconName: 'trending', | 47 | iconName: 'trending', |
45 | value: '-trending', | 48 | value: 'most-viewed', |
46 | path: 'most-viewed', | 49 | tooltip: $localize`Videos totalizing the most views during the last 24 hours` |
47 | tooltip: $localize`Videos totalizing the most views during the last 24 hours`, | ||
48 | }, | 50 | }, |
49 | { | 51 | { |
50 | label: $localize`:A variant of Trending videos based on the number of likes:Likes`, | 52 | label: $localize`:A variant of Trending videos based on the number of likes:Likes`, |
51 | iconName: 'like', | 53 | iconName: 'like', |
52 | value: '-likes', | 54 | value: 'most-liked', |
53 | path: 'most-liked', | ||
54 | tooltip: $localize`Videos that have the most likes` | 55 | tooltip: $localize`Videos that have the most likes` |
55 | } | 56 | } |
56 | ] | 57 | ] |
@@ -59,20 +60,40 @@ export class VideoTrendingHeaderComponent extends VideoListHeaderComponent imple | |||
59 | ngOnInit () { | 60 | ngOnInit () { |
60 | this.serverService.getConfig() | 61 | this.serverService.getConfig() |
61 | .subscribe(config => { | 62 | .subscribe(config => { |
62 | // don't filter if auto-blacklist is not enabled as this will be the only list | 63 | this.buttons = this.buttons.map(b => { |
63 | if (config.instance.pages.hot.enabled) { | 64 | b.hidden = !config.trending.videos.algorithms.enabled.includes(b.value) |
64 | const index = this.buttons.findIndex(b => b.path === 'hot') | 65 | return b |
65 | this.buttons[index].hidden = false | 66 | }) |
66 | } | ||
67 | }) | 67 | }) |
68 | |||
69 | this.algorithmChangeSub = this.route.queryParams.subscribe( | ||
70 | queryParams => { | ||
71 | const algorithm = queryParams['alg'] | ||
72 | if (algorithm) { | ||
73 | this.data.model = algorithm | ||
74 | } else { | ||
75 | this.data.model = RedirectService.DEFAULT_TRENDING_ALGORITHM | ||
76 | } | ||
77 | } | ||
78 | ) | ||
68 | } | 79 | } |
69 | 80 | ||
70 | get visibleButtons () { | 81 | ngOnDestroy () { |
71 | return this.buttons.filter(b => !b.hidden) | 82 | if (this.algorithmChangeSub) this.algorithmChangeSub.unsubscribe() |
72 | } | 83 | } |
73 | 84 | ||
74 | setSort () { | 85 | setSort () { |
75 | const path = this.buttons.find(b => b.value === this.data.model).path | 86 | const alg = this.data.model !== RedirectService.DEFAULT_TRENDING_ALGORITHM |
76 | this.router.navigate([ `/videos/${path}` ]) | 87 | ? this.data.model |
88 | : undefined | ||
89 | |||
90 | this.router.navigate( | ||
91 | [], | ||
92 | { | ||
93 | relativeTo: this.route, | ||
94 | queryParams: { alg }, | ||
95 | queryParamsHandling: 'merge' | ||
96 | } | ||
97 | ) | ||
77 | } | 98 | } |
78 | } | 99 | } |
diff --git a/client/src/app/+videos/video-list/trending/video-most-viewed.component.ts b/client/src/app/+videos/video-list/trending/video-trending.component.ts index 98ced42d6..6128c4acd 100644 --- a/client/src/app/+videos/video-list/trending/video-most-viewed.component.ts +++ b/client/src/app/+videos/video-list/trending/video-trending.component.ts | |||
@@ -1,25 +1,28 @@ | |||
1 | import { Component, ComponentFactoryResolver, Injector, 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, RedirectService, ScreenService, ServerService, UserService } from '@app/core' |
4 | import { HooksService } from '@app/core/plugins/hooks.service' | 4 | import { HooksService } from '@app/core/plugins/hooks.service' |
5 | import { immutableAssign } from '@app/helpers' | 5 | 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 { Subscription } from 'rxjs' | ||
9 | import { VideoTrendingHeaderComponent } from './video-trending-header.component' | 10 | import { VideoTrendingHeaderComponent } from './video-trending-header.component' |
10 | 11 | ||
11 | @Component({ | 12 | @Component({ |
12 | selector: 'my-videos-most-viewed', | 13 | selector: 'my-videos-hot', |
13 | styleUrls: [ '../../../shared/shared-video-miniature/abstract-video-list.scss' ], | 14 | styleUrls: [ '../../../shared/shared-video-miniature/abstract-video-list.scss' ], |
14 | templateUrl: '../../../shared/shared-video-miniature/abstract-video-list.html' | 15 | templateUrl: '../../../shared/shared-video-miniature/abstract-video-list.html' |
15 | }) | 16 | }) |
16 | export class VideoMostViewedComponent extends AbstractVideoList implements OnInit, OnDestroy { | 17 | export class VideoTrendingComponent extends AbstractVideoList implements OnInit, OnDestroy { |
17 | HeaderComponent = VideoTrendingHeaderComponent | 18 | HeaderComponent = VideoTrendingHeaderComponent |
18 | titlePage: string | 19 | titlePage: string |
19 | defaultSort: VideoSortField = '-trending' | 20 | defaultSort: VideoSortField = '-trending' |
20 | 21 | ||
21 | useUserVideoPreferences = true | 22 | useUserVideoPreferences = true |
22 | 23 | ||
24 | private algorithmChangeSub: Subscription | ||
25 | |||
23 | constructor ( | 26 | constructor ( |
24 | protected router: Router, | 27 | protected router: Router, |
25 | protected serverService: ServerService, | 28 | protected serverService: ServerService, |
@@ -35,6 +38,8 @@ export class VideoMostViewedComponent extends AbstractVideoList implements OnIni | |||
35 | ) { | 38 | ) { |
36 | super() | 39 | super() |
37 | 40 | ||
41 | this.defaultSort = this.parseAlgorithm(RedirectService.DEFAULT_TRENDING_ALGORITHM) | ||
42 | |||
38 | this.headerComponentInjector = this.getInjector() | 43 | this.headerComponentInjector = this.getInjector() |
39 | } | 44 | } |
40 | 45 | ||
@@ -43,23 +48,19 @@ export class VideoMostViewedComponent extends AbstractVideoList implements OnIni | |||
43 | 48 | ||
44 | this.generateSyndicationList() | 49 | this.generateSyndicationList() |
45 | 50 | ||
46 | this.serverService.getConfig().subscribe( | 51 | this.algorithmChangeSub = this.route.queryParams.subscribe( |
47 | config => { | 52 | queryParams => { |
48 | const trendingDays = config.trending.videos.intervalDays | 53 | const algorithm = queryParams['alg'] || RedirectService.DEFAULT_TRENDING_ALGORITHM |
49 | |||
50 | if (trendingDays === 1) { | ||
51 | this.titleTooltip = $localize`Trending videos are those totalizing the greatest number of views during the last 24 hours` | ||
52 | } else { | ||
53 | this.titleTooltip = $localize`Trending videos are those totalizing the greatest number of views during the last ${trendingDays} days` | ||
54 | } | ||
55 | 54 | ||
56 | this.headerComponentInjector = this.getInjector() | 55 | this.sort = this.parseAlgorithm(algorithm) |
57 | this.setHeader() | 56 | this.reloadVideos() |
58 | }) | 57 | } |
58 | ) | ||
59 | } | 59 | } |
60 | 60 | ||
61 | ngOnDestroy () { | 61 | ngOnDestroy () { |
62 | super.ngOnDestroy() | 62 | super.ngOnDestroy() |
63 | if (this.algorithmChangeSub) this.algorithmChangeSub.unsubscribe() | ||
63 | } | 64 | } |
64 | 65 | ||
65 | getVideosObservable (page: number) { | 66 | getVideosObservable (page: number) { |
@@ -96,4 +97,15 @@ export class VideoMostViewedComponent extends AbstractVideoList implements OnIni | |||
96 | }] | 97 | }] |
97 | }) | 98 | }) |
98 | } | 99 | } |
100 | |||
101 | private parseAlgorithm (algorithm: string): VideoSortField { | ||
102 | switch (algorithm) { | ||
103 | case 'most-viewed': | ||
104 | return '-trending' | ||
105 | case 'most-liked': | ||
106 | return '-likes' | ||
107 | default: | ||
108 | return '-' + algorithm as VideoSortField | ||
109 | } | ||
110 | } | ||
99 | } | 111 | } |
diff --git a/client/src/app/+videos/videos-routing.module.ts b/client/src/app/+videos/videos-routing.module.ts index 973935af8..16e3b9bb2 100644 --- a/client/src/app/+videos/videos-routing.module.ts +++ b/client/src/app/+videos/videos-routing.module.ts | |||
@@ -1,11 +1,9 @@ | |||
1 | import { NgModule } from '@angular/core' | 1 | import { NgModule } from '@angular/core' |
2 | import { RouterModule, Routes } from '@angular/router' | 2 | import { RouterModule, Routes } from '@angular/router' |
3 | import { LoginGuard, TrendingGuard } 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 { VideoTrendingComponent } from './video-list' | ||
5 | import { VideoOverviewComponent } from './video-list/overview/video-overview.component' | 6 | 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 { VideoMostViewedComponent } from './video-list/trending/video-most-viewed.component' | ||
9 | import { VideoLocalComponent } from './video-list/video-local.component' | 7 | import { VideoLocalComponent } from './video-list/video-local.component' |
10 | import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component' | 8 | import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component' |
11 | import { VideoUserSubscriptionsComponent } from './video-list/video-user-subscriptions.component' | 9 | import { VideoUserSubscriptionsComponent } from './video-list/video-user-subscriptions.component' |
@@ -28,46 +26,16 @@ const videosRoutes: Routes = [ | |||
28 | }, | 26 | }, |
29 | { | 27 | { |
30 | path: 'trending', | 28 | path: 'trending', |
31 | canActivate: [ TrendingGuard ] | 29 | component: VideoTrendingComponent, |
32 | }, | ||
33 | { | ||
34 | path: 'hot', | ||
35 | component: VideoHotComponent, | ||
36 | data: { | 30 | data: { |
37 | meta: { | 31 | meta: { |
38 | title: $localize`Hot videos` | 32 | title: $localize`Trending videos` |
39 | }, | ||
40 | reuse: { | ||
41 | enabled: true, | ||
42 | key: 'hot-videos-list' | ||
43 | } | ||
44 | } | ||
45 | }, | ||
46 | { | ||
47 | path: 'most-viewed', | ||
48 | component: VideoMostViewedComponent, | ||
49 | data: { | ||
50 | meta: { | ||
51 | title: $localize`Most viewed videos` | ||
52 | }, | ||
53 | reuse: { | ||
54 | enabled: true, | ||
55 | key: 'most-viewed-videos-list' | ||
56 | } | 33 | } |
57 | } | 34 | } |
58 | }, | 35 | }, |
59 | { | 36 | { |
60 | path: 'most-liked', | 37 | path: 'most-liked', |
61 | component: VideoMostLikedComponent, | 38 | redirectTo: 'trending?alg=most-liked' |
62 | data: { | ||
63 | meta: { | ||
64 | title: $localize`Most liked videos` | ||
65 | }, | ||
66 | reuse: { | ||
67 | enabled: true, | ||
68 | key: 'most-liked-videos-list' | ||
69 | } | ||
70 | } | ||
71 | }, | 39 | }, |
72 | { | 40 | { |
73 | path: 'recently-added', | 41 | path: 'recently-added', |
diff --git a/client/src/app/+videos/videos.module.ts b/client/src/app/+videos/videos.module.ts index ae9c680eb..61d012d63 100644 --- a/client/src/app/+videos/videos.module.ts +++ b/client/src/app/+videos/videos.module.ts | |||
@@ -1,16 +1,12 @@ | |||
1 | import { CommonModule } from '@angular/common' | ||
2 | import { NgModule } from '@angular/core' | 1 | import { NgModule } from '@angular/core' |
3 | import { SharedFormModule } from '@app/shared/shared-forms' | 2 | import { SharedFormModule } from '@app/shared/shared-forms' |
4 | import { SharedGlobalIconModule } from '@app/shared/shared-icons' | 3 | import { SharedGlobalIconModule } from '@app/shared/shared-icons' |
5 | import { SharedMainModule } from '@app/shared/shared-main' | 4 | import { SharedMainModule } from '@app/shared/shared-main' |
6 | import { SharedUserSubscriptionModule } from '@app/shared/shared-user-subscription' | 5 | import { SharedUserSubscriptionModule } from '@app/shared/shared-user-subscription' |
7 | import { SharedVideoMiniatureModule } from '@app/shared/shared-video-miniature' | 6 | import { SharedVideoMiniatureModule } from '@app/shared/shared-video-miniature' |
8 | import { OverviewService } from './video-list' | 7 | import { OverviewService, VideoTrendingComponent } from './video-list' |
9 | import { VideoOverviewComponent } from './video-list/overview/video-overview.component' | 8 | import { VideoOverviewComponent } from './video-list/overview/video-overview.component' |
10 | import { VideoTrendingHeaderComponent } from './video-list/trending/video-trending-header.component' | 9 | import { VideoTrendingHeaderComponent } from './video-list/trending/video-trending-header.component' |
11 | import { VideoHotComponent } from './video-list/trending/video-hot.component' | ||
12 | import { VideoMostViewedComponent } from './video-list/trending/video-most-viewed.component' | ||
13 | import { VideoMostLikedComponent } from './video-list/trending/video-most-liked.component' | ||
14 | import { VideoLocalComponent } from './video-list/video-local.component' | 10 | import { VideoLocalComponent } from './video-list/video-local.component' |
15 | import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component' | 11 | import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component' |
16 | import { VideoUserSubscriptionsComponent } from './video-list/video-user-subscriptions.component' | 12 | import { VideoUserSubscriptionsComponent } from './video-list/video-user-subscriptions.component' |
@@ -32,9 +28,7 @@ import { VideosComponent } from './videos.component' | |||
32 | VideosComponent, | 28 | VideosComponent, |
33 | 29 | ||
34 | VideoTrendingHeaderComponent, | 30 | VideoTrendingHeaderComponent, |
35 | VideoMostViewedComponent, | 31 | VideoTrendingComponent, |
36 | VideoHotComponent, | ||
37 | VideoMostLikedComponent, | ||
38 | VideoRecentlyAddedComponent, | 32 | VideoRecentlyAddedComponent, |
39 | VideoLocalComponent, | 33 | VideoLocalComponent, |
40 | VideoUserSubscriptionsComponent, | 34 | VideoUserSubscriptionsComponent, |