fix: problem with + in phone numbers

This commit is contained in:
Sajad Mirjalili
2025-09-14 13:19:35 +03:30
parent 06f2dce994
commit 7267b6033f
4 changed files with 21 additions and 7 deletions

View File

@@ -2,6 +2,7 @@ import { Box, IconButton, Typography } from '@mui/material';
import { Icon } from '@rkheftan/harmony-ui'; import { Icon } from '@rkheftan/harmony-ui';
import { More } from 'iconsax-react'; import { More } from 'iconsax-react';
import type { UserInfo } from '@/contexts/AuthContext'; import type { UserInfo } from '@/contexts/AuthContext';
import { LTRBox } from '../common/LTRBox';
interface HeaderProps { interface HeaderProps {
user: UserInfo; user: UserInfo;
@@ -20,8 +21,8 @@ export const Header: React.FC<HeaderProps> = ({ user }) => {
> >
<Box> <Box>
<Typography variant="body1">{user.fullName}</Typography> <Typography variant="body1">{user.fullName}</Typography>
<Typography variant="body2" color="textSecondary"> <Typography variant="body2" component="span" color="textSecondary">
{user.phoneNumber ?? user.email} <LTRBox>{user.phoneNumber ?? user.email}</LTRBox>
</Typography> </Typography>
</Box> </Box>

View File

@@ -0,0 +1,6 @@
import { styled } from '@mui/material';
export const LTRBox = styled('span')`
/* @noflip */
direction: ltr;
`;

View File

@@ -25,6 +25,7 @@ import {
generateTokenWithPassword, generateTokenWithPassword,
type GenerateTokenResponse, type GenerateTokenResponse,
} from '../../api/identityAPI'; } from '../../api/identityAPI';
import { LTRBox } from '@/components/common/LTRBox';
export interface EnterPasswordFormProps { export interface EnterPasswordFormProps {
onEditValue: () => void; onEditValue: () => void;
@@ -136,7 +137,9 @@ export const EnterPasswordForm = ({
endIcon={<Icon Component={Edit2} />} endIcon={<Icon Component={Edit2} />}
onClick={onEditValue} onClick={onEditValue}
> >
{authType === 'phone' ? countryCode + emailOrPhone : emailOrPhone} <LTRBox>
{authType === 'phone' ? countryCode + emailOrPhone : emailOrPhone}
</LTRBox>
</Button> </Button>
</Box> </Box>

View File

@@ -18,6 +18,7 @@ import {
generateTokenWithOtp, generateTokenWithOtp,
type GenerateTokenResponse, type GenerateTokenResponse,
} from '../../api/identityAPI'; } from '../../api/identityAPI';
import { LTRBox } from '@/components/common/LTRBox';
interface OtpVerifyFormProps { interface OtpVerifyFormProps {
value: string; value: string;
@@ -55,8 +56,6 @@ export function OtpVerifyForm({
const { loading: loginSignUpLoading, execute: loginSignUpCall } = const { loading: loginSignUpLoading, execute: loginSignUpCall } =
useApi(loginOrSignUpWithOtp); useApi(loginOrSignUpWithOtp);
console.log(countryCode);
useEffect(() => { useEffect(() => {
let interval: NodeJS.Timeout; let interval: NodeJS.Timeout;
if (resendTimer > 0) { if (resendTimer > 0) {
@@ -191,11 +190,16 @@ export function OtpVerifyForm({
<Button <Button
variant="outlined" variant="outlined"
size="large" size="large"
sx={{ textTransform: 'lowercase', width: 'auto' }} sx={{
textTransform: 'lowercase',
width: 'auto',
}}
endIcon={<Icon Component={Edit2} />} endIcon={<Icon Component={Edit2} />}
onClick={onEditValue} onClick={onEditValue}
> >
{authType === 'phone' ? countryCode + value : value} <LTRBox>
{authType === 'phone' ? countryCode + value : value}
</LTRBox>
</Button> </Button>
</Box> </Box>