@@ -16,7 +16,7 @@ async function loadTabOptions() {
1616 "/email/administration/exchange-retention" ,
1717 "/cipp/custom-data" ,
1818 "/cipp/super-admin" ,
19- "/tenant/standards/list-standards " ,
19+ "/tenant/standards" ,
2020 "/tenant/manage" ,
2121 "/tenant/administration/applications" ,
2222 "/tenant/administration/tenants" ,
@@ -499,6 +499,46 @@ export const CippBreadcrumbNav = () => {
499499 return result ;
500500 } ;
501501
502+ // Check if a path is valid and return its title from navigation or tabs
503+ const getPathInfo = ( path ) => {
504+ if ( ! path ) return { isValid : false , title : null } ;
505+
506+ const normalizedPath = path . replace ( / \/ $ / , "" ) ;
507+
508+ // Helper function to recursively search menu items
509+ const findInMenu = ( items ) => {
510+ for ( const item of items ) {
511+ if ( item . path ) {
512+ const normalizedItemPath = item . path . replace ( / \/ $ / , "" ) ;
513+ if ( normalizedItemPath === normalizedPath ) {
514+ return { isValid : true , title : item . title } ;
515+ }
516+ }
517+ if ( item . items && item . items . length > 0 ) {
518+ const found = findInMenu ( item . items ) ;
519+ if ( found . isValid ) {
520+ return found ;
521+ }
522+ }
523+ }
524+ return { isValid : false , title : null } ;
525+ } ;
526+
527+ // Check if path exists in navigation
528+ const menuResult = findInMenu ( nativeMenuItems ) ;
529+ if ( menuResult . isValid ) {
530+ return menuResult ;
531+ }
532+
533+ // Check if path exists in tab options
534+ const matchingTab = tabOptions . find ( ( tab ) => tab . path . replace ( / \/ $ / , "" ) === normalizedPath ) ;
535+ if ( matchingTab ) {
536+ return { isValid : true , title : matchingTab . title } ;
537+ }
538+
539+ return { isValid : false , title : null } ;
540+ } ;
541+
502542 // Handle click for hierarchical breadcrumbs
503543 const handleHierarchicalClick = ( path , query ) => {
504544 if ( path ) {
@@ -580,6 +620,9 @@ export const CippBreadcrumbNav = () => {
580620 >
581621 { breadcrumbs . map ( ( crumb , index ) => {
582622 const isLast = index === breadcrumbs . length - 1 ;
623+ const pathInfo = getPathInfo ( crumb . path ) ;
624+ // Use title from nav/tabs if available, otherwise use the crumb's title
625+ const displayTitle = pathInfo . title || crumb . title ;
583626
584627 // Items without paths (headers/groups) - show as text
585628 if ( ! crumb . path ) {
@@ -590,31 +633,46 @@ export const CippBreadcrumbNav = () => {
590633 variant = "subtitle2"
591634 sx = { { fontWeight : isLast ? 500 : 400 } }
592635 >
593- { crumb . title }
636+ { displayTitle }
594637 </ Typography >
595638 ) ;
596639 }
597640
598- // All items with paths are clickable, including the last one
599- return (
600- < Link
601- key = { index }
602- component = "button"
603- variant = "subtitle2"
604- onClick = { ( ) => handleHierarchicalClick ( crumb . path , crumb . query ) }
605- sx = { {
606- textDecoration : "none" ,
607- color : isLast ? "text.primary" : "text.secondary" ,
608- fontWeight : isLast ? 500 : 400 ,
609- "&:hover" : {
610- textDecoration : "underline" ,
611- color : "primary.main" ,
612- } ,
613- } }
614- >
615- { crumb . title }
616- </ Link >
617- ) ;
641+ // Items with valid paths are clickable
642+ // Items with invalid paths (fallback) are shown as plain text
643+ if ( pathInfo . isValid ) {
644+ return (
645+ < Link
646+ key = { index }
647+ component = "button"
648+ variant = "subtitle2"
649+ onClick = { ( ) => handleHierarchicalClick ( crumb . path , crumb . query ) }
650+ sx = { {
651+ textDecoration : "none" ,
652+ color : isLast ? "text.primary" : "text.secondary" ,
653+ fontWeight : isLast ? 500 : 400 ,
654+ "&:hover" : {
655+ textDecoration : "underline" ,
656+ color : "primary.main" ,
657+ } ,
658+ } }
659+ >
660+ { displayTitle }
661+ </ Link >
662+ ) ;
663+ } else {
664+ // Invalid path - show as text only
665+ return (
666+ < Typography
667+ key = { index }
668+ color = { isLast ? "text.primary" : "text.secondary" }
669+ variant = "subtitle2"
670+ sx = { { fontWeight : isLast ? 500 : 400 } }
671+ >
672+ { displayTitle }
673+ </ Typography >
674+ ) ;
675+ }
618676 } ) }
619677 </ Breadcrumbs >
620678 </ Box >
0 commit comments