fix: code styles
This commit is contained in:
@@ -12,7 +12,7 @@ import { PageWrapper } from '../PageWrapper';
|
|||||||
import { fetchProfile } from '../../api/settingsApi';
|
import { fetchProfile } from '../../api/settingsApi';
|
||||||
import type { LoginLog } from '../../types/settingsApiType';
|
import type { LoginLog } from '../../types/settingsApiType';
|
||||||
import { useManualApi } from '@/hooks/useApi';
|
import { useManualApi } from '@/hooks/useApi';
|
||||||
import { formatDate } from '@/utils/formatSessionDate'; // ✅ 1. IMPORT the shared function
|
import { formatDate } from '@/utils/formatSessionDate';
|
||||||
|
|
||||||
export function RecentLogins() {
|
export function RecentLogins() {
|
||||||
const { t, i18n } = useTranslation('setting');
|
const { t, i18n } = useTranslation('setting');
|
||||||
|
|||||||
@@ -15,12 +15,7 @@ import {
|
|||||||
confirmPhoneNumberCode,
|
confirmPhoneNumberCode,
|
||||||
changePhoneNumber,
|
changePhoneNumber,
|
||||||
} from '../../api/settingsApi';
|
} from '../../api/settingsApi';
|
||||||
|
import { type Phone } from '../../types/settingsType';
|
||||||
interface Phone {
|
|
||||||
phone: string;
|
|
||||||
time: string;
|
|
||||||
withCode: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function PhoneNumber() {
|
export function PhoneNumber() {
|
||||||
const { t, i18n } = useTranslation('setting');
|
const { t, i18n } = useTranslation('setting');
|
||||||
|
|||||||
@@ -15,12 +15,7 @@ import {
|
|||||||
confirmEmailCode,
|
confirmEmailCode,
|
||||||
changeEmail,
|
changeEmail,
|
||||||
} from '../../api/settingsApi';
|
} from '../../api/settingsApi';
|
||||||
|
import { type EmailAccount } from '../../types/settingsType';
|
||||||
interface EmailAccount {
|
|
||||||
email: string;
|
|
||||||
provider: 'email' | 'google';
|
|
||||||
time: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function SocialMedia() {
|
export function SocialMedia() {
|
||||||
const { t } = useTranslation('setting');
|
const { t } = useTranslation('setting');
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
import { Box, Typography } from '@mui/material';
|
import { Box, Typography } from '@mui/material';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { type DisplayFieldProps } from '@/features/profile/types/settingsType';
|
||||||
interface DisplayFieldProps {
|
|
||||||
label: string;
|
|
||||||
value: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function DisplayField({ label, value }: DisplayFieldProps) {
|
export function DisplayField({ label, value }: DisplayFieldProps) {
|
||||||
const { t } = useTranslation('setting');
|
const { t } = useTranslation('setting');
|
||||||
|
|||||||
@@ -3,20 +3,7 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { DisplayField } from './DisplayField';
|
import { DisplayField } from './DisplayField';
|
||||||
import { CountryFlag } from '@/components/CountryFlag';
|
import { CountryFlag } from '@/components/CountryFlag';
|
||||||
import { Gender } from '@/features/profile/types/settingsType';
|
import { Gender } from '@/features/profile/types/settingsType';
|
||||||
|
import { type InfoRowDisplayProps } 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function InfoRowDisplay({
|
export function InfoRowDisplay({
|
||||||
data,
|
data,
|
||||||
|
|||||||
@@ -11,12 +11,7 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { countries } from '@/features/profile/data/countries';
|
import { countries } from '@/features/profile/data/countries';
|
||||||
import { CountryFlag } from '@/components/CountryFlag';
|
import { CountryFlag } from '@/components/CountryFlag';
|
||||||
import { Gender } from '@/features/profile/types/settingsType';
|
import { Gender } from '@/features/profile/types/settingsType';
|
||||||
import { type InfoRowData } from '@/features/profile/types/settingsType';
|
import { type InfoRowEditProps } from '@/features/profile/types/settingsType';
|
||||||
|
|
||||||
interface InfoRowEditProps {
|
|
||||||
data: InfoRowData;
|
|
||||||
setData: React.Dispatch<React.SetStateAction<InfoRowData>>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function InfoRowEdit({ data, setData }: InfoRowEditProps) {
|
export function InfoRowEdit({ data, setData }: InfoRowEditProps) {
|
||||||
const { t } = useTranslation(['countries', 'setting']);
|
const { t } = useTranslation(['countries', 'setting']);
|
||||||
|
|||||||
@@ -3,16 +3,10 @@ import { Box, Avatar, Typography, Button, IconButton } from '@mui/material';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Camera, Trash } from 'iconsax-react';
|
import { Camera, Trash } from 'iconsax-react';
|
||||||
import { Icon } from '@rkheftan/harmony-ui';
|
import { Icon } from '@rkheftan/harmony-ui';
|
||||||
|
import { type ProfileImageProps } from '@/features/profile/types/settingsType';
|
||||||
|
|
||||||
const MAX_FILE_SIZE_MB = 10;
|
const MAX_FILE_SIZE_MB = 10;
|
||||||
|
|
||||||
interface ProfileImageProps {
|
|
||||||
initials: string;
|
|
||||||
uploadedImageUrl: string | null;
|
|
||||||
onImageChange: (file: File) => void;
|
|
||||||
onRemoveImage?: () => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function ProfileImage({
|
export function ProfileImage({
|
||||||
initials,
|
initials,
|
||||||
uploadedImageUrl,
|
uploadedImageUrl,
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
import { Box, Button } from '@mui/material';
|
import { Box, Button } from '@mui/material';
|
||||||
|
import { type PhoneActionButtonsProps } from '@/features/profile/types/settingsType';
|
||||||
interface PhoneActionButtonsProps {
|
|
||||||
isEditing: boolean;
|
|
||||||
toggleEdit: () => void;
|
|
||||||
t: (key: string) => string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function PhoneActionButtons({
|
export default function PhoneActionButtons({
|
||||||
isEditing,
|
isEditing,
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
import { Box, Typography } from '@mui/material';
|
import { Box, Typography } from '@mui/material';
|
||||||
import { Icon } from '@rkheftan/harmony-ui';
|
import { Icon } from '@rkheftan/harmony-ui';
|
||||||
import { Mobile } from 'iconsax-react';
|
import { Mobile } from 'iconsax-react';
|
||||||
|
import { type PhoneDisplayProps } from '@/features/profile/types/settingsType';
|
||||||
interface PhoneDisplayProps {
|
|
||||||
phones: { phone: string; time: string }[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function PhoneDisplay({ phones }: PhoneDisplayProps) {
|
export default function PhoneDisplay({ phones }: PhoneDisplayProps) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -11,30 +11,7 @@ import { Edit2, TickCircle } from 'iconsax-react';
|
|||||||
import { CountDownTimer } from '@/components/CountDownTimer';
|
import { CountDownTimer } from '@/components/CountDownTimer';
|
||||||
import { CountryCodeSelector } from '../../CountryCodeSelector';
|
import { CountryCodeSelector } from '../../CountryCodeSelector';
|
||||||
import { Icon } from '@rkheftan/harmony-ui';
|
import { Icon } from '@rkheftan/harmony-ui';
|
||||||
|
import { type PhoneEditFormProps } from '@/features/profile/types/settingsType';
|
||||||
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 default function PhoneEditForm({
|
export default function PhoneEditForm({
|
||||||
phoneNumber,
|
phoneNumber,
|
||||||
@@ -55,8 +32,6 @@ export default function PhoneEditForm({
|
|||||||
textFieldRef,
|
textFieldRef,
|
||||||
inputRef,
|
inputRef,
|
||||||
phones,
|
phones,
|
||||||
showToast,
|
|
||||||
setShowToast,
|
|
||||||
t,
|
t,
|
||||||
}: PhoneEditFormProps) {
|
}: PhoneEditFormProps) {
|
||||||
const isValidPhoneNumber = (phone: string) => {
|
const isValidPhoneNumber = (phone: string) => {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import Slide from '@mui/material/Slide';
|
|||||||
import type { TransitionProps } from '@mui/material/transitions';
|
import type { TransitionProps } from '@mui/material/transitions';
|
||||||
import { CloseCircle } from 'iconsax-react';
|
import { CloseCircle } from 'iconsax-react';
|
||||||
import { Icon } from '@rkheftan/harmony-ui';
|
import { Icon } from '@rkheftan/harmony-ui';
|
||||||
|
import { type SocialMediaDialogProps } from '@/features/profile/types/settingsType';
|
||||||
|
|
||||||
const MobileSlide = React.forwardRef(function MobileSlide(
|
const MobileSlide = React.forwardRef(function MobileSlide(
|
||||||
props: TransitionProps & { children: ReactElement<unknown, ElementType> },
|
props: TransitionProps & { children: ReactElement<unknown, ElementType> },
|
||||||
@@ -22,23 +23,6 @@ const MobileSlide = React.forwardRef(function MobileSlide(
|
|||||||
return <Slide direction="up" ref={ref} {...props} />;
|
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({
|
export default function SocialMediaDialog({
|
||||||
open,
|
open,
|
||||||
onClose,
|
onClose,
|
||||||
|
|||||||
@@ -1,15 +1,7 @@
|
|||||||
import { Box, Typography, IconButton } from '@mui/material';
|
import { Box, Typography, IconButton } from '@mui/material';
|
||||||
import { Google, Sms, Trash } from 'iconsax-react';
|
import { Google, Sms, Trash } from 'iconsax-react';
|
||||||
import { Icon } from '@rkheftan/harmony-ui';
|
import { Icon } from '@rkheftan/harmony-ui';
|
||||||
|
import { type SocialMediaListProps } from '@/features/profile/types/settingsType';
|
||||||
interface SocialMediaListProps {
|
|
||||||
t: (key: string) => string;
|
|
||||||
emailList: readonly {
|
|
||||||
email: string;
|
|
||||||
provider: 'email' | 'google' | 'apple';
|
|
||||||
time: string;
|
|
||||||
}[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function SocialMediaList({ emailList }: SocialMediaListProps) {
|
export default function SocialMediaList({ emailList }: SocialMediaListProps) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -9,11 +9,7 @@ import {
|
|||||||
} from '@mui/material';
|
} from '@mui/material';
|
||||||
import { Message, Google, Apple, ArrowDown3 } from 'iconsax-react';
|
import { Message, Google, Apple, ArrowDown3 } from 'iconsax-react';
|
||||||
import { Icon } from '@rkheftan/harmony-ui';
|
import { Icon } from '@rkheftan/harmony-ui';
|
||||||
|
import { type SocialMediaMenuProps } from '@/features/profile/types/settingsType';
|
||||||
interface SocialMediaMenuProps {
|
|
||||||
t: (key: string) => string;
|
|
||||||
onOpenDialog: () => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function SocialMediaMenu({
|
export default function SocialMediaMenu({
|
||||||
t,
|
t,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export interface InfoRowData {
|
|||||||
firstName: string;
|
firstName: string;
|
||||||
lastName: string;
|
lastName: string;
|
||||||
nationalCode: string;
|
nationalCode: string;
|
||||||
country: string;
|
country: string | '';
|
||||||
gender: Gender;
|
gender: Gender;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,3 +44,103 @@ export interface ValidationItemProps {
|
|||||||
isValid: boolean;
|
isValid: boolean;
|
||||||
label: string;
|
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;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user