Skip to content

Commit

Permalink
Add correct data to account profile
Browse files Browse the repository at this point in the history
  • Loading branch information
schulzetenberg committed Mar 31, 2021
1 parent 23f7682 commit 9ab6b92
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 34 deletions.
65 changes: 31 additions & 34 deletions frontend/src/pages/account/account-profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ const useStyles = makeStyles((theme) => ({
}));

const AccountProfile: React.FC<{
data?: any;
handleRemove: any;
isLoading: boolean;
errors: string[];
setShowProfile: any;
setShowPassword: any;
}> = ({ handleRemove, isLoading, errors, setShowProfile, setShowPassword }) => {
}> = ({ data, handleRemove, isLoading, errors, setShowProfile, setShowPassword }) => {
const classes = useStyles();

const [open, setOpen] = React.useState(false);
Expand All @@ -43,26 +44,22 @@ const AccountProfile: React.FC<{
setOpen(false);
};

const user = {
avatar: '/avatar_11.png',
};

return (
<Card>
<CardContent>
<div className={classes.details}>
<div>
<Typography gutterBottom variant="h2">
John Doe
{data?.firstName} {data?.lastName}
</Typography>
<Typography color="textSecondary" variant="body1">
[email protected]
{data?.email}
</Typography>
<Typography color="textSecondary" variant="body1">
Account created on 11/22/2019
Account created on {data?.createdAt}
</Typography>
</div>
<Avatar className={classes.avatar} src={user.avatar} />
<Avatar className={classes.avatar} src={data?.gravatar} title={`Gravatar for ${data?.email}`} />
</div>
<br />
<Button variant="text" className={classes.uploadButton} onClick={setShowProfile}>
Expand All @@ -82,31 +79,31 @@ const AccountProfile: React.FC<{
</CardActions>
{open && (
<Modal title="Delete Account" open={open} handleClose={handleClose}>
<>
<ErrorList errors={errors} />
<p>
If you delete your account, all data related to your account will be <strong>permanently deleted</strong>.
Are you sure you want to proceed?
</p>
<Button
disabled={isLoading}
className={classes.modalButton}
onClick={handleRemove}
color="primary"
variant="contained"
>
Confirm
</Button>
<Button
disabled={isLoading}
className={classes.modalButton}
onClick={handleClose}
color="primary"
variant="text"
>
Cancel
</Button>
</>
<>
<ErrorList errors={errors} />
<p>
If you delete your account, all data related to your account will be <strong>permanently deleted</strong>.
Are you sure you want to proceed?
</p>
<Button
disabled={isLoading}
className={classes.modalButton}
onClick={handleRemove}
color="primary"
variant="contained"
>
Confirm
</Button>
<Button
disabled={isLoading}
className={classes.modalButton}
onClick={handleClose}
color="primary"
variant="text"
>
Cancel
</Button>
</>
</Modal>
)}
</Card>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/pages/account/account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ const Account: React.FC = () => {
<AccountProfile
handleRemove={handleRemove}
isLoading={!data || isRemoveLoading}
data={data}
errors={removeErrors}
setShowProfile={handleShowProfile}
setShowPassword={handleShowPassword}
Expand Down

0 comments on commit 9ab6b92

Please sign in to comment.