fix: styles

This commit is contained in:
Koosha Lahouti
2025-08-12 02:49:57 +03:30
parent 8bb36da8d6
commit 437245f54f
8 changed files with 95 additions and 130 deletions

View File

@@ -11,7 +11,7 @@ import {
} from '@mui/material';
import { useTranslation } from 'react-i18next';
import { TickCircle, Edit, Refresh } from 'iconsax-react';
import { CustomAlert } from '@/components/CustomAlert';
import { Toast } from '@/components/Toast';
interface EmailSectionProps {
showEmail: boolean;
@@ -49,14 +49,15 @@ export function EmailSection({
handleEditEmail,
}: EmailSectionProps) {
const { t } = useTranslation('completionForm');
const [showSuccessAlert, setShowSuccessAlert] = useState(false);
const [showEmailErrorAlert, setShowEmailErrorAlert] = useState(false);
const [showSuccessToast, setShowSuccessToast] = useState(false);
const [showErrorToast, setShowErrorToast] = useState(false);
const onSendCodeClick = () => {
if (!correctEmail) {
setShowEmailErrorAlert(true);
setShowErrorToast(true);
return;
}
setShowEmailErrorAlert(false);
setShowErrorToast(false);
handleSendCode();
};
@@ -66,7 +67,7 @@ export function EmailSection({
useEffect(() => {
if (emailVerified) {
setShowSuccessAlert(true);
setShowSuccessToast(true);
}
}, [emailVerified]);
@@ -173,17 +174,6 @@ export function EmailSection({
{getButtonLabel()}
</Button>
)}
{showEmailErrorAlert && (
<CustomAlert
open={showEmailErrorAlert}
onClose={() => setShowEmailErrorAlert(false)}
message={t('completion.emailCorrectForm')}
severity="error"
duration={4000}
delayOnClose={2000}
rtl
/>
)}
</Box>
{email && (
@@ -247,15 +237,21 @@ export function EmailSection({
</Box>
)}
<CustomAlert
open={showSuccessAlert}
onClose={() => setShowSuccessAlert(false)}
message="ایمیل با موفقیت تایید شد"
severity="success"
duration={4000}
delayOnClose={2000}
rtl
/>
<Toast
color="success"
open={showSuccessToast}
onClose={() => setShowSuccessToast(false)}
>
{t('completion.alertSuccess')}
</Toast>
<Toast
color="error"
open={showErrorToast}
onClose={() => setShowErrorToast(false)}
>
{t('completion.emailCorrectForm')}
</Toast>
</>
);
}