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