refactor(routes): update xtream routes and move into a separate file

This commit is contained in:
4gray committed 2024-12-24 00:57:26 +01:00
1 parent b70d87faf2
commit 687880e4a3
2 files changed
+105 -74

No files matched your search

+4 -74
View File
@@ -1,7 +1,7 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { isTauri } from '@tauri-apps/api/core';
import { XtreamStore } from './xtream-tauri/xtream.store';
import { xtreamRoutes } from './xtream-tauri/xtream.routes';
const routes: Routes = [
{
@@ -38,75 +38,7 @@ const routes: Routes = [
),
},
...(isTauri()
? [
{
path: 'xtreams/:id',
loadComponent: () =>
import(
'./xtream-tauri/xtream-main-container.component'
).then((c) => c.XtreamMainContainerComponent),
providers: [XtreamStore],
children: [
{
path: '',
loadComponent: () =>
import(
'./xtream-tauri/category-content-view/category-content-view.component'
).then((c) => c.CategoryContentViewComponent),
},
{
path: 'favorites',
loadComponent: () =>
import(
'./xtream-tauri/favorites/favorites.component'
).then((c) => c.FavoritesComponent),
},
{
path: 'recent',
loadComponent: () =>
import(
'./xtream-tauri/recently-viewed/recently-viewed.component'
).then((c) => c.RecentlyViewedComponent),
},
{
path: 'search',
loadComponent: () =>
import(
'./xtream-tauri/search-results/search-results.component'
).then((c) => c.SearchResultsComponent),
},
{
path: 'live',
loadComponent: () =>
import(
'./xtream-tauri/live-stream-layout/live-stream-layout.component'
).then((c) => c.LiveStreamLayoutComponent),
},
{
path: ':categoryId',
loadComponent: () =>
import(
'./xtream-tauri/category-content-view/category-content-view.component'
).then((c) => c.CategoryContentViewComponent),
},
{
path: ':categoryId/vod/:vodId',
loadComponent: () =>
import(
'./xtream-tauri/vod-details/vod-details.component'
).then((c) => c.VodDetailsComponent),
},
{
path: ':categoryId/series/:serialId',
loadComponent: () =>
import(
'./xtream-tauri/serial-details/serial-details.component'
).then((c) => c.SerialDetailsComponent),
},
],
},
]
? xtreamRoutes
: [
{
path: 'xtreams/:id',
@@ -131,11 +63,9 @@ const routes: Routes = [
@NgModule({
imports: [
RouterModule.forRoot(
routes /* {
RouterModule.forRoot(routes, {
enableTracing: true,
} */
),
}),
],
exports: [RouterModule],
})
+101
View File
@@ -0,0 +1,101 @@
import { Route } from '@angular/router';
export const xtreamRoutes: Route[] = [
{
path: 'xtreams/:id',
loadComponent: () =>
import('./xtream-shell/xtream-shell.component').then(
(c) => c.XtreamShellComponent
),
children: [
{
path: '',
redirectTo: 'vod',
pathMatch: 'full',
},
{
path: 'live',
loadComponent: () =>
import(
'./live-stream-layout/live-stream-layout.component'
).then((c) => c.LiveStreamLayoutComponent),
children: [
{
path: ':categoryId',
loadComponent: () =>
import(
'./live-stream-layout/live-stream-layout.component'
).then((c) => c.LiveStreamLayoutComponent),
},
],
},
{
path: 'vod',
loadComponent: () =>
import('./xtream-main-container.component').then(
(c) => c.XtreamMainContainerComponent
),
children: [
{
path: ':categoryId',
loadComponent: () =>
import(
'./category-content-view/category-content-view.component'
).then((c) => c.CategoryContentViewComponent),
},
{
path: ':categoryId/:vodId',
loadComponent: () =>
import('./vod-details/vod-details.component').then(
(c) => c.VodDetailsComponent
),
},
],
},
{
path: 'series',
loadComponent: () =>
import('./xtream-main-container.component').then(
(c) => c.XtreamMainContainerComponent
),
children: [
{
path: ':categoryId',
loadComponent: () =>
import(
'./category-content-view/category-content-view.component'
).then((c) => c.CategoryContentViewComponent),
},
{
path: ':categoryId/:serialId',
loadComponent: () =>
import(
'./serial-details/serial-details.component'
).then((c) => c.SerialDetailsComponent),
},
],
},
{
path: 'favorites',
loadComponent: () =>
import('./favorites/favorites.component').then(
(c) => c.FavoritesComponent
),
},
{
path: 'recent',
loadComponent: () =>
import('./recently-viewed/recently-viewed.component').then(
(c) => c.RecentlyViewedComponent
),
},
{
path: 'search',
loadComponent: () =>
import('./search-results/search-results.component').then(
(c) => c.SearchResultsComponent
),
},
],
},
];