import { Box, Typography, TextField, Button, IconButton, InputAdornment, CircularProgress, } from '@mui/material'; import { Edit2, TickCircle } from 'iconsax-react'; import { CountDownTimer } from '@/components/CountDownTimer'; import { CountryCodeSelector } from '../../CountryCodeSelector'; import { Icon } from '@rkheftan/harmony-ui'; import { type PhoneEditFormProps } from '@/features/profile/types/settingsType'; import { useRef } from 'react'; import { useTranslation } from 'react-i18next'; export default function PhoneEditForm({ phoneNumber, setPhoneNumber, countryCode, setCountryCode, verificationCode, setVerificationCode, isVerified, isVerifying, isSendingCode, buttonState, setButtonState, handleSendCode, handleVerifyClick, handleBlur, phones, phoneNumberError, verificationCodeError, }: PhoneEditFormProps) { const { t } = useTranslation('setting'); const textFieldRef = useRef(null); const inputRef = useRef(null); return ( {t('settingForm.editPhoneNumber')} {t('settingForm.phoneNumberText')}({phones.map((p) => p.withCode)}) {t('settingForm.verb')} handleBlur('phoneNumber')} error={!!phoneNumberError} helperText={phoneNumberError} onChange={(e) => setPhoneNumber(e.target.value)} placeholder="09123456789" InputProps={{ endAdornment: buttonState === 'counting' ? ( { setButtonState('default'); setPhoneNumber(''); setVerificationCode(''); }} edge="end" > ) : ( ), }} /> {isVerified ? ( {t('settingForm.successButton')} ) : ( )} {/* buttonState === 'counting' && !isVerified && */} {buttonState === 'counting' && !isVerified && ( handleBlur('verificationCode')} onChange={(e) => setVerificationCode(e.target.value.replace(/\D/g, '')) } placeholder={t('settingForm.verificationCode')} /> )} ); }