Skip to content

Commit

Permalink
Merge pull request #2655 from objectcomputing/bugfix-2652/menu-items
Browse files Browse the repository at this point in the history
Add all menu items based on permissions.
  • Loading branch information
mkimberlin authored Oct 22, 2024
2 parents 9c4a821 + ce26396 commit c07574a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
20 changes: 16 additions & 4 deletions web-ui/src/components/menu/Menu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ import {
selectHasSkillsReportPermission,
selectHasTeamSkillsReportPermission,
selectHasViewPulseReportPermission,
selectIsAdmin
selectIsAdmin,
selectHasEarnedCertificationsPermission,
selectHasMeritReportPermission,
selectHasVolunteeringEventsPermission,
selectHasVolunteeringRelationshipsPermission,
} from '../../context/selectors';
import { UPDATE_TOAST } from '../../context/actions';

Expand Down Expand Up @@ -136,7 +140,9 @@ function Menu({ children }) {
links.push(['/birthday-reports', 'Birthdays']);
}

links.push(['/certification-reports', 'Certifications']);
if (selectHasEarnedCertificationsPermission(state)) {
links.push(['/certification-reports', 'Certifications']);
}

if (selectHasCheckinsReportPermission(state)) {
links.push(['/checkins-reports', 'Check-ins']);
Expand All @@ -154,8 +160,14 @@ function Menu({ children }) {
links.push(['/team-skills-reports', 'Team Skills']);
}

links.push(['/merit-reports', 'Merit Report']);
links.push(['/volunteer-reports', 'Volunteering']);
if (selectHasMeritReportPermission(state)) {
links.push(['/merit-reports', 'Merit Report']);
}

if (selectHasVolunteeringEventsPermission(state) ||
selectHasVolunteeringRelationshipsPermission(state)) {
links.push(['/volunteer-reports', 'Volunteering']);
}

return links;
};
Expand Down
2 changes: 0 additions & 2 deletions web-ui/src/components/volunteer/VolunteerTables.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Box, Tab, Tabs, Typography, Card, CardHeader, CardContent, Avatar } fro

import {
selectHasVolunteeringEventsPermission,
selectHasVolunteeringOrganizationsPermission,
selectHasVolunteeringRelationshipsPermission,
noPermission,
} from '../../context/selectors';
Expand Down Expand Up @@ -58,7 +57,6 @@ const VolunteerReportPage = ({ onlyMe = false }) => {
let tabContent = 0;

return (selectHasVolunteeringEventsPermission(state) ||
selectHasVolunteeringOrganizationsPermission(state) ||
selectHasVolunteeringRelationshipsPermission(state)) ? (
<Card className="volunteer-activities-card">
<CardContent className="volunteer-tables">
Expand Down

0 comments on commit c07574a

Please sign in to comment.