diff --git a/src/features/profile/components/security/RecentLogins.tsx b/src/features/profile/components/security/RecentLogins.tsx index c21ce57..a285229 100644 --- a/src/features/profile/components/security/RecentLogins.tsx +++ b/src/features/profile/components/security/RecentLogins.tsx @@ -12,7 +12,7 @@ import { PageWrapper } from '../PageWrapper'; import { fetchProfile } from '../../api/settingsApi'; import type { LoginLog } from '../../types/settingsApiType'; import { useManualApi } from '@/hooks/useApi'; -import { formatDate } from '@/utils/formatSessionDate'; // ✅ 1. IMPORT the shared function +import { formatDate } from '@/utils/formatSessionDate'; export function RecentLogins() { const { t, i18n } = useTranslation('setting'); diff --git a/src/features/profile/components/userInformation/PhoneNumber.tsx b/src/features/profile/components/userInformation/PhoneNumber.tsx index 0055d6f..148e937 100644 --- a/src/features/profile/components/userInformation/PhoneNumber.tsx +++ b/src/features/profile/components/userInformation/PhoneNumber.tsx @@ -15,12 +15,7 @@ import { confirmPhoneNumberCode, changePhoneNumber, } from '../../api/settingsApi'; - -interface Phone { - phone: string; - time: string; - withCode: string; -} +import { type Phone } from '../../types/settingsType'; export function PhoneNumber() { const { t, i18n } = useTranslation('setting'); diff --git a/src/features/profile/components/userInformation/SocialMedia.tsx b/src/features/profile/components/userInformation/SocialMedia.tsx index 3c6c286..98dc1ab 100644 --- a/src/features/profile/components/userInformation/SocialMedia.tsx +++ b/src/features/profile/components/userInformation/SocialMedia.tsx @@ -15,12 +15,7 @@ import { confirmEmailCode, changeEmail, } from '../../api/settingsApi'; - -interface EmailAccount { - email: string; - provider: 'email' | 'google'; - time: string; -} +import { type EmailAccount } from '../../types/settingsType'; export function SocialMedia() { const { t } = useTranslation('setting'); diff --git a/src/features/profile/components/userInformation/personalInformation/DisplayField.tsx b/src/features/profile/components/userInformation/personalInformation/DisplayField.tsx index a53025d..4dd1ee3 100644 --- a/src/features/profile/components/userInformation/personalInformation/DisplayField.tsx +++ b/src/features/profile/components/userInformation/personalInformation/DisplayField.tsx @@ -1,10 +1,6 @@ import { Box, Typography } from '@mui/material'; import { useTranslation } from 'react-i18next'; - -interface DisplayFieldProps { - label: string; - value: string; -} +import { type DisplayFieldProps } from '@/features/profile/types/settingsType'; export function DisplayField({ label, value }: DisplayFieldProps) { const { t } = useTranslation('setting'); diff --git a/src/features/profile/components/userInformation/personalInformation/InfoRowDisplay.tsx b/src/features/profile/components/userInformation/personalInformation/InfoRowDisplay.tsx index 01ef683..9f95ceb 100644 --- a/src/features/profile/components/userInformation/personalInformation/InfoRowDisplay.tsx +++ b/src/features/profile/components/userInformation/personalInformation/InfoRowDisplay.tsx @@ -3,20 +3,7 @@ import { useTranslation } from 'react-i18next'; import { DisplayField } from './DisplayField'; import { CountryFlag } from '@/components/CountryFlag'; import { Gender } from '@/features/profile/types/settingsType'; - -interface InfoRowData { - firstName: string; - lastName: string; - country: string; - gender: Gender | ''; - nationalCode: string; -} - -interface InfoRowDisplayProps { - data: InfoRowData; - uploadedImageUrl: string | null; - initials: string; -} +import { type InfoRowDisplayProps } from '@/features/profile/types/settingsType'; export function InfoRowDisplay({ data, diff --git a/src/features/profile/components/userInformation/personalInformation/InfoRowEdit.tsx b/src/features/profile/components/userInformation/personalInformation/InfoRowEdit.tsx index 7ee018c..3c7f9c6 100644 --- a/src/features/profile/components/userInformation/personalInformation/InfoRowEdit.tsx +++ b/src/features/profile/components/userInformation/personalInformation/InfoRowEdit.tsx @@ -11,12 +11,7 @@ import { useTranslation } from 'react-i18next'; import { countries } from '@/features/profile/data/countries'; import { CountryFlag } from '@/components/CountryFlag'; import { Gender } from '@/features/profile/types/settingsType'; -import { type InfoRowData } from '@/features/profile/types/settingsType'; - -interface InfoRowEditProps { - data: InfoRowData; - setData: React.Dispatch>; -} +import { type InfoRowEditProps } from '@/features/profile/types/settingsType'; export function InfoRowEdit({ data, setData }: InfoRowEditProps) { const { t } = useTranslation(['countries', 'setting']); diff --git a/src/features/profile/components/userInformation/personalInformation/ProfileImage.tsx b/src/features/profile/components/userInformation/personalInformation/ProfileImage.tsx index 94697c4..4baa6ad 100644 --- a/src/features/profile/components/userInformation/personalInformation/ProfileImage.tsx +++ b/src/features/profile/components/userInformation/personalInformation/ProfileImage.tsx @@ -3,16 +3,10 @@ import { Box, Avatar, Typography, Button, IconButton } from '@mui/material'; import { useTranslation } from 'react-i18next'; import { Camera, Trash } from 'iconsax-react'; import { Icon } from '@rkheftan/harmony-ui'; +import { type ProfileImageProps } from '@/features/profile/types/settingsType'; const MAX_FILE_SIZE_MB = 10; -interface ProfileImageProps { - initials: string; - uploadedImageUrl: string | null; - onImageChange: (file: File) => void; - onRemoveImage?: () => void; -} - export function ProfileImage({ initials, uploadedImageUrl, diff --git a/src/features/profile/components/userInformation/phoneNumber/PhoneActionButtons.tsx b/src/features/profile/components/userInformation/phoneNumber/PhoneActionButtons.tsx index 0477273..6f523ac 100644 --- a/src/features/profile/components/userInformation/phoneNumber/PhoneActionButtons.tsx +++ b/src/features/profile/components/userInformation/phoneNumber/PhoneActionButtons.tsx @@ -1,10 +1,5 @@ import { Box, Button } from '@mui/material'; - -interface PhoneActionButtonsProps { - isEditing: boolean; - toggleEdit: () => void; - t: (key: string) => string; -} +import { type PhoneActionButtonsProps } from '@/features/profile/types/settingsType'; export default function PhoneActionButtons({ isEditing, diff --git a/src/features/profile/components/userInformation/phoneNumber/PhoneDisplay.tsx b/src/features/profile/components/userInformation/phoneNumber/PhoneDisplay.tsx index 72f5733..76f2c0f 100644 --- a/src/features/profile/components/userInformation/phoneNumber/PhoneDisplay.tsx +++ b/src/features/profile/components/userInformation/phoneNumber/PhoneDisplay.tsx @@ -1,10 +1,7 @@ import { Box, Typography } from '@mui/material'; import { Icon } from '@rkheftan/harmony-ui'; import { Mobile } from 'iconsax-react'; - -interface PhoneDisplayProps { - phones: { phone: string; time: string }[]; -} +import { type PhoneDisplayProps } from '@/features/profile/types/settingsType'; export default function PhoneDisplay({ phones }: PhoneDisplayProps) { return ( diff --git a/src/features/profile/components/userInformation/phoneNumber/PhoneEditForm.tsx b/src/features/profile/components/userInformation/phoneNumber/PhoneEditForm.tsx index 4477b82..b900bc9 100644 --- a/src/features/profile/components/userInformation/phoneNumber/PhoneEditForm.tsx +++ b/src/features/profile/components/userInformation/phoneNumber/PhoneEditForm.tsx @@ -11,30 +11,7 @@ import { Edit2, TickCircle } from 'iconsax-react'; import { CountDownTimer } from '@/components/CountDownTimer'; import { CountryCodeSelector } from '../../CountryCodeSelector'; import { Icon } from '@rkheftan/harmony-ui'; - -interface PhoneEditFormProps { - phoneNumber: string; - setPhoneNumber: (v: string) => void; - countryCode: string; - setCountryCode: (v: string) => void; - verificationCode: string; - setVerificationCode: (v: string) => void; - isVerified: boolean; - isVerifying: boolean; - buttonState: 'default' | 'counting'; - setButtonState: (v: 'default' | 'counting') => void; - handleSendCode: () => void; - handleVerifyClick: () => void; - error?: string; - inputError: boolean; - handleBlur: () => void; - textFieldRef: React.RefObject; - inputRef: React.RefObject; - phones: { phone: string; time: string; withCode: string }[]; - showToast: boolean; - setShowToast: (v: boolean) => void; - t: (key: string) => string; -} +import { type PhoneEditFormProps } from '@/features/profile/types/settingsType'; export default function PhoneEditForm({ phoneNumber, @@ -55,8 +32,6 @@ export default function PhoneEditForm({ textFieldRef, inputRef, phones, - showToast, - setShowToast, t, }: PhoneEditFormProps) { const isValidPhoneNumber = (phone: string) => { diff --git a/src/features/profile/components/userInformation/socialMedia/SocialMediaDialog.tsx b/src/features/profile/components/userInformation/socialMedia/SocialMediaDialog.tsx index 191f3f8..7d7b48a 100644 --- a/src/features/profile/components/userInformation/socialMedia/SocialMediaDialog.tsx +++ b/src/features/profile/components/userInformation/socialMedia/SocialMediaDialog.tsx @@ -14,6 +14,7 @@ import Slide from '@mui/material/Slide'; import type { TransitionProps } from '@mui/material/transitions'; import { CloseCircle } from 'iconsax-react'; import { Icon } from '@rkheftan/harmony-ui'; +import { type SocialMediaDialogProps } from '@/features/profile/types/settingsType'; const MobileSlide = React.forwardRef(function MobileSlide( props: TransitionProps & { children: ReactElement }, @@ -22,23 +23,6 @@ const MobileSlide = React.forwardRef(function MobileSlide( return ; }); -interface SocialMediaDialogProps { - open: boolean; - onClose: () => void; - t: (key: string) => string; - emailInput: string; - setEmailInput: (val: string) => void; - fullScreen: boolean; - computedMaxWidth: 'xs' | 'sm' | 'md' | 'lg' | 'xl'; - verificationCode: string; - setVerificationCode: (value: string) => void; - apiError: string | null; - isLoading: boolean; - dialogStep: 'enterEmail' | 'enterCode'; - onSendCode: () => void; - onConfirmEmail: () => void; -} - export default function SocialMediaDialog({ open, onClose, diff --git a/src/features/profile/components/userInformation/socialMedia/SocialMediaList.tsx b/src/features/profile/components/userInformation/socialMedia/SocialMediaList.tsx index 320e5d9..85782c2 100644 --- a/src/features/profile/components/userInformation/socialMedia/SocialMediaList.tsx +++ b/src/features/profile/components/userInformation/socialMedia/SocialMediaList.tsx @@ -1,15 +1,7 @@ import { Box, Typography, IconButton } from '@mui/material'; import { Google, Sms, Trash } from 'iconsax-react'; import { Icon } from '@rkheftan/harmony-ui'; - -interface SocialMediaListProps { - t: (key: string) => string; - emailList: readonly { - email: string; - provider: 'email' | 'google' | 'apple'; - time: string; - }[]; -} +import { type SocialMediaListProps } from '@/features/profile/types/settingsType'; export default function SocialMediaList({ emailList }: SocialMediaListProps) { return ( diff --git a/src/features/profile/components/userInformation/socialMedia/SocialMediaMenu.tsx b/src/features/profile/components/userInformation/socialMedia/SocialMediaMenu.tsx index c92f237..ebc3f9c 100644 --- a/src/features/profile/components/userInformation/socialMedia/SocialMediaMenu.tsx +++ b/src/features/profile/components/userInformation/socialMedia/SocialMediaMenu.tsx @@ -9,11 +9,7 @@ import { } from '@mui/material'; import { Message, Google, Apple, ArrowDown3 } from 'iconsax-react'; import { Icon } from '@rkheftan/harmony-ui'; - -interface SocialMediaMenuProps { - t: (key: string) => string; - onOpenDialog: () => void; -} +import { type SocialMediaMenuProps } from '@/features/profile/types/settingsType'; export default function SocialMediaMenu({ t, diff --git a/src/features/profile/types/settingsType.ts b/src/features/profile/types/settingsType.ts index 41d83f4..fac5e45 100644 --- a/src/features/profile/types/settingsType.ts +++ b/src/features/profile/types/settingsType.ts @@ -8,7 +8,7 @@ export interface InfoRowData { firstName: string; lastName: string; nationalCode: string; - country: string; + country: string | ''; gender: Gender; } @@ -44,3 +44,103 @@ export interface ValidationItemProps { isValid: boolean; label: string; } + +export interface SocialMediaDialogProps { + open: boolean; + onClose: () => void; + t: (key: string) => string; + emailInput: string; + setEmailInput: (val: string) => void; + fullScreen: boolean; + computedMaxWidth: 'xs' | 'sm' | 'md' | 'lg' | 'xl'; + verificationCode: string; + setVerificationCode: (value: string) => void; + apiError: string | null; + isLoading: boolean; + dialogStep: 'enterEmail' | 'enterCode'; + onSendCode: () => void; + onConfirmEmail: () => void; +} + +export interface SocialMediaListProps { + t: (key: string) => string; + emailList: readonly { + email: string; + provider: 'email' | 'google' | 'apple'; + time: string; + }[]; +} + +export interface SocialMediaMenuProps { + t: (key: string) => string; + onOpenDialog: () => void; +} + +export interface Phone { + phone: string; + time: string; + withCode: string; +} + +export interface EmailAccount { + email: string; + provider: 'email' | 'google'; + time: string; +} + +export interface PhoneActionButtonsProps { + isEditing: boolean; + toggleEdit: () => void; + t: (key: string) => string; +} + +export interface PhoneDisplayProps { + phones: { phone: string; time: string }[]; +} + +export interface PhoneEditFormProps { + phoneNumber: string; + setPhoneNumber: (v: string) => void; + countryCode: string; + setCountryCode: (v: string) => void; + verificationCode: string; + setVerificationCode: (v: string) => void; + isVerified: boolean; + isVerifying: boolean; + buttonState: 'default' | 'counting'; + setButtonState: (v: 'default' | 'counting') => void; + handleSendCode: () => void; + handleVerifyClick: () => void; + error?: string; + inputError: boolean; + handleBlur: () => void; + textFieldRef: React.RefObject; + inputRef: React.RefObject; + phones: { phone: string; time: string; withCode: string }[]; + showToast: boolean; + setShowToast: (v: boolean) => void; + t: (key: string) => string; +} + +export interface DisplayFieldProps { + label: string; + value: string; +} + +export interface InfoRowDisplayProps { + data: InfoRowData; + uploadedImageUrl: string | null; + initials: string; +} + +export interface InfoRowEditProps { + data: InfoRowData; + setData: React.Dispatch>; +} + +export interface ProfileImageProps { + initials: string; + uploadedImageUrl: string | null; + onImageChange: (file: File) => void; + onRemoveImage?: () => void; +}