]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/+videos/videos-routing.module.ts
Force live type specification in first step
[github/Chocobozzz/PeerTube.git] / client / src / app / +videos / videos-routing.module.ts
1 import { NgModule } from '@angular/core'
2 import { RouterModule, Routes, UrlSegment } from '@angular/router'
3 import { LoginGuard } from '@app/core'
4 import { VideosListCommonPageComponent } from './video-list'
5 import { VideoOverviewComponent } from './video-list/overview/video-overview.component'
6 import { VideoUserSubscriptionsComponent } from './video-list/video-user-subscriptions.component'
7 import { VideosComponent } from './videos.component'
8
9 const videosRoutes: Routes = [
10 {
11 path: '',
12 component: VideosComponent,
13 children: [
14 {
15 path: 'overview',
16 component: VideoOverviewComponent,
17 data: {
18 meta: {
19 title: $localize`Discover videos`
20 }
21 }
22 },
23
24 {
25 // Old URL redirection
26 path: 'most-liked',
27 redirectTo: 'trending?sort=most-liked'
28 },
29 {
30 matcher: (url: UrlSegment[]) => {
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,
44 data: {
45 reuse: {
46 enabled: true,
47 key: 'videos-list'
48 }
49 }
50 },
51
52 {
53 path: 'subscriptions',
54 canActivate: [ LoginGuard ],
55 component: VideoUserSubscriptionsComponent,
56 data: {
57 meta: {
58 title: $localize`Subscriptions`
59 },
60 reuse: {
61 enabled: true,
62 key: 'subscription-videos-list'
63 }
64 }
65 }
66 ]
67 }
68 ]
69
70 @NgModule({
71 imports: [ RouterModule.forChild(videosRoutes) ],
72 exports: [ RouterModule ]
73 })
74 export class VideosRoutingModule {}