-
-
Notifications
You must be signed in to change notification settings - Fork 320
Expand file tree
/
Copy pathapp.routes.ts
More file actions
104 lines (101 loc) · 6.36 KB
/
Copy pathapp.routes.ts
File metadata and controls
104 lines (101 loc) · 6.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import {Routes} from '@angular/router';
import {AppLayoutComponent} from './shared/layout/layout-main/app.layout.component';
import {LoginComponent} from './shared/components/login/login.component';
import {AuthChildGuard, AuthGuard} from './core/security/auth.guard';
import {ChangePasswordComponent} from './shared/components/change-password/change-password.component';
import {SetupComponent} from './shared/components/setup/setup.component';
import {SetupGuard} from './shared/components/setup/setup.guard';
import {SetupRedirectGuard} from './shared/components/setup/setup-redirect.guard';
import {EmptyComponent} from './shared/components/empty/empty.component';
import {OidcCallbackComponent} from './core/security/oidc-callback/oidc-callback.component';
import {MainDashboardComponent} from './features/dashboard/components/main-dashboard/main-dashboard.component';
import {LoginGuard} from './shared/components/setup/login.guard';
import {BookdropGuard} from './core/security/guards/bookdrop.guard';
import {LibraryStatsGuard} from './core/security/guards/library-stats.guard';
import {UserStatsGuard} from './core/security/guards/user-stats.guard';
import {EditMetadataGuard} from './core/security/guards/edit-metdata.guard';
import {validBookBrowseScope, type BookBrowseRouteData} from './features/book/browse/book-browse-scope';
const loadBookBrowsePage = () =>
import('./features/book/browse/book-browse-page.component').then(m => m.BookBrowsePageComponent);
const loadBookBrowseFilterPage = () =>
import('./features/book/browse/book-browse-filter-page.component').then(m => m.BookBrowseFilterPageComponent);
const bookBrowseRoutes = (data: BookBrowseRouteData = {}) => [
{path: '', loadComponent: loadBookBrowsePage, ...(data.browseScope ? {data} : {})},
{path: 'filter', loadComponent: loadBookBrowseFilterPage, ...(data.browseScope ? {data} : {})},
];
export const routes: Routes = [
{
path: '',
canActivate: [SetupRedirectGuard],
pathMatch: 'full',
component: EmptyComponent
},
{
path: 'setup',
component: SetupComponent,
canActivate: [SetupGuard]
},
{path: 'oauth2-callback', component: OidcCallbackComponent},
{
path: '',
component: AppLayoutComponent,
canActivateChild: [AuthChildGuard],
children: [
{path: 'dashboard', component: MainDashboardComponent},
{path: 'all-books', children: bookBrowseRoutes()},
{path: 'settings', loadComponent: () => import('./features/settings/settings.component').then(m => m.SettingsComponent)},
{path: 'library/:libraryId/books', canActivateChild: [validBookBrowseScope], children: bookBrowseRoutes()},
{path: 'shelf/:shelfId/books', canActivateChild: [validBookBrowseScope], children: bookBrowseRoutes()},
{path: 'unshelved-books', children: bookBrowseRoutes({browseScope: 'unshelved'})},
{path: 'series', loadComponent: () => import('./features/series-browser/components/series-browser/series-browser.component').then(m => m.SeriesBrowserComponent)},
{path: 'series/:seriesName', loadComponent: () => import('./features/book/components/series-page/series-page.component').then(m => m.SeriesPageComponent)},
{path: 'authors', loadComponent: () => import('./features/author-browser/components/author-browser/author-browser.component').then(m => m.AuthorBrowserComponent)},
{path: 'author/:authorId', loadComponent: () => import('./features/author-browser/components/author-detail/author-detail.component').then(m => m.AuthorDetailComponent)},
{path: 'magic-shelf/:magicShelfId/books', canActivateChild: [validBookBrowseScope], children: bookBrowseRoutes()},
{path: 'book/:bookId', loadComponent: () => import('./features/metadata/component/book-metadata-center/book-metadata-center.component').then(m => m.BookMetadataCenterComponent)},
{path: 'bookdrop', loadComponent: () => import('./features/bookdrop/component/bookdrop-file-review/bookdrop-file-review.component').then(m => m.BookdropFileReviewComponent), canActivate: [BookdropGuard]},
{path: 'metadata-manager', loadComponent: () => import('./features/metadata/component/metadata-manager/metadata-manager.component').then(m => m.MetadataManagerComponent), canActivate: [EditMetadataGuard]},
{path: 'library-stats', loadComponent: () => import('./features/stats/component/library-stats/library-stats.component').then(m => m.LibraryStatsComponent), canActivate: [LibraryStatsGuard]},
{path: 'reading-stats', loadComponent: () => import('./features/stats/component/user-stats/user-stats.component').then(m => m.UserStatsComponent), canActivate: [UserStatsGuard]},
{path: 'notebook', loadComponent: () => import('./features/notebook/components/notebook/notebook.component').then(m => m.NotebookComponent)},
{path: 'design-system', loadComponent: () => import('./features/design-system/design-system.component').then(m => m.DesignSystemComponent)},
{path: 'design-system/form/library', loadComponent: () => import('./features/design-system/forms/library-form.component').then(m => m.LibraryFormExampleComponent)},
{path: 'design-system/form/device', loadComponent: () => import('./features/design-system/forms/device-form.component').then(m => m.DeviceFormExampleComponent)},
{path: 'design-system/form/everything', loadComponent: () => import('./features/design-system/forms/everything-form.component').then(m => m.EverythingFormExampleComponent)},
]
},
{
path: 'pdf-reader/book/:bookId',
loadComponent: () => import('./features/readers/pdf-reader/pdf-reader.component').then(m => m.PdfReaderComponent),
canActivate: [AuthGuard]
},
{
path: 'ebook-reader/book/:bookId',
loadComponent: () => import('./features/readers/ebook-reader/ebook-reader.component').then(m => m.EbookReaderComponent),
canActivate: [AuthGuard]
},
{
path: 'cbx-reader/book/:bookId',
loadComponent: () => import('./features/readers/cbx-reader/cbx-reader.component').then(m => m.CbxReaderComponent),
canActivate: [AuthGuard]
},
{
path: 'audiobook-player/book/:bookId',
loadComponent: () => import('./features/readers/audiobook-player/audiobook-player.component').then(m => m.AudiobookPlayerComponent),
canActivate: [AuthGuard]
},
{
path: 'login',
component: LoginComponent,
canActivate: [LoginGuard]
},
{
path: 'change-password',
component: ChangePasswordComponent
},
{
path: '**',
redirectTo: 'login',
pathMatch: 'full'
}
];