fix: trnslation keys and ltr style icons

This commit is contained in:
Sajad Mirjalili
2025-09-26 12:04:21 +03:30
parent 86bca4d4a6
commit 3d2e5ff0e6
7 changed files with 29 additions and 19 deletions

View File

@@ -7,7 +7,7 @@
"loginWithGoogle": "Login with google", "loginWithGoogle": "Login with google",
"emailIsInvalid": "Email is invalid", "emailIsInvalid": "Email is invalid",
"phoneNumberIsInvalid": "Phone number is invalid", "phoneNumberIsInvalid": "Phone number is invalid",
"thisFieldIsRequired": "This field is requried", "thisFieldIsRequired": "This field is required",
"googleAuthenticationFailed": "Login with google failed" "googleAuthenticationFailed": "Login with google failed"
}, },
"verify": { "verify": {
@@ -21,7 +21,8 @@
"youHaveSuccessfullySignedIn": "You have successfully signed in", "youHaveSuccessfullySignedIn": "You have successfully signed in",
"resendCodeIn": "Resend code in", "resendCodeIn": "Resend code in",
"moreMinute": "minute", "moreMinute": "minute",
"resendCode": "Resend code" "resendCode": "Resend code",
"confirmAndLogin": "Confirm & login"
}, },
"completeSignUp": { "completeSignUp": {
"completeSignUp": "Complete Sign Up", "completeSignUp": "Complete Sign Up",

View File

@@ -14,6 +14,7 @@
"addEmailButton": "Add email", "addEmailButton": "Add email",
"name": "Name", "name": "Name",
"familyName": "Family Name", "familyName": "Family Name",
"fullName": "Full Name",
"country": "Country", "country": "Country",
"gender": "Gender", "gender": "Gender",
"nationalCode": "National code", "nationalCode": "National code",

View File

@@ -14,6 +14,7 @@
"addEmailButton": "افزودن ایمیل", "addEmailButton": "افزودن ایمیل",
"name": "نام", "name": "نام",
"familyName": "نام خانوادگی", "familyName": "نام خانوادگی",
"fullName": "نام و نام خانوادگی",
"country": "کشور", "country": "کشور",
"gender": "جنسیت", "gender": "جنسیت",
"nationalCode": "کد ملی", "nationalCode": "کد ملی",

View File

@@ -1,6 +1,6 @@
import { useRef, useState } from 'react'; import { useRef, useState } from 'react';
import { AuthenticationCard } from '../AuthenticationCard'; import { AuthenticationCard } from '../AuthenticationCard';
import { ArrowLeft, Edit2, Eye, EyeSlash } from 'iconsax-react'; import { ArrowLeft, ArrowRight, Edit2, Eye, EyeSlash } from 'iconsax-react';
import { import {
Box, Box,
Button, Button,
@@ -51,7 +51,7 @@ export const EnterPasswordForm = ({
countryCode, countryCode,
authFactory, authFactory,
}: EnterPasswordFormProps) => { }: EnterPasswordFormProps) => {
const { t } = useTranslation('authentication'); const { t, i18n } = useTranslation('authentication');
const [passValue, setPassValue] = useState<string>(''); const [passValue, setPassValue] = useState<string>('');
const [inputTouched, setInputTouched] = useState<boolean>(false); const [inputTouched, setInputTouched] = useState<boolean>(false);
const [showPassword, setShowPassword] = useState<boolean>(false); const [showPassword, setShowPassword] = useState<boolean>(false);
@@ -184,7 +184,9 @@ export const EnterPasswordForm = ({
sx={{ width: 'auto', mb: 2 }} sx={{ width: 'auto', mb: 2 }}
variant="text" variant="text"
loading={emailResendLoading || smsResendLoading} loading={emailResendLoading || smsResendLoading}
endIcon={<Icon Component={ArrowLeft} />} endIcon={
<Icon Component={i18n.dir() === 'rtl' ? ArrowLeft : ArrowRight} />
}
> >
{t('enterPassword.loginWithOneTimeCode')} {t('enterPassword.loginWithOneTimeCode')}
</Button> </Button>

View File

@@ -42,7 +42,7 @@ export function LoginRegisterForm({
onGoogleAuthenticated, onGoogleAuthenticated,
authFactory, authFactory,
}: LoginRegisterFormProps) { }: LoginRegisterFormProps) {
const { t } = useTranslation('authentication'); const { t, i18n } = useTranslation('authentication');
const textFieldRef = useRef<HTMLDivElement>(null); const textFieldRef = useRef<HTMLDivElement>(null);
const inputRef = useRef<HTMLInputElement>(null); const inputRef = useRef<HTMLInputElement>(null);
const [error, setError] = useState<string>(); const [error, setError] = useState<string>();
@@ -167,7 +167,16 @@ export function LoginRegisterForm({
slotProps={{ slotProps={{
htmlInput: { dir: 'auto', sx: { lineHeight: 1.5 } }, htmlInput: { dir: 'auto', sx: { lineHeight: 1.5 } },
input: { input: {
endAdornment: ( endAdornment: i18n.dir() === 'rtl' && (
<CountryCodeSelector
value={countryCode}
onChange={setCountryCode}
show={showAdornment}
menuAnchor={menuAnchorEl}
onCloseFocusRef={inputRef}
/>
),
startAdornment: i18n.dir() === 'ltr' && (
<CountryCodeSelector <CountryCodeSelector
value={countryCode} value={countryCode}
onChange={setCountryCode} onChange={setCountryCode}

View File

@@ -7,7 +7,6 @@ import {
Menu, Menu,
MenuItem, MenuItem,
TextField, TextField,
Typography,
} from '@mui/material'; } from '@mui/material';
import { useMemo, useRef, useState, type RefObject } from 'react'; import { useMemo, useRef, useState, type RefObject } from 'react';
import { ArrowDown2 } from 'iconsax-react'; import { ArrowDown2 } from 'iconsax-react';
@@ -17,6 +16,7 @@ import { countries, type Country } from '../../../data/countries';
import type { CountryCode } from '@/types/commonTypes'; import type { CountryCode } from '@/types/commonTypes';
import { Icon } from '@rkheftan/harmony-ui'; import { Icon } from '@rkheftan/harmony-ui';
import { LTRTypography } from '@/components/common/LTRTypography'; import { LTRTypography } from '@/components/common/LTRTypography';
interface CountryCodeSelectorProps { interface CountryCodeSelectorProps {
show: boolean; show: boolean;
value: CountryCode; value: CountryCode;
@@ -41,7 +41,7 @@ export function CountryCodeSelector({
const open = Boolean(anchorEl); const open = Boolean(anchorEl);
const searchInputRef = useRef<HTMLInputElement>(null); const searchInputRef = useRef<HTMLInputElement>(null);
const menuWidth = menuAnchor ? menuAnchor.clientWidth : 'auto'; const menuWidth = menuAnchor ? menuAnchor.clientWidth : 'auto';
const { t, i18n } = useTranslation(['country', 'common']); const { t } = useTranslation(['country', 'common']);
const selectedCountry = const selectedCountry =
countries.find((c) => c.phone === value) || countries[0]; countries.find((c) => c.phone === value) || countries[0];
@@ -83,7 +83,7 @@ export function CountryCodeSelector({
return ( return (
<InputAdornment <InputAdornment
position={i18n.dir() === 'rtl' ? 'start' : 'end'} position={'end'}
sx={{ sx={{
mx: 0, mx: 0,
}} }}
@@ -107,6 +107,7 @@ export function CountryCodeSelector({
height: '100%', height: '100%',
display: 'flex', display: 'flex',
alignItems: 'center', alignItems: 'center',
flexDirection: 'row-reverse',
gap: 0.25, gap: 0.25,
pl: show ? 0.25 : 0, pl: show ? 0.25 : 0,
@@ -118,14 +119,9 @@ export function CountryCodeSelector({
{/* This inner Box prevents the content from being squeezed during the transition */} {/* This inner Box prevents the content from being squeezed during the transition */}
<Icon Component={ArrowDown2} size="medium" variant="Bold" /> <Icon Component={ArrowDown2} size="medium" variant="Bold" />
<Typography <LTRTypography variant="body1" color="text.primary">
variant="body1"
color="text.primary"
component="div"
sx={{ direction: 'rtl' }} // TODO: need to fixed for both en and fa
>
{value} {value}
</Typography> </LTRTypography>
<ReactCountryFlag <ReactCountryFlag
countryCode={selectedCountry.code} countryCode={selectedCountry.code}

View File

@@ -50,7 +50,7 @@ export function InfoRowDisplay({
}} }}
> >
<Typography variant="caption" color="text.secondary"> <Typography variant="caption" color="text.secondary">
{t('settingForm.name')} و {t('settingForm.familyName')} {t('settingForm.fullName')}
</Typography> </Typography>
<Box sx={{ display: 'flex', alignItems: 'center', gap: 2 }}> <Box sx={{ display: 'flex', alignItems: 'center', gap: 2 }}>
<Avatar <Avatar