Refactored profile tab

This commit is contained in:
Daniel Cojocea committed 2024-08-20 19:34:56 -04:00
1 parent 8d4486cd43
commit 0ec5e6dcde
2 files changed
+49 -59

No files matched your search

@@ -217,11 +217,17 @@ const ProfilePanel = () => {
return ( return (
<TabPanel value="profile"> <TabPanel value="profile">
<form className="edit-profile-form" noValidate spellCheck="false"> <Stack
<div className="edit-profile-form__wrapper"> component="form"
<Stack> className="edit-profile-form"
noValidate
spellCheck="false"
gap={theme.gap.xl}
>
<Stack direction="row">
<Box flex={0.9}>
<Typography component="h1">First name</Typography> <Typography component="h1">First name</Typography>
</Stack> </Box>
<Field <Field
id="edit-first-name" id="edit-first-name"
value={localData.firstName} value={localData.firstName}
@@ -230,11 +236,11 @@ const ProfilePanel = () => {
onChange={handleChange} onChange={handleChange}
error={errors[idToName["edit-first-name"]]} error={errors[idToName["edit-first-name"]]}
/> />
</div> </Stack>
<div className="edit-profile-form__wrapper"> <Stack direction="row">
<Stack> <Box flex={0.9}>
<Typography component="h1">Last name</Typography> <Typography component="h1">Last name</Typography>
</Stack> </Box>
<Field <Field
id="edit-last-name" id="edit-last-name"
placeholder="Enter your last name" placeholder="Enter your last name"
@@ -243,11 +249,11 @@ const ProfilePanel = () => {
onChange={handleChange} onChange={handleChange}
error={errors[idToName["edit-last-name"]]} error={errors[idToName["edit-last-name"]]}
/> />
</div> </Stack>
<div className="edit-profile-form__wrapper"> <Stack direction="row">
<Stack> <Stack flex={0.9}>
<Typography component="h1">Email</Typography> <Typography component="h1">Email</Typography>
<Typography component="p"> <Typography component="p" sx={{ opacity: 0.6 }}>
This is your current email address — it cannot be changed. This is your current email address — it cannot be changed.
</Typography> </Typography>
</Stack> </Stack>
@@ -256,20 +262,19 @@ const ProfilePanel = () => {
value={user.email} value={user.email}
placeholder="Enter your email" placeholder="Enter your email"
autoComplete="email" autoComplete="email"
// TODO - add onChange
onChange={() => logger.warn("disabled")} onChange={() => logger.warn("disabled")}
// error={errors[idToName["edit-email"]]} // error={errors[idToName["edit-email"]]}
disabled={true} disabled={true}
/> />
</div> </Stack>
<div className="edit-profile-form__wrapper"> <Stack direction="row">
<Stack> <Stack flex={0.9}>
<Typography component="h1">Your photo</Typography> <Typography component="h1">Your photo</Typography>
<Typography component="p"> <Typography component="p" sx={{ opacity: 0.6 }}>
This photo will be displayed in your profile page. This photo will be displayed in your profile page.
</Typography> </Typography>
</Stack> </Stack>
<Stack className="row-stack" direction="row" alignItems="center"> <Stack direction="row" alignItems="center" flex={1}>
<Avatar <Avatar
src={ src={
localData?.deleteProfileImage localData?.deleteProfileImage
@@ -294,7 +299,7 @@ const ProfilePanel = () => {
}} }}
/> />
</Stack> </Stack>
</div> </Stack>
<Divider <Divider
aria-hidden="true" aria-hidden="true"
className="short-divider" className="short-divider"
@@ -313,31 +318,33 @@ const ProfilePanel = () => {
Object.keys(errors).length !== 0 && !errors?.picture && true Object.keys(errors).length !== 0 && !errors?.picture && true
} }
sx={{ sx={{
paddingX: "40px", paddingX: theme.gap.large,
}} }}
/> />
</Box> </Box>
</Stack> </Stack>
</form> </Stack>
<Divider aria-hidden="true" /> <Divider aria-hidden="true" />
<form className="delete-profile-form" noValidate spellCheck="false"> <Stack
<div className="delete-profile-form__wrapper"> component="form"
<Stack direction="column" gap="8px"> noValidate
<Typography component="h1">Delete account</Typography> spellCheck="false"
<Typography component="p"> gap={theme.gap.small}
Note that deleting your account will remove all data from our >
system. This is permanent and non-recoverable. <Box>
</Typography> <Typography component="h1">Delete account</Typography>
<Box sx={{ mt: theme.spacing(2) }}> <Typography component="p" sx={{ opacity: 0.6 }}>
<Button Note that deleting your account will remove all data from our
level="error" system. This is permanent and non-recoverable.
label="Delete account" </Typography>
onClick={() => setIsOpen("delete")} </Box>
/> <Button
</Box> level="error"
</Stack> label="Delete account"
</div> onClick={() => setIsOpen("delete")}
</form> sx={{ width: "fit-content", mt: theme.gap.small }}
/>
</Stack>
{/* 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"
+3 -20
View File
@@ -15,11 +15,6 @@
.account h1.MuiTypography-root { .account h1.MuiTypography-root {
font-weight: 600; font-weight: 600;
} }
.account .MuiStack-root:not(.table-stack) {
flex: 1;
-webkit-flex: 1;
-ms-flex: 1;
}
.account .MuiTabPanel-root { .account .MuiTabPanel-root {
padding: 0; padding: 0;
margin-top: 50px; margin-top: 50px;
@@ -34,6 +29,9 @@
.account button:not(.MuiIconButton-root) { .account button:not(.MuiIconButton-root) {
height: 34px; height: 34px;
} }
.account .field {
flex: 1;
}
.account [class$="-form"] { .account [class$="-form"] {
width: inherit; width: inherit;
} }
@@ -44,22 +42,16 @@
justify-content: space-between; justify-content: space-between;
align-items: flex-start; align-items: flex-start;
} }
.edit-profile-form__wrapper > .MuiStack-root:not(.row-stack),
.edit-password-form__wrapper > .MuiStack-root:not(.row-stack) { .edit-password-form__wrapper > .MuiStack-root:not(.row-stack) {
flex-direction: column; flex-direction: column;
gap: 8px; gap: 8px;
margin-right: 10px; margin-right: 10px;
} }
.edit-profile-form__wrapper p.MuiTypography-root,
.delete-profile-form__wrapper p.MuiTypography-root {
opacity: 0.6;
}
#modal-delete-account, #modal-delete-account,
#modal-edit-org-name, #modal-edit-org-name,
#modal-invite-member { #modal-invite-member {
font-size: var(--env-var-font-size-large); font-size: var(--env-var-font-size-large);
} }
.edit-profile-form__wrapper:not(:first-of-type),
.edit-password-form__wrapper:not(:first-of-type), .edit-password-form__wrapper:not(:first-of-type),
.edit-team-form__wrapper:not(:first-of-type) { .edit-team-form__wrapper:not(:first-of-type) {
margin-top: var(--env-var-spacing-4); margin-top: var(--env-var-spacing-4);
@@ -70,15 +62,6 @@
align-items: center; align-items: center;
} }
/* for testing, will remove later */
@media only screen and (max-width: 1600px) {
.edit-profile-form__wrapper .MuiStack-root:not(.row-stack),
.edit-password-form__wrapper .MuiStack-root:not(.row-stack),
.edit-organization-form__wrapper .MuiStack-root:not(.row-stack) {
margin-right: 30px;
}
}
.account .MuiStack-root:has(span.MuiTypography-root.input-error) { .account .MuiStack-root:has(span.MuiTypography-root.input-error) {
position: relative; position: relative;
} }