Kavita/UI/Web/src/app/app-routing.module.ts
Joseph Milazzo b38a26f92b
Angular 14 (#1420)
* Updated to Angular 14

* Fixed all new tslint issues

* Fixed a routing bug for Angular 14

* Updated ngBootstrap and bootstrap. Fixed side nav item not highlighting on route change

* Refactored how default dark styles are done

* Migrated everything to a typed form

* Bump versions by dotnet-bump-version.

* Fixed a regression where click areas need an explicit z-index

* Cleanup some css

* Bumped docnet back to the alpha which has our downstream fixes

* Updated dependencies to later versions. Mainly just NetVips with some archive fixes.

* Fixed broken unit tests (due to some fixes in SharpCompress that changed byte arrays, but not visible quality)
2022-08-09 06:02:41 -07:00

90 lines
3.2 KiB
TypeScript

import { NgModule } from '@angular/core';
import { Routes, RouterModule, PreloadAllModules } from '@angular/router';
import { AuthGuard } from './_guards/auth.guard';
import { LibraryAccessGuard } from './_guards/library-access.guard';
import { AdminGuard } from './_guards/admin.guard';
const routes: Routes = [
{
path: 'admin',
canActivate: [AdminGuard],
loadChildren: () => import('./admin/admin.module').then(m => m.AdminModule)
},
{
path: 'collections',
canActivate: [AuthGuard],
loadChildren: () => import('./collections/collections.module').then(m => m.CollectionsModule)
},
{
path: 'preferences',
canActivate: [AuthGuard],
loadChildren: () => import('./user-settings/user-settings.module').then(m => m.UserSettingsModule)
},
{
path: 'lists',
canActivate: [AuthGuard],
loadChildren: () => import('./reading-list/reading-list.module').then(m => m.ReadingListModule)
},
{
path: 'registration',
loadChildren: () => import('../app/registration/registration.module').then(m => m.RegistrationModule)
},
{
path: 'announcements',
loadChildren: () => import('../app/announcements/announcements.module').then(m => m.AnnouncementsModule)
},
{
path: 'bookmarks',
loadChildren: () => import('../app/bookmark/bookmark.module').then(m => m.BookmarkModule)
},
{
path: 'all-series',
loadChildren: () => import('../app/all-series/all-series.module').then(m => m.AllSeriesModule)
},
{
path: 'libraries',
loadChildren: () => import('../app/dashboard/dashboard.module').then(m => m.DashboardModule)
},
{
path: 'want-to-read',
loadChildren: () => import('../app/want-to-read/want-to-read.module').then(m => m.WantToReadModule)
},
{
path: 'library',
runGuardsAndResolvers: 'always',
canActivate: [AuthGuard, LibraryAccessGuard],
children: [
{
path: ':libraryId',
pathMatch: 'full',
loadChildren: () => import('../app/library-detail/library-detail.module').then(m => m.LibraryDetailModule)
},
{
path: ':libraryId/series/:seriesId',
pathMatch: 'full',
loadChildren: () => import('../app/series-detail/series-detail.module').then(m => m.SeriesDetailModule)
},
{
path: ':libraryId/series/:seriesId/manga',
loadChildren: () => import('../app/manga-reader/manga-reader.module').then(m => m.MangaReaderModule)
},
{
path: ':libraryId/series/:seriesId/book',
loadChildren: () => import('../app/book-reader/book-reader.module').then(m => m.BookReaderModule)
},
{
path: ':libraryId/series/:seriesId/pdf',
loadChildren: () => import('../app/pdf-reader/pdf-reader.module').then(m => m.PdfReaderModule)
},
]
},
{path: 'login', loadChildren: () => import('../app/registration/registration.module').then(m => m.RegistrationModule)},
{path: '**', pathMatch: 'full', redirectTo: 'libraries'},
{path: '**', pathMatch: 'prefix', redirectTo: 'libraries'},
];
@NgModule({
imports: [RouterModule.forRoot(routes, {scrollPositionRestoration: 'enabled', preloadingStrategy: PreloadAllModules})],
exports: [RouterModule]
})
export class AppRoutingModule { }