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