Skip to content

Commit

Permalink
Modify Header.tsx to include conditional Nav menu items for regionalA…
Browse files Browse the repository at this point in the history
…dmin user type
  • Loading branch information
nickviola committed Mar 19, 2024
1 parent a74ab95 commit 8eb79a9
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions frontend/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,16 +247,16 @@ const HeaderNoCtx: React.FC<ContextType> = (props) => {
exact: false
},

/*
/*
Hiding Feeds page until finished
{ title: 'Feeds',
path: '/feeds',
users: ALL_USERS,
exact: false
{ title: 'Feeds',
path: '/feeds',
users: ALL_USERS,
exact: false
},*/

/*
Hiding Reports page until finished
/*
Hiding Reports page until finished
{
title: 'Reports',
path: '/reports',
Expand Down Expand Up @@ -361,7 +361,22 @@ const HeaderNoCtx: React.FC<ContextType> = (props) => {
<NavItem key={item.title.toString()} {...item} />
));

const userRegistrationNavItem = {
title: 'User Registration',
path: '/region-admin-dasboard',
users: ALL_USERS,
exact: true
};

const getConditionalNavItems = () => {
if (user?.userType === 'regionalAdmin') {
userMenu.nested?.push(userRegistrationNavItem);
userItemsSmall.push(userRegistrationNavItem);
}
};

const navItemsToUse = () => {
getConditionalNavItems();
if (isSmall) {
return userItemsSmall;
} else {
Expand Down

0 comments on commit 8eb79a9

Please sign in to comment.