diff --git a/src/features/authentication/components/AuthenticationSteps/CompleteSignUp.tsx b/src/features/authentication/components/AuthenticationSteps/CompleteSignUp.tsx index 6ec07f3..e85c694 100644 --- a/src/features/authentication/components/AuthenticationSteps/CompleteSignUp.tsx +++ b/src/features/authentication/components/AuthenticationSteps/CompleteSignUp.tsx @@ -99,7 +99,7 @@ export const CompleteSignUp = ({ helperText={inputError ? error : ''} autoFocus slotProps={{ - htmlInput: { dir: 'auto', sx: { lineHeight: 1.5, paddingX: 0 } }, + htmlInput: { dir: 'auto', sx: { lineHeight: 1.5 } }, input: { endAdornment: ( ) => { let newValue = event.target.value; + newValue = replacePersianWithRealNumbers(newValue); if (newValue.startsWith('09')) { newValue = newValue.substring(1); } @@ -152,7 +154,7 @@ export function LoginRegisterForm({ helperText={inputError ? error : ''} autoFocus slotProps={{ - htmlInput: { dir: 'auto', sx: { lineHeight: 1.5, paddingX: 0 } }, + htmlInput: { dir: 'auto', sx: { lineHeight: 1.5 } }, input: { endAdornment: ( { + if (otpCode.length === 4) { + handleVerifyOTP(); + } + }, [otpCode]); + useEffect(() => { let interval: NodeJS.Timeout; if (resendTimer > 0) { diff --git a/src/features/authentication/components/AuthenticationSteps/VerifyPhoneNumber.tsx b/src/features/authentication/components/AuthenticationSteps/VerifyPhoneNumber.tsx index 2b9b0fc..9943fe3 100644 --- a/src/features/authentication/components/AuthenticationSteps/VerifyPhoneNumber.tsx +++ b/src/features/authentication/components/AuthenticationSteps/VerifyPhoneNumber.tsx @@ -35,6 +35,12 @@ export function VerifyPhoneNumber({ const { loading: confirmSmsOtpLoading, execute: confirmSmsOtpCall } = useApi(confirmSmsOtp); + useEffect(() => { + if (otpCode.length === 4) { + handleVerifyOTP(); + } + }, [otpCode]); + useEffect(() => { let interval: NodeJS.Timeout; if (resendTimer > 0) { diff --git a/src/features/authentication/components/CountryCodeSelector.tsx b/src/features/authentication/components/CountryCodeSelector.tsx index 2aa9709..fd42dac 100644 --- a/src/features/authentication/components/CountryCodeSelector.tsx +++ b/src/features/authentication/components/CountryCodeSelector.tsx @@ -16,6 +16,7 @@ import { useTranslation } from 'react-i18next'; import { countries, type Country } from '../../../data/countries'; import type { CountryCode } from '@/types/commonTypes'; import { Icon } from '@rkheftan/harmony-ui'; +import { LTRBox } from '@/components/common/LTRBox'; interface CountryCodeSelectorProps { show: boolean; value: CountryCode; @@ -187,7 +188,9 @@ export function CountryCodeSelector({ {filteredCountries.length === 0 ? ( - {t('messages.noResualtFound')} + + {t('messages.noResualtFound', { ns: 'common' })} + ) : ( @@ -209,7 +212,9 @@ export function CountryCodeSelector({ - {country.phone} + + {country.phone} + )) diff --git a/src/features/authentication/components/ForgetPassword/ForgetPasswordOtp.tsx b/src/features/authentication/components/ForgetPassword/ForgetPasswordOtp.tsx index e9c8045..d914114 100644 --- a/src/features/authentication/components/ForgetPassword/ForgetPasswordOtp.tsx +++ b/src/features/authentication/components/ForgetPassword/ForgetPasswordOtp.tsx @@ -48,6 +48,12 @@ export function ForgetPasswordOtp({ execute: confirmForgetPassCodeCall, } = useApi(confirmForgetPassCode); + useEffect(() => { + if (otpCode.length === 4) { + handleVerifyOTP(); + } + }, [otpCode]); + useEffect(() => { let interval: NodeJS.Timeout; if (resendTimer > 0) { diff --git a/src/features/authentication/components/ForgetPassword/ForgettedPasswordInfo.tsx b/src/features/authentication/components/ForgetPassword/ForgettedPasswordInfo.tsx index 0ab10ab..5b2df84 100644 --- a/src/features/authentication/components/ForgetPassword/ForgettedPasswordInfo.tsx +++ b/src/features/authentication/components/ForgetPassword/ForgettedPasswordInfo.tsx @@ -12,6 +12,7 @@ import type { SendForgetPassCodeRequest } from '../../types/userTypes'; import { isPhoneNumber } from '@/utils/regexes/isValidPhoneNumber'; import { useToast } from '@rkheftan/harmony-ui'; import { useApi } from '@/hooks/useApi'; +import { replacePersianWithRealNumbers } from '@/utils/replacePersianWithRealNumbers'; export interface ForgettedPasswordInfoProps { forgettedPasswordInfo: string; @@ -46,6 +47,7 @@ export function ForgettedPasswordInfo({ const handleInputChange = (event: React.ChangeEvent) => { let newValue = event.target.value; + newValue = replacePersianWithRealNumbers(newValue); if (newValue.startsWith('09')) { newValue = newValue.substring(1); } @@ -138,7 +140,7 @@ export function ForgettedPasswordInfo({ helperText={inputError ? error : ''} autoFocus slotProps={{ - htmlInput: { dir: 'auto', sx: { lineHeight: 1.5, paddingX: 0 } }, + htmlInput: { dir: 'auto', sx: { lineHeight: 1.5 } }, input: { endAdornment: ( { + const persianDigits = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹']; + return text + .split('') + .map((char) => { + const index = persianDigits.indexOf(char); + return index === -1 ? char : index.toString(); + }) + .join(''); +};