fix: fix main filter point, fix save profile pictures
This commit is contained in:
parent
3345a533d2
commit
3ed78c0e45
|
@ -34,8 +34,7 @@ const nextConfig = {
|
||||||
},
|
},
|
||||||
// output: 'standalone',
|
// output: 'standalone',
|
||||||
poweredByHeader: false,
|
poweredByHeader: false,
|
||||||
productionBrowserSourceMaps: true,
|
productionBrowserSourceMaps: true
|
||||||
trailingSlash: true
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = withNextIntl(nextConfig);
|
module.exports = withNextIntl(nextConfig);
|
||||||
|
|
|
@ -15,6 +15,7 @@ import { OutlinedButton } from '../view/OutlinedButton';
|
||||||
import {FilledButton, FilledSquareButton, FilledYellowButton} from '../view/FilledButton';
|
import {FilledButton, FilledSquareButton, FilledYellowButton} from '../view/FilledButton';
|
||||||
import { DeleteAccountModal } from '../Modals/DeleteAccountModal';
|
import { DeleteAccountModal } from '../Modals/DeleteAccountModal';
|
||||||
import { Loader } from '../view/Loader';
|
import { Loader } from '../view/Loader';
|
||||||
|
import {ButtonProps} from "antd/es/button/button";
|
||||||
|
|
||||||
type ProfileSettingsProps = {
|
type ProfileSettingsProps = {
|
||||||
locale: string;
|
locale: string;
|
||||||
|
@ -40,6 +41,20 @@ export const ProfileSettings: FC<ProfileSettingsProps> = ({ locale }) => {
|
||||||
}
|
}
|
||||||
}, [profileSettings]);
|
}, [profileSettings]);
|
||||||
|
|
||||||
|
const onSave = (newProfile: ProfileRequest) => {
|
||||||
|
setSaveLoading(true);
|
||||||
|
save(newProfile)
|
||||||
|
.then(() => {
|
||||||
|
fetchProfileSettings();
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
message.error('Не удалось сохранить изменения');
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
setSaveLoading(false);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const onSaveProfile = () => {
|
const onSaveProfile = () => {
|
||||||
form.validateFields()
|
form.validateFields()
|
||||||
.then(({ login, surname, username }) => {
|
.then(({ login, surname, username }) => {
|
||||||
|
@ -56,27 +71,18 @@ export const ProfileSettings: FC<ProfileSettingsProps> = ({ locale }) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
if (photo) {
|
if (photo) {
|
||||||
console.log(photo);
|
const reader = new FileReader();
|
||||||
const formData = new FormData();
|
reader.readAsDataURL(photo as File);
|
||||||
formData.append('file', photo as FileType);
|
reader.onloadend = () => {
|
||||||
|
const newReg = new RegExp('data:image/(png|jpg|jpeg);base64,')
|
||||||
newProfile.faceImage = `[${(photo as File).arrayBuffer()}]`;
|
newProfile.faceImage = reader.result.replace(newReg, '');
|
||||||
newProfile.isFaceImageKeepExisting = false;
|
newProfile.isFaceImageKeepExisting = false;
|
||||||
|
|
||||||
|
onSave(newProfile);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
onSave(newProfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(newProfile);
|
|
||||||
|
|
||||||
setSaveLoading(true);
|
|
||||||
save(newProfile)
|
|
||||||
.then(() => {
|
|
||||||
fetchProfileSettings();
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
message.error('Не удалось сохранить изменения');
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
setSaveLoading(false);
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,6 +109,10 @@ export const ProfileSettings: FC<ProfileSettingsProps> = ({ locale }) => {
|
||||||
modalTitle="Редактировать"
|
modalTitle="Редактировать"
|
||||||
modalOk="Сохранить"
|
modalOk="Сохранить"
|
||||||
modalCancel="Отмена"
|
modalCancel="Отмена"
|
||||||
|
modalProps={{
|
||||||
|
okButtonProps: { className: 'b-button__filled_yellow' },
|
||||||
|
cancelButtonProps: { className: 'b-button__outlined' }
|
||||||
|
}}
|
||||||
beforeCrop={beforeCrop}
|
beforeCrop={beforeCrop}
|
||||||
>
|
>
|
||||||
<Upload
|
<Upload
|
||||||
|
@ -114,7 +124,7 @@ export const ProfileSettings: FC<ProfileSettingsProps> = ({ locale }) => {
|
||||||
url: profileSettings.faceImageUrl
|
url: profileSettings.faceImageUrl
|
||||||
}
|
}
|
||||||
] : undefined}
|
] : undefined}
|
||||||
accept=".jpg,.jpeg,.png,.gif"
|
accept=".jpg,.jpeg,.png"
|
||||||
beforeUpload={beforeUpload}
|
beforeUpload={beforeUpload}
|
||||||
multiple={false}
|
multiple={false}
|
||||||
showUploadList={false}
|
showUploadList={false}
|
||||||
|
|
|
@ -114,6 +114,7 @@ export const ExpertsFilter = ({
|
||||||
...getObjectByAdditionalFilter(searchParams)
|
...getObjectByAdditionalFilter(searchParams)
|
||||||
};
|
};
|
||||||
const search = getSearchParamsString(newFilter);
|
const search = getSearchParamsString(newFilter);
|
||||||
|
console.log('basePath', basePath);
|
||||||
|
|
||||||
router.push(search ? `${basePath}?${search}#filter` : `${basePath}#filter`);
|
router.push(search ? `${basePath}?${search}#filter` : `${basePath}#filter`);
|
||||||
|
|
||||||
|
|
|
@ -109,10 +109,11 @@ textarea {
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-avatar {
|
.user-avatar {
|
||||||
display: flex;
|
display: grid;
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
|
grid-template-columns: 100px auto;
|
||||||
|
|
||||||
&__edit {
|
&__edit {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import { UploadFile } from 'antd';
|
|
||||||
import { EducationDTO } from './education';
|
import { EducationDTO } from './education';
|
||||||
import { ExpertsTags } from './tags';
|
import { ExpertsTags } from './tags';
|
||||||
import { PracticeDTO } from './practice';
|
import { PracticeDTO } from './practice';
|
||||||
|
@ -28,7 +27,7 @@ export type ProfileRequest = {
|
||||||
languagesLinks?: { languageId: number }[];
|
languagesLinks?: { languageId: number }[];
|
||||||
username?: string;
|
username?: string;
|
||||||
surname?: string;
|
surname?: string;
|
||||||
faceImage?: UploadFile;
|
faceImage?: any;
|
||||||
isFaceImageKeepExisting?: boolean;
|
isFaceImageKeepExisting?: boolean;
|
||||||
phone?: string;
|
phone?: string;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue