Hide email field in profile edit modal
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -99,27 +99,19 @@ function NameFieldsRow({ form, errors, onChange }) {
|
||||
}
|
||||
|
||||
// ─── Contact fields ─────────────────────────────────────────────────────────
|
||||
function ContactFields({ form, errors, onChange, onPhoneChange }) {
|
||||
// Email в окне профиля не показываем: он не редактируется здесь, но остаётся
|
||||
// в состоянии формы и уходит при сохранении без изменений.
|
||||
function ContactFields({ form, errors, onPhoneChange }) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<>
|
||||
<InputField
|
||||
label={t('profile.phoneLabel')}
|
||||
type="tel"
|
||||
placeholder="+7 (___) ___-__-__"
|
||||
value={form.phone}
|
||||
error={errors.phone}
|
||||
onChange={(e) => onPhoneChange(e.target.value)}
|
||||
/>
|
||||
<InputField
|
||||
label={t('profile.emailLabel')}
|
||||
type="email"
|
||||
placeholder="example@email.com"
|
||||
value={form.email}
|
||||
error={errors.email}
|
||||
onChange={(e) => onChange("email", e.target.value)}
|
||||
/>
|
||||
</>
|
||||
<InputField
|
||||
label={t('profile.phoneLabel')}
|
||||
type="tel"
|
||||
placeholder="+7 (___) ___-__-__"
|
||||
value={form.phone}
|
||||
error={errors.phone}
|
||||
onChange={(e) => onPhoneChange(e.target.value)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,10 +12,6 @@ export function validateProfileForm(form) {
|
||||
errors.lastName = i18n.t('profile.validateSurnameRequired');
|
||||
}
|
||||
|
||||
if (form.email && !form.email.match(/^[^\s@]+@[^\s@]+\.[^\s@]+$/)) {
|
||||
errors.email = i18n.t('profile.validateEmailInvalid');
|
||||
}
|
||||
|
||||
if (form.phone && form.phone.replace(/\D/g, "").length < 11) {
|
||||
errors.phone = i18n.t('profile.validatePhoneInvalid');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user