Merge pull request #438 from bluewave-labs/feat/hide-team-panel

Hide team panel for users
This commit is contained in:
Alexander Holliday authored and GitHub committed 2024-07-24 12:07:56 -07:00
commit 7512f015af
2 files changed
+10 -4

No files matched your search

+4 -1
View File
@@ -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: <UserSvg />,
Team: <TeamSvg />,
@@ -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.
*
+6 -3
View File
@@ -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 (
<Box
//TODO - breakpoints for responsive design
@@ -71,7 +74,7 @@ const Account = ({ open = "profile" }) => {
</Box>
<ProfilePanel />
<PasswordPanel />
<TeamPanel />
{ user.role.includes("admin") && <TeamPanel />}
</TabContext>
</Box>
);