@@ -4,10 +4,12 @@ import { Box } from "@mui/material";
44
55import { Background , ScrollToManage } from "@atoms" ;
66import {
7+ BUDGET_DISCUSSION_PATHS ,
78 CONNECTED_NAV_ITEMS ,
89 DRAWER_WIDTH ,
910 OUTCOMES_PATHS ,
1011 PATHS ,
12+ PDF_PATHS ,
1113} from "@consts" ;
1214import { useCardano } from "@context" ;
1315import { useScreenDimension , useTranslation } from "@hooks" ;
@@ -34,18 +36,37 @@ export const Dashboard = () => {
3436 return outcomesNavItem ?? "" ;
3537 }
3638
39+ if ( path . startsWith ( BUDGET_DISCUSSION_PATHS . budgetDiscussion ) ) {
40+ const budgetNavItem = findNavItem (
41+ CONNECTED_NAV_ITEMS ,
42+ BUDGET_DISCUSSION_PATHS . budgetDiscussion ,
43+ ) ;
44+
45+ return budgetNavItem ?? "" ;
46+ }
47+
48+ if ( path . startsWith ( PDF_PATHS . proposalDiscussion ) ) {
49+ const proposalDiscussionNavItem = findNavItem (
50+ CONNECTED_NAV_ITEMS ,
51+ PDF_PATHS . proposalDiscussion ,
52+ ) ;
53+
54+ return proposalDiscussionNavItem ?? "" ;
55+ }
3756 return findNavItem ( CONNECTED_NAV_ITEMS , path ) ?? "" ;
3857 } ;
3958
40- const findNavItem = ( items : NavItem [ ] , targetPath : string ) : string | null => (
41- items . reduce < string | null > ( ( result , item ) => (
42- result ?? (
43- targetPath === item . navTo
59+ const findNavItem = ( items : NavItem [ ] , targetPath : string ) : string | null =>
60+ items . reduce < string | null > (
61+ ( result , item ) =>
62+ result ??
63+ ( targetPath === item . navTo
4464 ? item . label
45- : ( item . childNavItems ? findNavItem ( item . childNavItems , targetPath ) : null )
46- )
47- ) , null )
48- ) ;
65+ : item . childNavItems
66+ ? findNavItem ( item . childNavItems , targetPath )
67+ : null ) ,
68+ null ,
69+ ) ;
4970
5071 useEffect ( ( ) => {
5172 if ( divRef . current && pathname !== PATHS . dashboardGovernanceActions ) {
0 commit comments