Merge pull request #694 from bluewave-labs/fix/account-tabs-refactor
Account tab panels refactor
This commit is contained in:
4 files changed
+93
-171
No files matched your search
@@ -98,16 +98,17 @@ const PasswordPanel = () => {
|
||||
|
||||
return (
|
||||
<TabPanel value="password">
|
||||
<form
|
||||
<Stack
|
||||
component="form"
|
||||
onSubmit={handleSubmit}
|
||||
className="edit-password-form"
|
||||
noValidate
|
||||
spellCheck="false"
|
||||
gap={theme.gap.xl}
|
||||
>
|
||||
<div className="edit-password-form__wrapper">
|
||||
<Stack>
|
||||
<Stack direction="row">
|
||||
<Box flex={0.9}>
|
||||
<Typography component="h1">Current password</Typography>
|
||||
</Stack>
|
||||
</Box>
|
||||
<Field
|
||||
type="password"
|
||||
id="edit-current-password"
|
||||
@@ -117,11 +118,11 @@ const PasswordPanel = () => {
|
||||
onChange={handleChange}
|
||||
error={errors[idToName["edit-current-password"]]}
|
||||
/>
|
||||
</div>
|
||||
<div className="edit-password-form__wrapper">
|
||||
<Stack>
|
||||
</Stack>
|
||||
<Stack direction="row">
|
||||
<Box flex={0.9}>
|
||||
<Typography component="h1">New password</Typography>
|
||||
</Stack>
|
||||
</Box>
|
||||
<Field
|
||||
type="password"
|
||||
id="edit-new-password"
|
||||
@@ -131,11 +132,11 @@ const PasswordPanel = () => {
|
||||
onChange={handleChange}
|
||||
error={errors[idToName["edit-new-password"]]}
|
||||
/>
|
||||
</div>
|
||||
<div className="edit-password-form__wrapper">
|
||||
<Stack>
|
||||
</Stack>
|
||||
<Stack direction="row">
|
||||
<Box flex={0.9}>
|
||||
<Typography component="h1">Confirm new password</Typography>
|
||||
</Stack>
|
||||
</Box>
|
||||
<Field
|
||||
type="password"
|
||||
id="edit-confirm-password"
|
||||
@@ -145,33 +146,32 @@ const PasswordPanel = () => {
|
||||
onChange={handleChange}
|
||||
error={errors[idToName["edit-confirm-password"]]}
|
||||
/>
|
||||
</div>
|
||||
<div className="edit-password-form__wrapper">
|
||||
<Stack></Stack>
|
||||
</Stack>
|
||||
<Stack direction="row">
|
||||
<Box flex={0.9}></Box>
|
||||
<Box sx={{ flex: 1 }}>
|
||||
<Alert
|
||||
variant="warning"
|
||||
body="New password must contain at least 8 characters and must have at least one uppercase letter, one number and one symbol."
|
||||
/>
|
||||
</Box>
|
||||
</div>
|
||||
<Divider aria-hidden="true" width="0" />
|
||||
<Stack direction="row" justifyContent="flex-end">
|
||||
<Box width="fit-content">
|
||||
<ButtonSpinner
|
||||
level="primary"
|
||||
label="Save"
|
||||
onClick={handleSubmit}
|
||||
isLoading={isLoading}
|
||||
loadingText="Saving..."
|
||||
disabled={Object.keys(errors).length !== 0 && true}
|
||||
sx={{
|
||||
paddingX: theme.gap.xl,
|
||||
}}
|
||||
/>
|
||||
</Box>
|
||||
</Stack>
|
||||
</form>
|
||||
<Stack direction="row" justifyContent="flex-end">
|
||||
<ButtonSpinner
|
||||
level="primary"
|
||||
label="Save"
|
||||
onClick={handleSubmit}
|
||||
isLoading={isLoading}
|
||||
loadingText="Saving..."
|
||||
disabled={Object.keys(errors).length !== 0 && true}
|
||||
sx={{
|
||||
paddingX: theme.gap.large,
|
||||
width: "fit-content",
|
||||
mt: theme.gap.xl,
|
||||
}}
|
||||
/>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</TabPanel>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -217,11 +217,17 @@ const ProfilePanel = () => {
|
||||
|
||||
return (
|
||||
<TabPanel value="profile">
|
||||
<form className="edit-profile-form" noValidate spellCheck="false">
|
||||
<div className="edit-profile-form__wrapper">
|
||||
<Stack>
|
||||
<Stack
|
||||
component="form"
|
||||
className="edit-profile-form"
|
||||
noValidate
|
||||
spellCheck="false"
|
||||
gap={theme.gap.xl}
|
||||
>
|
||||
<Stack direction="row">
|
||||
<Box flex={0.9}>
|
||||
<Typography component="h1">First name</Typography>
|
||||
</Stack>
|
||||
</Box>
|
||||
<Field
|
||||
id="edit-first-name"
|
||||
value={localData.firstName}
|
||||
@@ -230,11 +236,11 @@ const ProfilePanel = () => {
|
||||
onChange={handleChange}
|
||||
error={errors[idToName["edit-first-name"]]}
|
||||
/>
|
||||
</div>
|
||||
<div className="edit-profile-form__wrapper">
|
||||
<Stack>
|
||||
</Stack>
|
||||
<Stack direction="row">
|
||||
<Box flex={0.9}>
|
||||
<Typography component="h1">Last name</Typography>
|
||||
</Stack>
|
||||
</Box>
|
||||
<Field
|
||||
id="edit-last-name"
|
||||
placeholder="Enter your last name"
|
||||
@@ -243,11 +249,11 @@ const ProfilePanel = () => {
|
||||
onChange={handleChange}
|
||||
error={errors[idToName["edit-last-name"]]}
|
||||
/>
|
||||
</div>
|
||||
<div className="edit-profile-form__wrapper">
|
||||
<Stack>
|
||||
</Stack>
|
||||
<Stack direction="row">
|
||||
<Stack flex={0.9}>
|
||||
<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.
|
||||
</Typography>
|
||||
</Stack>
|
||||
@@ -256,20 +262,19 @@ const ProfilePanel = () => {
|
||||
value={user.email}
|
||||
placeholder="Enter your email"
|
||||
autoComplete="email"
|
||||
// TODO - add onChange
|
||||
onChange={() => logger.warn("disabled")}
|
||||
// error={errors[idToName["edit-email"]]}
|
||||
disabled={true}
|
||||
/>
|
||||
</div>
|
||||
<div className="edit-profile-form__wrapper">
|
||||
<Stack>
|
||||
</Stack>
|
||||
<Stack direction="row">
|
||||
<Stack flex={0.9}>
|
||||
<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.
|
||||
</Typography>
|
||||
</Stack>
|
||||
<Stack className="row-stack" direction="row" alignItems="center">
|
||||
<Stack direction="row" alignItems="center" flex={1}>
|
||||
<Avatar
|
||||
src={
|
||||
localData?.deleteProfileImage
|
||||
@@ -294,10 +299,9 @@ const ProfilePanel = () => {
|
||||
}}
|
||||
/>
|
||||
</Stack>
|
||||
</div>
|
||||
</Stack>
|
||||
<Divider
|
||||
aria-hidden="true"
|
||||
className="short-divider"
|
||||
width="0"
|
||||
sx={{ marginY: theme.spacing(1) }}
|
||||
/>
|
||||
@@ -313,31 +317,33 @@ const ProfilePanel = () => {
|
||||
Object.keys(errors).length !== 0 && !errors?.picture && true
|
||||
}
|
||||
sx={{
|
||||
paddingX: "40px",
|
||||
paddingX: theme.gap.large,
|
||||
}}
|
||||
/>
|
||||
</Box>
|
||||
</Stack>
|
||||
</form>
|
||||
<Divider aria-hidden="true" />
|
||||
<form className="delete-profile-form" noValidate spellCheck="false">
|
||||
<div className="delete-profile-form__wrapper">
|
||||
<Stack direction="column" gap="8px">
|
||||
<Typography component="h1">Delete account</Typography>
|
||||
<Typography component="p">
|
||||
Note that deleting your account will remove all data from our
|
||||
system. This is permanent and non-recoverable.
|
||||
</Typography>
|
||||
<Box sx={{ mt: theme.spacing(2) }}>
|
||||
<Button
|
||||
level="error"
|
||||
label="Delete account"
|
||||
onClick={() => setIsOpen("delete")}
|
||||
/>
|
||||
</Box>
|
||||
</Stack>
|
||||
</div>
|
||||
</form>
|
||||
</Stack>
|
||||
<Divider aria-hidden="true" sx={{ marginY: theme.spacing(6) }} />
|
||||
<Stack
|
||||
component="form"
|
||||
noValidate
|
||||
spellCheck="false"
|
||||
gap={theme.gap.small}
|
||||
>
|
||||
<Box>
|
||||
<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
|
||||
level="error"
|
||||
label="Delete account"
|
||||
onClick={() => setIsOpen("delete")}
|
||||
sx={{ width: "fit-content", mt: theme.gap.small }}
|
||||
/>
|
||||
</Stack>
|
||||
{/* TODO - Update ModalPopup Component with @mui for reusability */}
|
||||
<Modal
|
||||
aria-labelledby="modal-delete-account"
|
||||
|
||||
@@ -131,9 +131,6 @@ const TeamPanel = () => {
|
||||
};
|
||||
const handleRename = () => {};
|
||||
|
||||
//TODO - implement save team function
|
||||
const handleSaveTeam = () => {};
|
||||
|
||||
// INVITE MEMBER
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
|
||||
@@ -200,12 +197,11 @@ const TeamPanel = () => {
|
||||
|
||||
return (
|
||||
<TabPanel value="team">
|
||||
<form className="edit-organization-form">
|
||||
<Stack component="form">
|
||||
<Box sx={{ alignSelf: "flex-start" }}>
|
||||
<Typography component="h1">Organization name</Typography>
|
||||
</Box>
|
||||
<Stack
|
||||
className="row-stack"
|
||||
direction="row"
|
||||
justifyContent="flex-end"
|
||||
alignItems="center"
|
||||
@@ -245,21 +241,13 @@ const TeamPanel = () => {
|
||||
}}
|
||||
/>
|
||||
</Stack>
|
||||
</form>
|
||||
<Divider
|
||||
aria-hidden="true"
|
||||
className="short-divider"
|
||||
sx={{ marginY: theme.spacing(4) }}
|
||||
/>
|
||||
<form
|
||||
className="edit-team-form"
|
||||
</Stack>
|
||||
<Divider aria-hidden="true" sx={{ marginY: theme.spacing(4) }} />
|
||||
<Stack
|
||||
component="form"
|
||||
noValidate
|
||||
spellCheck="false"
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
gap: theme.gap.large,
|
||||
}}
|
||||
gap={theme.gap.large}
|
||||
>
|
||||
<Typography component="h1">Team members</Typography>
|
||||
<Stack direction="row" justifyContent="space-between">
|
||||
@@ -307,22 +295,7 @@ const TeamPanel = () => {
|
||||
/>
|
||||
</Stack>
|
||||
<BasicTable data={tableData} paginated={false} reversed={true} />
|
||||
<Stack direction="row" justifyContent="flex-end">
|
||||
<Box width="fit-content">
|
||||
<ButtonSpinner
|
||||
level="primary"
|
||||
label="Save"
|
||||
onClick={handleSaveTeam}
|
||||
isLoading={false}
|
||||
loadingText="Saving..."
|
||||
disabled={true}
|
||||
sx={{
|
||||
paddingX: "40px",
|
||||
}}
|
||||
/>
|
||||
</Box>
|
||||
</Stack>
|
||||
</form>
|
||||
</Stack>
|
||||
<Modal
|
||||
aria-labelledby="modal-invite-member"
|
||||
aria-describedby="invite-member-to-team"
|
||||
|
||||
@@ -15,18 +15,10 @@
|
||||
.account h1.MuiTypography-root {
|
||||
font-weight: 600;
|
||||
}
|
||||
.account .MuiStack-root:not(.table-stack) {
|
||||
flex: 1;
|
||||
-webkit-flex: 1;
|
||||
-ms-flex: 1;
|
||||
}
|
||||
.account .MuiTabPanel-root {
|
||||
padding: 0;
|
||||
margin-top: 50px;
|
||||
}
|
||||
.account .MuiDivider-root:not(.short-divider) {
|
||||
margin: 50px 0;
|
||||
}
|
||||
.account .MuiDivider-root,
|
||||
.account .MuiButtonGroup-root button {
|
||||
border-color: var(--env-var-color-16);
|
||||
@@ -34,50 +26,14 @@
|
||||
.account button:not(.MuiIconButton-root) {
|
||||
height: 34px;
|
||||
}
|
||||
.account [class$="-form"] {
|
||||
width: inherit;
|
||||
}
|
||||
.account [class$="__wrapper"],
|
||||
.account [class$="__wrapper compact"] {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
}
|
||||
.edit-profile-form__wrapper > .MuiStack-root:not(.row-stack),
|
||||
.edit-password-form__wrapper > .MuiStack-root:not(.row-stack) {
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.edit-profile-form__wrapper p.MuiTypography-root,
|
||||
.delete-profile-form__wrapper p.MuiTypography-root {
|
||||
opacity: 0.6;
|
||||
.account .field {
|
||||
flex: 1;
|
||||
}
|
||||
#modal-delete-account,
|
||||
#modal-edit-org-name,
|
||||
#modal-invite-member {
|
||||
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-team-form__wrapper:not(:first-of-type) {
|
||||
margin-top: var(--env-var-spacing-4);
|
||||
}
|
||||
.edit-team-form__wrapper.compact {
|
||||
margin-top: var(--env-var-spacing-3);
|
||||
justify-content: flex-start;
|
||||
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) {
|
||||
position: relative;
|
||||
@@ -87,22 +43,9 @@
|
||||
top: 100%;
|
||||
}
|
||||
|
||||
.edit-profile-form__wrapper .MuiFormControl-root,
|
||||
.edit-password-form__wrapper .MuiFormControl-root {
|
||||
width: 100%;
|
||||
.account .MuiTable-root .MuiTableBody-root .MuiTableCell-root {
|
||||
color: var(--env-var-color-25);
|
||||
}
|
||||
.edit-profile-form__wrapper .MuiStack-root:has(.MuiFormControl-root),
|
||||
.edit-password-form__wrapper .MuiStack-root:has(.MuiFormControl-root) {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.edit-organization-form {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.edit-team-form .MuiTableCell-root {
|
||||
color: var(--env-var-color-25) !important;
|
||||
}
|
||||
.edit-team-form .MuiTableBody-root .MuiTableCell-root {
|
||||
padding: var(--env-var-spacing-1-plus) var(--env-var-spacing-2) !important;
|
||||
.account .MuiTableBody-root .MuiTableCell-root {
|
||||
padding: var(--env-var-spacing-1-plus) var(--env-var-spacing-2);
|
||||
}
|
||||
Reference in new issue
Block a user