Hide email field in profile edit modal

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
SlimusMinus
2026-10-26 23:21:57 +03:00
parent 532b5b45f3
commit a2706944bd
2 changed files with 11 additions and 23 deletions

View File

@@ -99,27 +99,19 @@ function NameFieldsRow({ form, errors, onChange }) {
} }
// ─── Contact fields ───────────────────────────────────────────────────────── // ─── Contact fields ─────────────────────────────────────────────────────────
function ContactFields({ form, errors, onChange, onPhoneChange }) { // Email в окне профиля не показываем: он не редактируется здесь, но остаётся
// в состоянии формы и уходит при сохранении без изменений.
function ContactFields({ form, errors, onPhoneChange }) {
const { t } = useTranslation(); const { t } = useTranslation();
return ( return (
<> <InputField
<InputField label={t('profile.phoneLabel')}
label={t('profile.phoneLabel')} type="tel"
type="tel" placeholder="+7 (___) ___-__-__"
placeholder="+7 (___) ___-__-__" value={form.phone}
value={form.phone} error={errors.phone}
error={errors.phone} onChange={(e) => onPhoneChange(e.target.value)}
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)}
/>
</>
); );
} }

View File

@@ -12,10 +12,6 @@ export function validateProfileForm(form) {
errors.lastName = i18n.t('profile.validateSurnameRequired'); 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) { if (form.phone && form.phone.replace(/\D/g, "").length < 11) {
errors.phone = i18n.t('profile.validatePhoneInvalid'); errors.phone = i18n.t('profile.validatePhoneInvalid');
} }