]>
Commit | Line | Data |
---|---|---|
1 | import { NgModule } from '@angular/core' | |
2 | import { RouterModule, Routes } from '@angular/router' | |
3 | import { LoginGuard } from '@app/core' | |
4 | import { MetaGuard } from '@ngx-meta/core' | |
5 | import { VideoTrendingComponent } from './video-list' | |
6 | import { VideoOverviewComponent } from './video-list/overview/video-overview.component' | |
7 | import { VideoLocalComponent } from './video-list/video-local.component' | |
8 | import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component' | |
9 | import { VideoUserSubscriptionsComponent } from './video-list/video-user-subscriptions.component' | |
10 | import { VideosComponent } from './videos.component' | |
11 | ||
12 | const videosRoutes: Routes = [ | |
13 | { | |
14 | path: '', | |
15 | component: VideosComponent, | |
16 | canActivateChild: [ MetaGuard ], | |
17 | children: [ | |
18 | { | |
19 | path: 'overview', | |
20 | component: VideoOverviewComponent, | |
21 | data: { | |
22 | meta: { | |
23 | title: $localize`Discover videos` | |
24 | } | |
25 | } | |
26 | }, | |
27 | { | |
28 | path: 'trending', | |
29 | component: VideoTrendingComponent, | |
30 | data: { | |
31 | meta: { | |
32 | title: $localize`Trending videos` | |
33 | } | |
34 | } | |
35 | }, | |
36 | { | |
37 | path: 'most-liked', | |
38 | redirectTo: 'trending?alg=most-liked' | |
39 | }, | |
40 | { | |
41 | path: 'recently-added', | |
42 | component: VideoRecentlyAddedComponent, | |
43 | data: { | |
44 | meta: { | |
45 | title: $localize`Recently added videos` | |
46 | }, | |
47 | reuse: { | |
48 | enabled: true, | |
49 | key: 'recently-added-videos-list' | |
50 | } | |
51 | } | |
52 | }, | |
53 | { | |
54 | path: 'subscriptions', | |
55 | canActivate: [ LoginGuard ], | |
56 | component: VideoUserSubscriptionsComponent, | |
57 | data: { | |
58 | meta: { | |
59 | title: $localize`Subscriptions` | |
60 | }, | |
61 | reuse: { | |
62 | enabled: true, | |
63 | key: 'subscription-videos-list' | |
64 | } | |
65 | } | |
66 | }, | |
67 | { | |
68 | path: 'local', | |
69 | component: VideoLocalComponent, | |
70 | data: { | |
71 | meta: { | |
72 | title: $localize`Local videos` | |
73 | }, | |
74 | reuse: { | |
75 | enabled: true, | |
76 | key: 'local-videos-list' | |
77 | } | |
78 | } | |
79 | }, | |
80 | { | |
81 | path: 'upload', | |
82 | loadChildren: () => import('@app/+videos/+video-edit/video-add.module').then(m => m.VideoAddModule), | |
83 | data: { | |
84 | meta: { | |
85 | title: $localize`Upload a video` | |
86 | } | |
87 | } | |
88 | }, | |
89 | { | |
90 | path: 'update/:uuid', | |
91 | loadChildren: () => import('@app/+videos/+video-edit/video-update.module').then(m => m.VideoUpdateModule), | |
92 | data: { | |
93 | meta: { | |
94 | title: $localize`Edit a video` | |
95 | } | |
96 | } | |
97 | }, | |
98 | { | |
99 | path: 'watch', | |
100 | loadChildren: () => import('@app/+videos/+video-watch/video-watch.module').then(m => m.VideoWatchModule), | |
101 | data: { | |
102 | preload: 3000 | |
103 | } | |
104 | } | |
105 | ] | |
106 | } | |
107 | ] | |
108 | ||
109 | @NgModule({ | |
110 | imports: [ RouterModule.forChild(videosRoutes) ], | |
111 | exports: [ RouterModule ] | |
112 | }) | |
113 | export class VideosRoutingModule {} |