fix: code styles
This commit is contained in:
@@ -61,7 +61,8 @@
|
||||
"errorFetchEmail": "An error occurred while fetching your linked accounts.",
|
||||
"emailIsInvalid": "Email is invalid",
|
||||
"changeEmailFailed": "Change of email failed",
|
||||
"anErrorOccurred": "An error occurred."
|
||||
"anErrorOccurred": "An error occurred.",
|
||||
"saving": "Saving..."
|
||||
},
|
||||
|
||||
"active": {
|
||||
@@ -74,7 +75,8 @@
|
||||
"justNow": "Just now",
|
||||
"notLoggedIn": "You are not logged in",
|
||||
"failFetchActiveSessions": "Failed to fetch active sessions.",
|
||||
"errorFetch": "An error occurred while fetching your active sessions."
|
||||
"errorFetch": "An error occurred while fetching your active sessions.",
|
||||
"deleting": "Deleting..."
|
||||
},
|
||||
|
||||
"settings": {
|
||||
|
||||
@@ -61,7 +61,8 @@
|
||||
"errorFetchEmail": "هنگام دریافت حسابهای پیوند داده شده شما خطایی روی داد.",
|
||||
"emailIsInvalid": "ایمیل نامعتبر است",
|
||||
"changeEmailFailed": "تغییر ایمیل با خطا مواجه شد",
|
||||
"anErrorOccurred": "خطایی رخ داد"
|
||||
"anErrorOccurred": "خطایی رخ داد",
|
||||
"saving": "در حال ذخیرهسازی..."
|
||||
},
|
||||
|
||||
"active": {
|
||||
@@ -74,7 +75,8 @@
|
||||
"justNow": "همین الان",
|
||||
"notLoggedIn": "شما وارد سیستم نشدهاید",
|
||||
"failFetchActiveSessions": "دریافت نشست های فعال ناموفق بود.",
|
||||
"errorFetch": "هنگام دریافت جلسات فعال شما خطایی روی داد."
|
||||
"errorFetch": "هنگام دریافت جلسات فعال شما خطایی روی داد.",
|
||||
"deleting": "در حال حذف..."
|
||||
},
|
||||
|
||||
"settings": {
|
||||
|
||||
@@ -14,6 +14,7 @@ import { CardContainer } from '@/components/CardContainer';
|
||||
import { PageWrapper } from '../PageWrapper';
|
||||
import { Icon } from '@rkheftan/harmony-ui';
|
||||
import apiClient from '@/lib/apiClient';
|
||||
import { toLocaleDigits } from '@/utils/persianDigit';
|
||||
|
||||
function formatSessionDate(
|
||||
isoDate: string,
|
||||
@@ -30,7 +31,8 @@ function formatSessionDate(
|
||||
return t('active.justNow');
|
||||
}
|
||||
if (diffInMinutes < 60) {
|
||||
return t('active.minutesAgo', { count: diffInMinutes });
|
||||
const minuteString = t('active.minutesAgo', { count: diffInMinutes });
|
||||
return toLocaleDigits(minuteString, lang);
|
||||
}
|
||||
|
||||
let displayLocale: string;
|
||||
@@ -62,7 +64,11 @@ function formatSessionDate(
|
||||
};
|
||||
}
|
||||
|
||||
return new Intl.DateTimeFormat(displayLocale, options).format(date);
|
||||
const formattedDate = new Intl.DateTimeFormat(displayLocale, options).format(
|
||||
date,
|
||||
);
|
||||
|
||||
return toLocaleDigits(formattedDate, lang);
|
||||
}
|
||||
|
||||
interface Device {
|
||||
@@ -214,6 +220,7 @@ export function ActiveDevices() {
|
||||
borderRadius: 1,
|
||||
borderColor: 'error.main',
|
||||
color: 'error.main',
|
||||
textTransform: 'none',
|
||||
}}
|
||||
disabled={isLoading}
|
||||
>
|
||||
@@ -263,7 +270,7 @@ export function ActiveDevices() {
|
||||
flexBasis: { xs: '100%', sm: 'auto' },
|
||||
mb: { xs: 1, sm: 0 },
|
||||
minWidth: { sm: '138px' },
|
||||
// order: { xs: 1, sm: 1 },
|
||||
order: { xs: 1, sm: 1 },
|
||||
}}
|
||||
>
|
||||
{device.timeAndDate}
|
||||
@@ -274,9 +281,7 @@ export function ActiveDevices() {
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: 1,
|
||||
flexBasis: { xs: '100%', sm: 'auto' },
|
||||
mb: { xs: 1, sm: 0 },
|
||||
minWidth: { sm: '138px' },
|
||||
width: '100%',
|
||||
order: { xs: 2, sm: 2 },
|
||||
}}
|
||||
>
|
||||
@@ -322,6 +327,7 @@ export function ActiveDevices() {
|
||||
borderColor: 'success.main',
|
||||
whiteSpace: 'nowrap',
|
||||
color: 'success.main',
|
||||
textTransform: 'none',
|
||||
'&.Mui-disabled': {
|
||||
color: 'success.main',
|
||||
borderColor: 'success.main',
|
||||
@@ -365,6 +371,7 @@ export function ActiveDevices() {
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
whiteSpace: 'nowrap',
|
||||
textTransform: 'none',
|
||||
'& .MuiButton-startIcon': {
|
||||
marginRight: 0.5,
|
||||
marginLeft: 0,
|
||||
@@ -372,7 +379,7 @@ export function ActiveDevices() {
|
||||
}}
|
||||
>
|
||||
{loadingDeleteIds.includes(device.id)
|
||||
? t('active.deleting...')
|
||||
? t('active.deleting')
|
||||
: t('active.deleteDevice')}
|
||||
</Button>
|
||||
</Box>
|
||||
|
||||
@@ -69,7 +69,7 @@ export function PasswordSecurity() {
|
||||
}
|
||||
: {
|
||||
password,
|
||||
confirmPassword,
|
||||
// confirmPassword,
|
||||
};
|
||||
|
||||
const res = await apiClient.post(url, payload, {
|
||||
@@ -88,11 +88,9 @@ export function PasswordSecurity() {
|
||||
setCurrentPassword('');
|
||||
} else {
|
||||
console.error('Password update failed:', res.data?.message);
|
||||
// optionally show error toast
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Error updating password:', err);
|
||||
// optionally show error toast
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -110,6 +108,7 @@ export function PasswordSecurity() {
|
||||
sx={{
|
||||
backgroundColor: 'primary.main',
|
||||
color: 'background.paper',
|
||||
textTransform: 'none',
|
||||
}}
|
||||
>
|
||||
{changePassword
|
||||
|
||||
@@ -236,7 +236,7 @@ export function Setting() {
|
||||
disabled={loading || isFetching}
|
||||
>
|
||||
{loading
|
||||
? t('settings.saving...')
|
||||
? t('settings.saving')
|
||||
: isEditing
|
||||
? t('settings.saveButton')
|
||||
: t('settings.editButton')}
|
||||
|
||||
@@ -8,6 +8,7 @@ import PhoneEditForm from './phoneNumber/PhoneEditForm';
|
||||
import PhoneActionButtons from './phoneNumber/PhoneActionButtons';
|
||||
import apiClient from '@/lib/apiClient';
|
||||
import { CircularProgress, Box, Typography } from '@mui/material';
|
||||
import { toLocaleDigits } from '@/utils/persianDigit';
|
||||
|
||||
interface Phone {
|
||||
phone: string;
|
||||
@@ -31,7 +32,7 @@ interface ConfirmApiResponse extends ApiResponse {
|
||||
}
|
||||
|
||||
export function PhoneNumber() {
|
||||
const { t } = useTranslation('setting');
|
||||
const { t, i18n } = useTranslation('setting');
|
||||
const [isEditing, setIsEditing] = useState(false);
|
||||
const [phoneNumber, setPhoneNumber] = useState('');
|
||||
const [verificationCode, setVerificationCode] = useState('');
|
||||
@@ -274,7 +275,18 @@ export function PhoneNumber() {
|
||||
t={t}
|
||||
/>
|
||||
) : (
|
||||
<PhoneDisplay phones={phones} />
|
||||
<PhoneDisplay
|
||||
phones={phones.map((p) => {
|
||||
let localPhone = p.withCode;
|
||||
if (localPhone.startsWith('+98')) {
|
||||
localPhone = '0' + localPhone.slice(3);
|
||||
}
|
||||
return {
|
||||
...p,
|
||||
phone: toLocaleDigits(localPhone, i18n.language),
|
||||
};
|
||||
})}
|
||||
/>
|
||||
)}
|
||||
</CardContainer>
|
||||
</PageWrapper>
|
||||
|
||||
@@ -31,17 +31,17 @@ export function InfoRowEdit({ data, setData }: InfoRowEditProps) {
|
||||
const fields = [
|
||||
{
|
||||
name: 'firstName' as const,
|
||||
label: t('settingForm.name', { ns: 'profileSetting' }),
|
||||
label: t('settingForm.name', { ns: 'setting' }),
|
||||
value: data.firstName,
|
||||
},
|
||||
{
|
||||
name: 'lastName' as const,
|
||||
label: t('settingForm.familyName', { ns: 'profileSetting' }),
|
||||
label: t('settingForm.familyName', { ns: 'setting' }),
|
||||
value: data.lastName,
|
||||
},
|
||||
{
|
||||
name: 'nationalCode' as const,
|
||||
label: t('settingForm.nationalCode', { ns: 'profileSetting' }),
|
||||
label: t('settingForm.nationalCode', { ns: 'setting' }),
|
||||
value: data.nationalCode,
|
||||
},
|
||||
];
|
||||
@@ -71,11 +71,11 @@ export function InfoRowEdit({ data, setData }: InfoRowEditProps) {
|
||||
<Box sx={{ width: { xs: '100%', sm: '48%', md: 'calc(50% - 8px)' } }}>
|
||||
<FormControl fullWidth>
|
||||
<InputLabel>
|
||||
{t('settingForm.genderPlaceholder', { ns: 'profileSetting' })}
|
||||
{t('settingForm.genderPlaceholder', { ns: 'setting' })}
|
||||
</InputLabel>
|
||||
<Select
|
||||
value={data.gender === Gender.None ? '' : data.gender}
|
||||
label={t('settingForm.genderPlaceholder', { ns: 'profileSetting' })}
|
||||
label={t('settingForm.genderPlaceholder', { ns: 'setting' })}
|
||||
onChange={(e) =>
|
||||
setData((prev) => ({
|
||||
...prev,
|
||||
@@ -84,10 +84,10 @@ export function InfoRowEdit({ data, setData }: InfoRowEditProps) {
|
||||
}
|
||||
>
|
||||
<MenuItem value={Gender.Male}>
|
||||
{t('settingForm.man', { ns: 'profileSetting' })}
|
||||
{t('settingForm.man', { ns: 'setting' })}
|
||||
</MenuItem>
|
||||
<MenuItem value={Gender.Female}>
|
||||
{t('settingForm.woman', { ns: 'profileSetting' })}
|
||||
{t('settingForm.woman', { ns: 'setting' })}
|
||||
</MenuItem>
|
||||
</Select>
|
||||
</FormControl>
|
||||
@@ -113,7 +113,7 @@ export function InfoRowEdit({ data, setData }: InfoRowEditProps) {
|
||||
renderInput={(params) => (
|
||||
<TextField
|
||||
{...params}
|
||||
label={t('settingForm.country', { ns: 'profileSetting' })}
|
||||
label={t('settingForm.country', { ns: 'setting' })}
|
||||
/>
|
||||
)}
|
||||
clearOnEscape
|
||||
|
||||
@@ -36,6 +36,7 @@ export default function PhoneActionButtons({
|
||||
bgcolor: isEditing ? 'primary.main' : 'background.default',
|
||||
color: isEditing ? 'primary.contrastText' : 'primary.main',
|
||||
whiteSpace: 'nowrap',
|
||||
textTransform: 'none',
|
||||
}}
|
||||
>
|
||||
{isEditing
|
||||
|
||||
@@ -161,6 +161,7 @@ export default function PhoneEditForm({
|
||||
sx={{
|
||||
minWidth: { xs: '100%', sm: 220 },
|
||||
color: 'primary.main',
|
||||
textTransform: 'none',
|
||||
}}
|
||||
>
|
||||
{buttonState === 'counting' ? (
|
||||
@@ -205,6 +206,7 @@ export default function PhoneEditForm({
|
||||
sx={{
|
||||
minWidth: { xs: '100%', sm: 220 },
|
||||
bgcolor: 'primary.main',
|
||||
textTransform: 'none',
|
||||
}}
|
||||
>
|
||||
{isVerifying ? (
|
||||
|
||||
@@ -59,6 +59,7 @@ export default function SocialMediaMenu({
|
||||
alignItems: 'center',
|
||||
whiteSpace: 'nowrap',
|
||||
backgroundColor: open ? 'primary.light' : 'primary.default',
|
||||
textTransform: 'none',
|
||||
}}
|
||||
>
|
||||
<Box component="span">{t('settingForm.addEmailOrSocialButton')}</Box>
|
||||
|
||||
Reference in New Issue
Block a user