diff --git a/jam-ui/src/components/page/JKEditProfile.js b/jam-ui/src/components/page/JKEditProfile.js
index 9f03b6afe..904ed0f73 100644
--- a/jam-ui/src/components/page/JKEditProfile.js
+++ b/jam-ui/src/components/page/JKEditProfile.js
@@ -15,7 +15,7 @@ import {
getRegions,
getCities
} from '../../helpers/rest';
-
+import JKModalDialog from '../common/JKModalDialog';
function JKEditProfile() {
const { t } = useTranslation('profile');
@@ -28,6 +28,7 @@ function JKEditProfile() {
const [countries, setCountries] = useState([]);
const [regions, setRegions] = useState([]);
const [cities, setCities] = useState([]);
+ const [showPhotoModal, setShowPhotoModal] = useState(false);
const [_, forceUpdate] = useReducer(x => x + 1, 0);
@@ -62,6 +63,7 @@ function JKEditProfile() {
if (currentUser && !currentUserLoaded) {
setCurrentUserLoaded(true);
fetchCurentUser().then(data => {
+ console.log("userData", data)
updateUserData(data);
fetchInstruments();
fetchGenres();
@@ -76,7 +78,7 @@ function JKEditProfile() {
.then(response => {
if (response.ok) {
return response.json();
- }else{
+ } else {
reject('Error fetching user data');
}
})
@@ -90,7 +92,7 @@ function JKEditProfile() {
setValue('lastName', data.last_name);
setValue('country', data.country ? data.country : '');
setValue('state', data.state ? data.state : '');
- setValue('city', data.city? data.city : '');
+ setValue('city', data.city ? data.city : '');
setValue('biography', data.biography);
setValue('subscribeEmail', data.subscribe_email);
setValue('virtualBand', data.virtual_band);
@@ -104,7 +106,7 @@ function JKEditProfile() {
if (data.country && data.state) {
fetchCities(data.country, data.state);
}
- }
+ };
const fetchInstruments = () => {
getInstruments()
@@ -124,7 +126,7 @@ function JKEditProfile() {
setInstrumentsInitialLoadingDone(false);
const updatedMusicInstruments = musicInstruments.map(musicInstrument => {
const instrument = getValues('instruments').find(instrument => instrument.instrument_id === musicInstrument.id);
-
+
if (instrument) {
musicInstrument.proficiency_level = instrument.proficiency_level;
musicInstrument.priority = instrument.priority;
@@ -140,7 +142,6 @@ function JKEditProfile() {
});
setMusicInstruments(updatedMusicInstruments);
setInstrumentsInitialLoadingDone(true);
-
}, [musicInstruments, getValues('instruments')]);
const fetchGenres = () => {
@@ -247,11 +248,11 @@ function JKEditProfile() {
};
const handleInstrumentProficiencyChange = (option, musicInstrument) => {
- const userInstrument = getValues('instruments').find(instrument => instrument.instrument_id === musicInstrument.id);
+ const userInstrument = getValues('instruments').find(instrument => instrument.instrument_id === musicInstrument.id);
if (!userInstrument) {
- const updatedInstruments = [...getValues('instruments'), { ...musicInstrument, proficiency_level: option.value}];
+ const updatedInstruments = [...getValues('instruments'), { ...musicInstrument, proficiency_level: option.value }];
setValue('instruments', updatedInstruments);
- }else{
+ } else {
const updatedInstruments = getValues('instruments').map(instrument => {
if (instrument.instrument_id === musicInstrument.id) {
instrument.proficiency_level = option.value;
@@ -336,7 +337,7 @@ function JKEditProfile() {
const handleChange = () => {
const params = getValues();
-
+
const data = {
first_name: params.firstName,
last_name: params.lastName,
@@ -352,332 +353,368 @@ function JKEditProfile() {
genres: params.genres.map(genre => genre.genre_id)
};
- const instrments = params.instruments.filter(instrument =>
- instrument.instrument_id !== null &&
- instrument.proficiency_level !== null
+ const instrments = params.instruments.filter(
+ instrument => instrument.instrument_id !== null && instrument.proficiency_level !== null
);
data.instruments = instrments;
- updateUser(currentUser.id, data).then(response => {
- if (response.ok) {
- console.log('User data updated');
- }else{
- console.log('Error updating user data');
- }
- }).catch(error => console.log(error));
+ updateUser(currentUser.id, data)
+ .then(response => {
+ if (response.ok) {
+ console.log('User data updated');
+ } else {
+ console.log('Error updating user data');
+ }
+ })
+ .catch(error => console.log(error));
+ };
+
+ const togglePhotoModel = () => {
+ setShowPhotoModal(!showPhotoModal);
};
return (
- {t('interests')}
+