ac9cf4cfd7faf0f1f8f0dc383967020a9ee8527c
[oweals/peertube.git] / client / src / app / +my-account / my-account-routing.module.ts
1 import { NgModule } from '@angular/core'
2 import { RouterModule, Routes } from '@angular/router'
3 import { MetaGuard } from '@ngx-meta/core'
4 import { LoginGuard } from '../core'
5 import { MyAccountBlocklistComponent } from './my-account-blocklist/my-account-blocklist.component'
6 import { MyAccountServerBlocklistComponent } from './my-account-blocklist/my-account-server-blocklist.component'
7 import { MyAccountHistoryComponent } from './my-account-history/my-account-history.component'
8 import { MyAccountNotificationsComponent } from './my-account-notifications/my-account-notifications.component'
9 import { MyAccountOwnershipComponent } from './my-account-ownership/my-account-ownership.component'
10 import { MyAccountSettingsComponent } from './my-account-settings/my-account-settings.component'
11 import { MyAccountSubscriptionsComponent } from './my-account-subscriptions/my-account-subscriptions.component'
12 import { MyAccountVideoImportsComponent } from './my-account-video-imports/my-account-video-imports.component'
13 import { MyAccountVideoPlaylistCreateComponent } from './my-account-video-playlists/my-account-video-playlist-create.component'
14 import { MyAccountVideoPlaylistElementsComponent } from './my-account-video-playlists/my-account-video-playlist-elements.component'
15 import { MyAccountVideoPlaylistUpdateComponent } from './my-account-video-playlists/my-account-video-playlist-update.component'
16 import { MyAccountVideoPlaylistsComponent } from './my-account-video-playlists/my-account-video-playlists.component'
17 import { MyAccountVideosComponent } from './my-account-videos/my-account-videos.component'
18 import { MyAccountComponent } from './my-account.component'
19
20 const myAccountRoutes: Routes = [
21   {
22     path: '',
23     component: MyAccountComponent,
24     canActivateChild: [ MetaGuard, LoginGuard ],
25     children: [
26       {
27         path: '',
28         redirectTo: 'settings',
29         pathMatch: 'full'
30       },
31       {
32         path: 'settings',
33         component: MyAccountSettingsComponent,
34         data: {
35           meta: {
36             title: 'Account settings'
37           }
38         }
39       },
40
41       {
42         path: 'video-channels',
43         loadChildren: () => {
44           return import('./+my-account-video-channels/my-account-video-channels.module')
45             .then(m => m.MyAccountVideoChannelsModule)
46         }
47       },
48
49       {
50         path: 'video-playlists',
51         component: MyAccountVideoPlaylistsComponent,
52         data: {
53           meta: {
54             title: 'Account playlists'
55           }
56         }
57       },
58       {
59         path: 'video-playlists/create',
60         component: MyAccountVideoPlaylistCreateComponent,
61         data: {
62           meta: {
63             title: 'Create new playlist'
64           }
65         }
66       },
67       {
68         path: 'video-playlists/:videoPlaylistId',
69         component: MyAccountVideoPlaylistElementsComponent,
70         data: {
71           meta: {
72             title: 'Playlist elements'
73           }
74         }
75       },
76       {
77         path: 'video-playlists/update/:videoPlaylistId',
78         component: MyAccountVideoPlaylistUpdateComponent,
79         data: {
80           meta: {
81             title: 'Update playlist'
82           }
83         }
84       },
85
86       {
87         path: 'videos',
88         component: MyAccountVideosComponent,
89         data: {
90           meta: {
91             title: 'Account videos'
92           },
93           reuse: {
94             enabled: true,
95             key: 'my-account-videos-list'
96           }
97         }
98       },
99       {
100         path: 'video-imports',
101         component: MyAccountVideoImportsComponent,
102         data: {
103           meta: {
104             title: 'Account video imports'
105           }
106         }
107       },
108       {
109         path: 'subscriptions',
110         component: MyAccountSubscriptionsComponent,
111         data: {
112           meta: {
113             title: 'Account subscriptions'
114           }
115         }
116       },
117       {
118         path: 'ownership',
119         component: MyAccountOwnershipComponent,
120         data: {
121           meta: {
122             title: 'Ownership changes'
123           }
124         }
125       },
126       {
127         path: 'blocklist/accounts',
128         component: MyAccountBlocklistComponent,
129         data: {
130           meta: {
131             title: 'Muted accounts'
132           }
133         }
134       },
135       {
136         path: 'blocklist/servers',
137         component: MyAccountServerBlocklistComponent,
138         data: {
139           meta: {
140             title: 'Muted servers'
141           }
142         }
143       },
144       {
145         path: 'history/videos',
146         component: MyAccountHistoryComponent,
147         data: {
148           meta: {
149             title: 'Videos history'
150           },
151           reuse: {
152             enabled: true,
153             key: 'my-videos-history-list'
154           }
155         }
156       },
157       {
158         path: 'notifications',
159         component: MyAccountNotificationsComponent,
160         data: {
161           meta: {
162             title: 'Notifications'
163           }
164         }
165       }
166     ]
167   }
168 ]
169
170 @NgModule({
171   imports: [ RouterModule.forChild(myAccountRoutes) ],
172   exports: [ RouterModule ]
173 })
174 export class MyAccountRoutingModule {}