diff options
Diffstat (limited to 'client/src/app/+videos/videos-routing.module.ts')
-rw-r--r-- | client/src/app/+videos/videos-routing.module.ts | 54 |
1 files changed, 21 insertions, 33 deletions
diff --git a/client/src/app/+videos/videos-routing.module.ts b/client/src/app/+videos/videos-routing.module.ts index 926dfaab0..7db519615 100644 --- a/client/src/app/+videos/videos-routing.module.ts +++ b/client/src/app/+videos/videos-routing.module.ts | |||
@@ -1,10 +1,8 @@ | |||
1 | import { NgModule } from '@angular/core' | 1 | import { NgModule } from '@angular/core' |
2 | import { RouterModule, Routes } from '@angular/router' | 2 | import { RouterModule, Routes, UrlSegment } from '@angular/router' |
3 | import { LoginGuard } from '@app/core' | 3 | import { LoginGuard } from '@app/core' |
4 | import { VideoTrendingComponent } from './video-list' | 4 | import { VideosListCommonPageComponent } from './video-list' |
5 | import { VideoOverviewComponent } from './video-list/overview/video-overview.component' | 5 | import { VideoOverviewComponent } from './video-list/overview/video-overview.component' |
6 | import { VideoLocalComponent } from './video-list/video-local.component' | ||
7 | import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component' | ||
8 | import { VideoUserSubscriptionsComponent } from './video-list/video-user-subscriptions.component' | 6 | import { VideoUserSubscriptionsComponent } from './video-list/video-user-subscriptions.component' |
9 | import { VideosComponent } from './videos.component' | 7 | import { VideosComponent } from './videos.component' |
10 | 8 | ||
@@ -22,32 +20,35 @@ const videosRoutes: Routes = [ | |||
22 | } | 20 | } |
23 | } | 21 | } |
24 | }, | 22 | }, |
23 | |||
25 | { | 24 | { |
26 | path: 'trending', | 25 | // Old URL redirection |
27 | component: VideoTrendingComponent, | ||
28 | data: { | ||
29 | meta: { | ||
30 | title: $localize`Trending videos` | ||
31 | } | ||
32 | } | ||
33 | }, | ||
34 | { | ||
35 | path: 'most-liked', | 26 | path: 'most-liked', |
36 | redirectTo: 'trending?alg=most-liked' | 27 | redirectTo: 'trending?sort=most-liked' |
37 | }, | 28 | }, |
38 | { | 29 | { |
39 | path: 'recently-added', | 30 | matcher: (url: UrlSegment[]) => { |
40 | component: VideoRecentlyAddedComponent, | 31 | if (url.length === 1 && [ 'recently-added', 'trending', 'local' ].includes(url[0].path)) { |
32 | return { | ||
33 | consumed: url, | ||
34 | posParams: { | ||
35 | page: new UrlSegment(url[0].path, {}) | ||
36 | } | ||
37 | } | ||
38 | } | ||
39 | |||
40 | return null | ||
41 | }, | ||
42 | |||
43 | component: VideosListCommonPageComponent, | ||
41 | data: { | 44 | data: { |
42 | meta: { | ||
43 | title: $localize`Recently added videos` | ||
44 | }, | ||
45 | reuse: { | 45 | reuse: { |
46 | enabled: true, | 46 | enabled: true, |
47 | key: 'recently-added-videos-list' | 47 | key: 'videos-list' |
48 | } | 48 | } |
49 | } | 49 | } |
50 | }, | 50 | }, |
51 | |||
51 | { | 52 | { |
52 | path: 'subscriptions', | 53 | path: 'subscriptions', |
53 | canActivate: [ LoginGuard ], | 54 | canActivate: [ LoginGuard ], |
@@ -61,19 +62,6 @@ const videosRoutes: Routes = [ | |||
61 | key: 'subscription-videos-list' | 62 | key: 'subscription-videos-list' |
62 | } | 63 | } |
63 | } | 64 | } |
64 | }, | ||
65 | { | ||
66 | path: 'local', | ||
67 | component: VideoLocalComponent, | ||
68 | data: { | ||
69 | meta: { | ||
70 | title: $localize`Local videos` | ||
71 | }, | ||
72 | reuse: { | ||
73 | enabled: true, | ||
74 | key: 'local-videos-list' | ||
75 | } | ||
76 | } | ||
77 | } | 65 | } |
78 | ] | 66 | ] |
79 | } | 67 | } |