feat(routes): implement workspace layout for routing and enhance navigation structure

This commit is contained in:
4gray committed 2026-02-24 19:18:27 +01:00
1 parent 22c1e5462c
commit edfcffb7d9
1 file changed
+70 -16
+70 -16
View File
@@ -1,10 +1,76 @@
import { Routes } from '@angular/router';
import { Route, Routes } from '@angular/router';
import { stalkerRoutes } from './stalker/stalker.routes';
import { xtreamRoutes } from './xtream-electron/xtream.routes';
function withWorkspaceLayout(routes: Route[]): Route[] {
return routes.map((route) => ({
...route,
data: {
...(route.data || {}),
layout: 'workspace',
},
children: route.children
? withWorkspaceLayout(route.children)
: undefined,
}));
}
export const routes: Routes = [
{
path: '',
pathMatch: 'full',
redirectTo: 'workspace',
},
{
path: 'workspace',
loadComponent: () =>
import('./workspace/workspace-shell.component').then(
(c) => c.WorkspaceShellComponent
),
children: [
{
path: '',
pathMatch: 'full',
redirectTo: 'dashboard',
},
{
path: 'dashboard',
loadComponent: () =>
import('workspace-dashboard-feature').then(
(c) => c.WorkspaceDashboardComponent
),
},
{
path: 'sources',
loadComponent: () =>
import('./workspace/workspace-sources.component').then(
(c) => c.WorkspaceSourcesComponent
),
},
{
path: 'playlists/:id',
data: {
layout: 'workspace',
},
loadComponent: () =>
import('./home/video-player/video-player.component').then(
(c) => c.VideoPlayerComponent
),
},
...withWorkspaceLayout(xtreamRoutes),
...withWorkspaceLayout(stalkerRoutes),
{
path: 'settings',
data: { layout: 'workspace' },
loadComponent: () =>
import('./settings/settings.component').then(
(c) => c.SettingsComponent
),
},
],
},
{
path: 'home',
loadComponent: () =>
import('./home/home.component').then((c) => c.HomeComponent),
},
@@ -31,22 +97,10 @@ export const routes: Routes = [
},
{
path: 'settings',
loadComponent: () =>
import('./settings/settings.component').then(
(c) => c.SettingsComponent
),
redirectTo: '/workspace/settings',
pathMatch: 'full',
},
...(window.electron
? xtreamRoutes
: [
{
path: 'xtreams/:id',
loadComponent: () =>
import('./xtream/xtream-main-container.component').then(
(c) => c.XtreamMainContainerComponent
),
},
]),
...xtreamRoutes,
{
path: 'portals/:id',
loadComponent: () =>