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