From 0ed89e649d70910d15edb07eecc8f588874e120b Mon Sep 17 00:00:00 2001 From: lucia <51058748+lucia-gomez@users.noreply.github.com> Date: Sat, 6 Apr 2024 14:45:21 -0400 Subject: [PATCH] hide nav bar links based on permissions --- .../src/client/routes/components/navBar.js | 40 ++++++++++++------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/media_commons_booking_app/src/client/routes/components/navBar.js b/media_commons_booking_app/src/client/routes/components/navBar.js index fb5644f2..4f111c17 100644 --- a/media_commons_booking_app/src/client/routes/components/navBar.js +++ b/media_commons_booking_app/src/client/routes/components/navBar.js @@ -1,11 +1,16 @@ +import React, { useContext } from 'react'; + import Container from 'react-bootstrap/Container'; +import { DatabaseContext } from './Provider'; import Nav from 'react-bootstrap/Nav'; import NavDropdown from 'react-bootstrap/NavDropdown'; import { NavLink } from 'react-router-dom'; import Navbar from 'react-bootstrap/Navbar'; -import React from 'react'; +import { PagePermission } from '../../../types'; export default function NavBar() { + const { pagePermission } = useContext(DatabaseContext); + return ( @@ -24,20 +29,25 @@ export default function NavBar() { My Bookings - - - Admin - - - - - PA - - + {pagePermission === PagePermission.ADMIN && ( + + + Admin + + + )} + {(pagePermission === PagePermission.ADMIN || + pagePermission === PagePermission.PA) && ( + + + PA + + + )} Spaces Index