Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify Header.tsx to include conditional nav items for regionalAdmin User Type #99

Merged
merged 2 commits into from
Mar 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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?.unshift(userRegistrationNavItem);
userItemsSmall.unshift(userRegistrationNavItem);
}
};

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