Remove features from demo user

This commit is contained in:
Alex Holliday committed 2024-09-06 11:10:08 -07:00
1 parent 484231144d
commit 2c204e6e1c
3 files changed
+30 -18

No files matched your search

+7
View File
@@ -90,6 +90,13 @@ function Sidebar() {
const [open, setOpen] = useState({ Dashboard: false, Account: false });
const [anchorEl, setAnchorEl] = useState(null);
const [popup, setPopup] = useState();
const { user } = useSelector((state) => state.auth);
if (!user.role.includes("superadmin")) {
menu[3].nested = menu[3].nested.filter((item) => {
return item.name !== "Password";
});
}
const openPopup = (event, id) => {
setAnchorEl(event.currentTarget);
@@ -331,22 +331,24 @@ const ProfilePanel = () => {
borderColor: theme.palette.border.light,
}}
/>
<Box component="form" noValidate spellCheck="false">
<Box mb={theme.spacing(6)}>
<Typography component="h1">Delete account</Typography>
<Typography component="p" sx={{ opacity: 0.6 }}>
Note that deleting your account will remove all data from our
system. This is permanent and non-recoverable.
</Typography>
{user.role.includes("superadmin") && (
<Box component="form" noValidate spellCheck="false">
<Box mb={theme.spacing(6)}>
<Typography component="h1">Delete account</Typography>
<Typography component="p" sx={{ opacity: 0.6 }}>
Note that deleting your account will remove all data from our
system. This is permanent and non-recoverable.
</Typography>
</Box>
<Button
variant="contained"
color="error"
onClick={() => setIsOpen("delete")}
>
Delete account
</Button>
</Box>
<Button
variant="contained"
color="error"
onClick={() => setIsOpen("delete")}
>
Delete account
</Button>
</Box>
)}
{/* TODO - Update ModalPopup Component with @mui for reusability */}
<Modal
aria-labelledby="modal-delete-account"
+6 -3
View File
@@ -22,9 +22,12 @@ const Account = ({ open = "profile" }) => {
const handleTabChange = (event, newTab) => {
navigate(`/account/${newTab}`);
};
let tabList = ["Profile", "Password", "Team"];
const { user } = useSelector((state) => state.auth);
let tabList = ["Profile", "Team"];
if (user.role.includes("superadmin")) {
tabList.push("Password");
}
const requiredRoles = ["superadmin", "admin"];
const hideTeams = !requiredRoles.some((role) => user.role.includes(role));
if (hideTeams) {
@@ -74,7 +77,7 @@ const Account = ({ open = "profile" }) => {
</TabList>
</Box>
<ProfilePanel />
<PasswordPanel />
{user.role.includes("superadmin") && <PasswordPanel />}
{!hideTeams && <TeamPanel />}
</TabContext>
</Box>