diff --git a/src/features/profile/component/PersonalInformation.tsx b/src/features/profile/component/PersonalInformation.tsx deleted file mode 100644 index 21967f1..0000000 --- a/src/features/profile/component/PersonalInformation.tsx +++ /dev/null @@ -1,229 +0,0 @@ -import { - Box, - Typography, - Button, - TextField, - Grid, - FormControl, - Select, - MenuItem, - type SelectChangeEvent, -} from '@mui/material'; -import { useState, type ChangeEvent } from 'react'; - -export function PersonalInformation() { - const [isEditing, setIsEditing] = useState(false); - const [gender, setGender] = useState(''); - const [data, setData] = useState({ - firstName: 'محمد حسین', - lastName: 'برزه‌گر', - gender: 'مرد', - nationalCode: '', - }); - - const handleChange = (e: ChangeEvent) => { - setData((prev) => ({ - ...prev, - [e.target.name]: e.target.value, - })); - }; - - const toggleEdit = () => { - setIsEditing((prev) => !prev); - if (isEditing) { - setData((prev) => ({ - ...prev, - gender: gender === 'male' ? 'مرد' : gender === 'female' ? 'زن' : '', - })); - } else { - setGender( - data.gender === 'مرد' ? 'male' : data.gender === 'زن' ? 'female' : '', - ); - } - }; - - const handleChangeGender = (e: SelectChangeEvent) => { - setGender(e.target.value); - }; - - const displayValue = (value: string | null | undefined) => { - return value && value.trim() !== '' ? value : 'تعیین نشده'; - }; - - return ( -
- - - - - اطلاعات شخصی من - - - این اطلاعات شما صرفا برای احراز هویت شما است و نزد هارمونی باقی - می‌ماند - - - - - {isEditing && ( - - )} - - - - - - - {isEditing ? ( - - ) : ( - - - نام - - - {displayValue(data.firstName)} - - - )} - - - - {isEditing ? ( - - ) : ( - - - نام خانوادگی - - - {displayValue(data.lastName)} - - - )} - - - - {isEditing ? ( - - - - ) : ( - - - جنسیت - - - {displayValue(data.gender)} - - - )} - - - - {isEditing ? ( - - ) : ( - - - کد ملی - - - {displayValue(data.nationalCode)} - - - )} - - - -
- ); -} diff --git a/src/features/profile/component/PhoneNumber.tsx b/src/features/profile/component/PhoneNumber.tsx deleted file mode 100644 index ccaff35..0000000 --- a/src/features/profile/component/PhoneNumber.tsx +++ /dev/null @@ -1,306 +0,0 @@ -import { - Box, - Typography, - Button, - Dialog, - DialogTitle, - DialogContent, - IconButton, - TextField, -} from '@mui/material'; -import { Edit, CloseSquare } from 'iconsax-react'; -import { useState, useEffect } from 'react'; - -export function PhoneNumber() { - const [open, setOpen] = useState(false); - const [dialogStep, setDialogStep] = useState<'enterPhone' | 'verifyCode'>( - 'enterPhone', - ); - const [buttonState, setButtonState] = useState('default'); // default | counting | sent - const [countdown, setCountdown] = useState(120); - - const handleChangePhoneNumber = () => { - setOpen(true); - }; - const handleClose = () => { - setOpen(false); - setDialogStep('enterPhone'); - }; - const handleSendCode = () => { - setDialogStep('verifyCode'); - setButtonState('sent'); - setTimeout(() => { - setButtonState('counting'); - setCountdown(120); - }, 1000); - }; - const handleResendCode = () => { - setButtonState('sent'); - setTimeout(() => { - setButtonState('counting'); - setCountdown(120); - }, 1000); - }; - - useEffect(() => { - if (buttonState === 'counting' && countdown > 0) { - const timer = setInterval(() => { - setCountdown((prev) => prev - 1); - }, 1000); - return () => clearInterval(timer); - } - if (countdown === 0 && buttonState === 'counting') { - setButtonState('default'); - } - }, [buttonState, countdown]); - - const toPersianDigits = (str: string) => - str.replace(/\d/g, (d: string) => '۰۱۲۳۴۵۶۷۸۹'[parseInt(d)]); - - const getButtonLabel = () => { - if (buttonState === 'sent') return 'ارسال شد!'; - if (buttonState === 'counting') { - const minutes = String(Math.floor(countdown / 60)).padStart(2, '0'); - const seconds = String(countdown % 60).padStart(2, '0'); - const time = `${minutes}:${seconds}`; - return toPersianDigits(time); - } - return 'ارسال دوباره کد'; - }; - - const handleEdit = () => { - setDialogStep('enterPhone'); - }; - - return ( -
- - - - شماره تماس من - - این اطلاعات شما صرفا برای احراز هویت شما است و نزد هارمونی باقی - می‌ماند - - - - - - - - - 09909366045 - - - ۱ ماه پیش - - - - {/* */} - - - - - - ویرایش شماره تماس - - - - - - - {dialogStep === 'enterPhone' ? ( - <> - - شماره تماس جدید - - - شماره تماس جدید جایگزین شماره تماس قبلی شما خواهد شد - - - - - ) : ( - <> - - - - اعتبار سنجی - - - کد تایید 4 رقمی به شماره موبایل شما ارسال شد. لطفا آن را - وارد کنید - - - - - - - - - - - - )} - - - -
- ); -} diff --git a/src/features/profile/component/SocialMedia.tsx b/src/features/profile/component/SocialMedia.tsx deleted file mode 100644 index 8e84bf9..0000000 --- a/src/features/profile/component/SocialMedia.tsx +++ /dev/null @@ -1,210 +0,0 @@ -import { Google, Apple, Sms, Trash, CloseSquare } from 'iconsax-react'; -import { - Box, - Button, - Typography, - Dialog, - DialogTitle, - DialogContent, - IconButton, - TextField, -} from '@mui/material'; -import { useState } from 'react'; - -export function SocialMedia() { - const [open, setOpen] = useState(false); - const handleOpen = () => setOpen(true); - const handleClose = () => setOpen(false); - - const emailList = [ - { email: 'emailtemp@email.com', provider: 'email' }, - { email: 'emailtemp@gmail.com', provider: 'google' }, - ]; - - return ( -
- - - - ایمیل و شبکه‌های اجتماعی من - - این اطلاعات شما صرفاً برای احراز هویت شما است و نزد هارمونی باقی - می‌ماند - - - - - - {emailList.map((item, index) => ( - - - {item.provider === 'google' && ( - - )} - {item.provider === 'apple' && ( - - )} - {item.provider === 'email' && ( - - )} - - - - {item.email} - - ۱ ماه پیش - - - - - - - - ))} - - - - - افزودن ایمیل / سوشال - - - - - - - - - - - - - یا - - - - - - - - - - - -
- ); -} diff --git a/src/features/profile/component/UserForm.tsx b/src/features/profile/component/UserForm.tsx deleted file mode 100644 index 329fc83..0000000 --- a/src/features/profile/component/UserForm.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { PersonalInformation } from './PersonalInformation'; -import { PhoneNumber } from './PhoneNumber'; -import { SocialMedia } from './SocialMedia'; - -export function UserForm() { - return ( - <> - - - - - ); -}