From 687880e4a3ac9eeb0feeedc810c61aade59155f3 Mon Sep 17 00:00:00 2001 From: 4gray Date: Tue, 24 Dec 2024 00:57:26 +0100 Subject: [PATCH] refactor(routes): update xtream routes and move into a separate file --- src/app/app-routing.module.ts | 78 +------------------- src/app/xtream-tauri/xtream.routes.ts | 101 ++++++++++++++++++++++++++ 2 files changed, 105 insertions(+), 74 deletions(-) create mode 100644 src/app/xtream-tauri/xtream.routes.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index cd6100c94..178375d6d 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -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], }) diff --git a/src/app/xtream-tauri/xtream.routes.ts b/src/app/xtream-tauri/xtream.routes.ts new file mode 100644 index 000000000..591297b57 --- /dev/null +++ b/src/app/xtream-tauri/xtream.routes.ts @@ -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 + ), + }, + ], + }, +];