Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions src/components/EditProfile/EditProfile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { createTheme, ThemeProvider } from '@mui/material/styles';
import { FormControl, InputLabel } from '@mui/material';
import { MenuItem, Select } from '@mui/material';
import { updateUserAsync, getUserAsync } from '../../redux/users/thunks';
import FileBase64 from "react-file-base64";


const theme = createTheme();

Expand All @@ -32,9 +34,15 @@ export default function EditProfile() {
skillLevel: '',
age: '',
height: '',
gender: '',
gender: '',
bio: '',
image: '',
});

function handleImageInput(base64) {
setInputs({ ...inputs, image: base64 });
}

useEffect(() => {
if (userInfo) {
setInputs({
Expand All @@ -43,7 +51,9 @@ export default function EditProfile() {
skillLevel: userInfo.skillLevel,
age: userInfo.age,
height: userInfo.height,
gender: userInfo.gender,
gender: userInfo.gender,
bio: userInfo.bio,
image: userInfo.image,
})
}
}, [userInfo])
Expand Down Expand Up @@ -161,6 +171,29 @@ export default function EditProfile() {
</Select>
</FormControl>
</Grid>

<Grid item xs={12} value={inputs.image}>
<div className="upload-picture">
<FileBase64
multiple={false}
onDone={({ base64 }) => handleImageInput(base64)}
/>
</div>
</Grid>

<Grid item xs={12}>
<TextField
required
fullWidth
multiline
id="bio"
label="Short Bio"
I
name="bio"
value={inputs.bio}
onChange={handleChange}
/>
</Grid>
</Grid>
<Button
type="submit"
Expand Down