feat: update dashboard routing and sidebar navigation for improved structure and clarity

This commit is contained in:
Marek Lesko
2025-10-30 17:30:47 +00:00
parent e1bb591a38
commit 1cb5c3d03a
5 changed files with 211 additions and 216 deletions

View File

@@ -25,6 +25,7 @@ export const routes: Routes = [
import('./pages/dashboard/dashboard.routes').then(
(m) => m.DashboardsRoutes
),
data: { title: 'Hlavná stránka' }
},
// {
// path: 'forms',

View File

@@ -6,36 +6,36 @@ export const navItems: NavItem[] = [
},
{
displayName: 'Hlavná stránka',
iconName: 'home',
iconName: 'device-desktop',
route: 'dashboard',
// children: [
// {
// displayName: 'Analytical',
// iconName: 'point',
// route: 'dashboards/dashboard1',
// },
// {
// displayName: 'eCommerce',
// iconName: 'point',
// route: 'dashboards/dashboard2',
// },
// ],
children: [
{
displayName: 'Administrácia',
iconName: 'tool',
route: 'dashboards/admin',
},
{
displayName: 'Novinky',
iconName: 'news',
route: 'dashboards/news',
},
],
},
{
displayName: 'Domov',
iconName: 'home',
route: 'dashboard/home',
children: [
{
displayName: 'Deti',
iconName: 'baby-carriage',
route: 'dashboard/home/children',
},
{
displayName: 'Rodičia',
iconName: 'car-suv',
route: 'dashboard/home/parents',
},
// {
// displayName: 'Frontend pages',
// iconName: 'app-window',
// route: 'front-pages',
// children: [
// {
// displayName: 'Home Page',
// iconName: 'point',
// route: 'front-pages/homepage',
// } ,
// {
// displayName: 'About Us',
// iconName: 'point',
// route: 'front-pages/about',
// } ,
// {
// displayName: 'Blog',
// iconName: 'point',
@@ -61,24 +61,24 @@ export const navItems: NavItem[] = [
// iconName: 'point',
// route: 'front-pages/contact',
// }
// ]
// },
// {
// displayName: 'Apps',
// iconName: 'apps',
// route: 'apps',
// ddType: '',
// children: [
// {
// displayName: 'Chat',
// iconName: 'point',
// route: 'apps/chat',
// },
// {
// displayName: 'Calendar',
// iconName: 'point',
// route: 'apps/calendar',
// },
]
},
{
displayName: 'Škola',
iconName: 'school',
route: 'dashboard/school',
ddType: '',
children: [
{
displayName: 'Učitelia',
iconName: 'math',
route: 'dashboard/school/teachers',
},
{
displayName: 'Intervenčný tím',
iconName: 'lifebuoy',
route: 'dashboard/school/intervention-team',
},
// {
// displayName: 'Email',
// iconName: 'point',
@@ -200,8 +200,8 @@ export const navItems: NavItem[] = [
// },
// ],
// },
// ],
// },
],
},
// {
// displayName: 'Ui',
// iconName: 'components',

View File

@@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { Title } from '@angular/platform-browser';
import { RouterModule } from '@angular/router';
import { Router, NavigationEnd, ActivatedRoute, Data } from '@angular/router';
import { filter, map, mergeMap } from 'rxjs/operators';
import { filter, map, mergeMap, tap } from 'rxjs/operators';
import { TablerIconsModule } from 'angular-tabler-icons';
@Component({
@@ -22,22 +22,19 @@ export class AppBreadcrumbComponent {
) {
this.myurl = this.router.url.slice(1).split('/');
this.router.events
.pipe(filter((event) => event instanceof NavigationEnd))
.pipe(map(() => this.activatedRoute))
.pipe(
filter((event) => event instanceof NavigationEnd),
map(() => this.activatedRoute),
map((route) => {
while (route.firstChild) {
route = route.firstChild;
}
return route;
})
)
.pipe(filter((route) => route.outlet === 'primary'))
.pipe(mergeMap((route) => route.data))
// tslint:disable-next-line - Disables all
}),
filter((route) => route.outlet === 'primary'),
mergeMap((route) => route.data))
.subscribe((event) => {
// tslint:disable-next-line - Disables all
this.titleService.setTitle(event['title'] + ' - Angular 20');
this.titleService.setTitle(event['title']);
this.pageInfo = event;
});
}

View File

@@ -23,7 +23,7 @@ export class CallbackComponent {
.then(_ => {
console.log('Login successful');
this.profile = this.as.profile;
this.router.navigate(['/dashboard']);
this.router.navigate(['/dashboard/main']);
}).catch(err => {
console.error('Error handling callback', err);
});

View File

@@ -9,15 +9,12 @@ export const DashboardsRoutes: Routes = [
path: '',
children: [
{
path: 'dashboard',
path: 'main',
component: AppDashboardComponent,
canActivate: [authGuard],
data: {
title: 'Analytical',
urls: [
{ title: 'Dashboard', url: '/dashboard/main' },
{ title: 'Analytical' },
]
title: 'Hlavná stránka',
breadcrumb: 'Hlavná stránka'
}
}
]