diff --git a/Client/src/Components/NavBar/index.jsx b/Client/src/Components/NavBar/index.jsx index f99ad14b6..e1501ea48 100644 --- a/Client/src/Components/NavBar/index.jsx +++ b/Client/src/Components/NavBar/index.jsx @@ -25,7 +25,6 @@ import LogoutSvg from "../../assets/icons/logout.svg?react"; import BWULogo from "../../assets/Images/bwl-logo.svg?react"; -const settings = ["Profile", "Password", "Team", "Logout"]; const icons = { Profile: , Team: , @@ -51,6 +50,10 @@ function NavBar() { const navigate = useNavigate(); const authState = useSelector((state) => state.auth); + let settings = ["Profile", "Password", "Team", "Logout"]; + if (!authState.user.role.includes("admin")) + settings = ["Profile", "Password", "Logout"]; + /** * Handles opening the user menu. * diff --git a/Client/src/Pages/Account/index.jsx b/Client/src/Pages/Account/index.jsx index 391cf3940..ad5acf53a 100644 --- a/Client/src/Pages/Account/index.jsx +++ b/Client/src/Pages/Account/index.jsx @@ -8,6 +8,7 @@ import ProfilePanel from "../../Components/TabPanels/Account/ProfilePanel"; import PasswordPanel from "../../Components/TabPanels/Account/PasswordPanel"; import TeamPanel from "../../Components/TabPanels/Account/TeamPanel"; import { useNavigate } from "react-router"; +import { useSelector } from "react-redux"; /** * Account component renders a settings page with tabs for Profile, Password, and Team settings. @@ -15,8 +16,6 @@ import { useNavigate } from "react-router"; * @returns {JSX.Element} */ -const tabList = ["Profile", "Password", "Team"]; - const Account = ({ open = "profile" }) => { const theme = useTheme(); const navigate = useNavigate(); @@ -25,6 +24,10 @@ const Account = ({ open = "profile" }) => { navigate(`/account/${newTab}`); }; + let tabList = ["Profile", "Password", "Team"]; + const { user } = useSelector((state) => state.auth); + if (!user.role.includes("admin")) tabList = ["Profile", "Password"]; + return ( { - + { user.role.includes("admin") && } );