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'; const loadBookBrowserComponent = () => import('./features/book/components/book-browser/book-browser.component').then(m => m.BookBrowserComponent); 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', loadComponent: loadBookBrowserComponent}, {path: 'settings', loadComponent: () => import('./features/settings/settings.component').then(m => m.SettingsComponent)}, {path: 'library/:libraryId/books', loadComponent: loadBookBrowserComponent}, {path: 'shelf/:shelfId/books', loadComponent: loadBookBrowserComponent}, {path: 'unshelved-books', loadComponent: loadBookBrowserComponent}, {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', loadComponent: loadBookBrowserComponent}, {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: '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' } ];