show true data profile
This commit is contained in:
@@ -3,27 +3,32 @@
|
||||
import Button from '@/components/button/PrimaryButton';
|
||||
// import { useProfile } from '@/hooks/auth/useProfile';
|
||||
// import { useAuthStore } from '@/zustand/authStore';
|
||||
import { ArrowLeft, Calendar2, CallCalling, Profile, Sms, Verify } from 'iconsax-react';
|
||||
import { ArrowLeft, Calendar2, CallCalling, Profile } from 'iconsax-react';
|
||||
import Image from 'next/image';
|
||||
import Link from 'next/link';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import React from 'react'
|
||||
import { useGetProfile } from './hooks/userProfileData';
|
||||
|
||||
type Props = object
|
||||
|
||||
function ProfileIndex({ }: Props) {
|
||||
|
||||
const router = useRouter();
|
||||
const { data, isPending } = useGetProfile();
|
||||
|
||||
// const isAuthenticated = useAuthStore((state) => state.isAuthenticated);
|
||||
const formatDate = (dateString: string): string => {
|
||||
const date = new Date(dateString);
|
||||
return date.toLocaleDateString('fa-IR', {
|
||||
year: 'numeric',
|
||||
month: 'numeric',
|
||||
day: 'numeric'
|
||||
});
|
||||
};
|
||||
|
||||
// const { mutate, data, isPending } = useProfile();
|
||||
|
||||
// useEffect(() => {
|
||||
// if (isAuthenticated) {
|
||||
// mutate();
|
||||
// }
|
||||
// // eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
// }, [isAuthenticated])
|
||||
const userData = data?.data;
|
||||
const fullName = userData ? `${userData.firstName} ${userData.lastName}` : '';
|
||||
const genderText = userData?.gender ? 'آقا' : 'خانوم';
|
||||
|
||||
return (
|
||||
<div className='overflow-y-auto h-full noscrollbar flex flex-col'>
|
||||
@@ -50,14 +55,16 @@ function ProfileIndex({ }: Props) {
|
||||
height={80}
|
||||
/>
|
||||
<div className='block'>
|
||||
<div className='font-medium text-base '>علیرضا عابدزاده</div>
|
||||
<div className='text-xs text-primary dark:text-neutral-200 mt-3 inline-flex items-center gap-2'>
|
||||
<div className='font-medium text-base '>
|
||||
{isPending ? 'در حال بارگذاری...' : fullName || '-'}
|
||||
</div>
|
||||
{/* <div className='text-xs text-primary dark:text-neutral-200 mt-3 inline-flex items-center gap-2'>
|
||||
<Verify size={16} className='stroke-primary dark:stroke-foreground mb-0.5' />
|
||||
<span>
|
||||
شناسه کاربری:
|
||||
</span>
|
||||
<span>2162165</span>
|
||||
</div>
|
||||
<span>{isPending ? '...' : userData?.id || '-'}</span>
|
||||
</div> */}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -65,22 +72,19 @@ function ProfileIndex({ }: Props) {
|
||||
<div className='inline-flex items-center gap-2.5'>
|
||||
<CallCalling size={16} className='stroke-disabled2 dark:stroke-gray-300 mb-0.5' />
|
||||
<span className='text-sm2 text-disabled2 dark:text-gray-300'>شماره همراه:</span>
|
||||
<span className='text-sm2'>09010901738</span>
|
||||
</div>
|
||||
<div className='inline-flex items-center gap-2.5'>
|
||||
<Sms size={16} className='stroke-disabled2 dark:stroke-gray-300 mb-0.5' />
|
||||
<span className='text-sm2 text-disabled2 dark:text-gray-300'>ایمیل:</span>
|
||||
<span className='text-sm2'>alirezaabed@gmail.com</span>
|
||||
<span className='text-sm2'>{isPending ? '...' : userData?.phone || '-'}</span>
|
||||
</div>
|
||||
<div className='inline-flex items-center gap-2.5'>
|
||||
<Calendar2 size={16} className='stroke-disabled2 dark:stroke-gray-300 mb-0.5' />
|
||||
<span className='text-sm2 text-disabled2 dark:text-gray-300'>تاریخ تولد:</span>
|
||||
<span className='text-sm2'>1375/5/14</span>
|
||||
<span className='text-sm2'>
|
||||
{isPending ? '...' : (userData?.birthDate ? formatDate(userData.birthDate) : '-')}
|
||||
</span>
|
||||
</div>
|
||||
<div className='inline-flex items-center gap-2.5'>
|
||||
<Profile size={16} className='stroke-disabled2 dark:stroke-gray-300 mb-0.5' />
|
||||
<span className='text-sm2 text-disabled2 dark:text-gray-300'>جنسیت:</span>
|
||||
<span className='text-sm2'>آقا</span>
|
||||
<span className='text-sm2'>{isPending ? '...' : genderText}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user