diff --git a/public/locales/fa/profileSetting.json b/public/locales/fa/profileSetting.json index 44d2a5e..d1942d0 100644 --- a/public/locales/fa/profileSetting.json +++ b/public/locales/fa/profileSetting.json @@ -37,6 +37,7 @@ "uploadPicture": "بارگذاری تصویر", "phoneNumberText": "شماره تماس جدید شما جایگزین شماره تماس قبلی", "verb": "خواهد شد", - "notDetermined": "تعیین نشده" + "notDetermined": "تعیین نشده", + "successfulChangePhone": "شماره تماس با موفقیت تغییر کرد" } } diff --git a/src/App.tsx b/src/App.tsx index f76d272..bf30764 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -19,12 +19,12 @@ function App() { + {/*
{t('helloWorld')} - @@ -49,17 +49,17 @@ function App() { export default App; -// import { Button } from '@mui/material'; +import { Button } from '@mui/material'; -// export const ThemeToggleButton = () => { -// const { mode, setMode } = useColorScheme(); +export const ThemeToggleButton = () => { + const { mode, setMode } = useColorScheme(); -// return ( -// -// ); -// }; + return ( + + ); +}; diff --git a/src/components/CardContainer.tsx b/src/components/CardContainer.tsx index 0bdb5d3..b83cd82 100644 --- a/src/components/CardContainer.tsx +++ b/src/components/CardContainer.tsx @@ -17,46 +17,59 @@ export function CardContainer({ - - - {title} - - - {subtitle} - + + + + {title} + + + {subtitle} + + + {action} - {action} - - {children} + {children} + ); } diff --git a/src/components/CustomAlert.tsx b/src/components/CustomAlert.tsx new file mode 100644 index 0000000..32c413a --- /dev/null +++ b/src/components/CustomAlert.tsx @@ -0,0 +1,97 @@ +import React, { useState, useEffect } from 'react'; +import { Box, Alert, IconButton, type AlertColor } from '@mui/material'; +import { + TickCircle, + CloseSquare, + Warning2, + InfoCircle, + CloseCircle, +} from 'iconsax-react'; + +type AlertType = AlertColor; + +interface CustomAlertProps { + message: string; + onClose: () => void; + severity?: AlertType; + open: boolean; + duration?: number; + delayOnClose?: number; + rtl?: boolean; + icon?: React.ReactNode; +} + +const defaultIcons: Record = { + success: , + error: , + warning: , + info: , +}; + +export const CustomAlert: React.FC = ({ + message, + severity, + open, + onClose, + duration = 4000, + delayOnClose = 2000, + rtl = false, + icon, +}) => { + const [visible, setVisible] = useState(open); + + useEffect(() => { + setVisible(open); + }, [open]); + + useEffect(() => { + if (visible && duration > 0) { + const timer = setTimeout(() => { + setVisible(false); + onClose(); + }, duration); + return () => clearTimeout(timer); + } + }, [visible, duration, onClose]); + + const handleClose = () => { + setTimeout(() => { + setVisible(false); + onClose(); + }, delayOnClose); + }; + + if (!visible) return null; + + return ( + + + + + } + sx={{ + width: '396px', + flexDirection: 'row-reverse', + justifyContent: 'space-between', + alignItems: 'center', + textAlign: rtl ? 'right' : 'left', + direction: rtl ? 'rtl' : 'ltr', + }} + > + {message} + + + ); +}; diff --git a/src/features/profile/components/PersonalInformation.tsx b/src/features/profile/components/PersonalInformation.tsx index 599e887..a0ad810 100644 --- a/src/features/profile/components/PersonalInformation.tsx +++ b/src/features/profile/components/PersonalInformation.tsx @@ -42,6 +42,8 @@ export function PersonalInformation() { sx={{ display: 'flex', justifyContent: 'center', + width: '100%', + px: { xs: 1, sm: 2 }, backgroundColor: 'background.paper', }} > @@ -50,7 +52,7 @@ export function PersonalInformation() { subtitle={t('settingForm.descriptionPersonalInfo')} highlighted={isEditing} action={ - + {isEditing && (