fix: email limit and sidenav fixes

This commit is contained in:
Koosha Lahouti
2025-09-26 17:47:22 +03:30
parent b6b6918ea0
commit 7dd0673ae6
4 changed files with 46 additions and 32 deletions

View File

@@ -70,7 +70,8 @@
"phoneVerified": "Phone number verified", "phoneVerified": "Phone number verified",
"errorConfirmCode": "Failed to confirm code", "errorConfirmCode": "Failed to confirm code",
"errorChangePhone": "Failed to change phone number", "errorChangePhone": "Failed to change phone number",
"verificationCodeSent": "Verification code sent" "verificationCodeSent": "Verification code sent",
"onlyOneAccountAllowed": "You can only link one email account."
}, },
"active": { "active": {

View File

@@ -71,7 +71,8 @@
"phoneVerified": "تلفن همراه تایید شد", "phoneVerified": "تلفن همراه تایید شد",
"errorConfirmCode": "تایید کد با خطا مواجه شد", "errorConfirmCode": "تایید کد با خطا مواجه شد",
"errorChangePhone": "تغییر تلفن همراه با خطا مواجه شد", "errorChangePhone": "تغییر تلفن همراه با خطا مواجه شد",
"verificationCodeSent": "کد تایید ارسال شد" "verificationCodeSent": "کد تایید ارسال شد",
"onlyOneAccountAllowed": "شما فقط می‌توانید یک حساب ایمیل را متصل کنید"
}, },
"active": { "active": {

View File

@@ -107,6 +107,13 @@ export function SocialMedia() {
severity: 'success', severity: 'success',
}); });
setDialogStep('enterCode'); setDialogStep('enterCode');
setTimeout(
() => {
resetDialog();
},
3 * 60 * 1000,
);
} }
}; };
@@ -128,34 +135,35 @@ export function SocialMedia() {
message: confirmData.message || t('settingForm.error'), message: confirmData.message || t('settingForm.error'),
severity: 'error', severity: 'error',
}); });
return; return;
} }
toast({ if (emailList.length >= 1) {
message: confirmData.message || t('settingForm.verificationSuccessful'), toast({
severity: 'success', message: t('settingForm.onlyOneAccountAllowed'),
}); severity: 'error',
});
return;
}
const changeEmailData = await executeChangeEmail({ email: emailInput }); const changeEmailData = await executeChangeEmail({ email: emailInput });
if (!changeEmailData) return; if (!changeEmailData) return;
if (changeEmailData.success) { if (changeEmailData.success) {
setEmailList((prev) => [ setEmailList([
...prev,
{ {
email: emailInput, email: emailInput,
provider: emailInput.includes('@gmail.') ? 'google' : 'email', provider: emailInput.includes('@gmail.') ? 'google' : 'email',
time: t('settingForm.justNow'), time: t('settingForm.justNow'),
}, },
]); ]);
toast({ toast({
message: t('settingForm.emailChangedSuccessfully'), message: t('settingForm.emailChangedSuccessfully'),
severity: 'success', severity: 'success',
}); });
resetDialog();
resetDialog();
refetchProfile({ force: true }); refetchProfile({ force: true });
} }
}; };

View File

@@ -118,25 +118,27 @@ export function ActiveDevicesPage() {
title={t('active.activeDevices')} title={t('active.activeDevices')}
subtitle={t('active.activeDevicesCaption')} subtitle={t('active.activeDevicesCaption')}
action={ action={
<Button <Box sx={{ display: 'flex', gap: 1 }}>
size="medium" <Button
variant="outlined" size="medium"
onClick={handleTerminateAllOtherSessions} variant="outlined"
sx={{ onClick={handleTerminateAllOtherSessions}
borderRadius: 1, sx={{
borderColor: 'error.main', borderRadius: 1,
color: 'error.main', borderColor: 'error.main',
textTransform: 'none', color: 'error.main',
flexShrink: 0, textTransform: 'none',
flexGrow: 0, flexShrink: 0,
width: 'auto', flexGrow: 0,
}} width: 'auto',
disabled={isLoadingProfile || isTerminating} }}
> disabled={isLoadingProfile || isTerminating}
{isTerminating >
? t('active.deleting') {isTerminating
: t('active.deleteDevicesButton')} ? t('active.deleting')
</Button> : t('active.deleteDevicesButton')}
</Button>
</Box>
} }
> >
{isLoadingProfile ? ( {isLoadingProfile ? (
@@ -154,10 +156,12 @@ export function ActiveDevicesPage() {
) : ( ) : (
<Box <Box
sx={{ sx={{
px: { xs: 2, sm: 3, md: 4 }, mx: { xs: 2, sm: 3, md: 4 },
py: 2, py: 2,
display: 'flex', display: 'flex',
flexDirection: 'column', flexDirection: 'column',
gap: 2,
bgcolor: 'background.paper',
}} }}
> >
{devices.map((device) => ( {devices.map((device) => (
@@ -218,7 +222,7 @@ export function ActiveDevicesPage() {
sx={{ sx={{
flexBasis: { xs: '100%', sm: 'auto' }, flexBasis: { xs: '100%', sm: 'auto' },
mb: { xs: 1, sm: 0 }, mb: { xs: 1, sm: 0 },
minWidth: { sm: '138px' }, minWidth: { sm: '126px' },
order: { xs: 4, sm: 4 }, order: { xs: 4, sm: 4 },
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',