fix: code styles

This commit is contained in:
Koosha Lahouti
2025-08-15 15:29:14 +03:30
parent 0b42f4ccba
commit fe8947790d
14 changed files with 114 additions and 113 deletions

View File

@@ -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');

View File

@@ -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');

View File

@@ -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');

View File

@@ -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');

View File

@@ -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,

View File

@@ -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<React.SetStateAction<InfoRowData>>;
}
import { type InfoRowEditProps } from '@/features/profile/types/settingsType';
export function InfoRowEdit({ data, setData }: InfoRowEditProps) {
const { t } = useTranslation(['countries', 'setting']);

View File

@@ -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,

View File

@@ -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,

View File

@@ -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 (

View File

@@ -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<HTMLDivElement>;
inputRef: React.RefObject<HTMLInputElement>;
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) => {

View File

@@ -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<unknown, ElementType> },
@@ -22,23 +23,6 @@ const MobileSlide = React.forwardRef(function MobileSlide(
return <Slide direction="up" ref={ref} {...props} />;
});
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,

View File

@@ -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 (

View File

@@ -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,

View File

@@ -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<HTMLDivElement>;
inputRef: React.RefObject<HTMLInputElement>;
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<React.SetStateAction<InfoRowData>>;
}
export interface ProfileImageProps {
initials: string;
uploadedImageUrl: string | null;
onImageChange: (file: File) => void;
onRemoveImage?: () => void;
}