empty page

This commit is contained in:
hamid zarghami
2025-03-17 23:43:44 +03:30
parent 741350df62
commit 6badc5fb31
8 changed files with 128 additions and 48 deletions
-1
View File
@@ -61,7 +61,6 @@ const queryClient = new QueryClient({
try { try {
const refreshTokenValue = await getRefreshToken(); const refreshTokenValue = await getRefreshToken();
const { data } = await refreshToken({ refreshToken: refreshTokenValue || '' }); const { data } = await refreshToken({ refreshToken: refreshTokenValue || '' });
console.log('data', data);
if (data?.accessToken?.token) { if (data?.accessToken?.token) {
// Save the new token // Save the new token
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

+6
View File
@@ -463,5 +463,11 @@
"status": "وضعیت", "status": "وضعیت",
"active": "فعال", "active": "فعال",
"deactive": "غیرفعال" "deactive": "غیرفعال"
},
"empty": {
"empty_my_service": "سرویسی یافت نشد.",
"add_service": "افزودن سرویس",
"empty_discount": "تخفیفی یافت نشد.",
"my_services": "سرویس های من"
} }
} }
+5
View File
@@ -5,6 +5,7 @@ import Td from '../../components/Td'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { DiscountItemType } from './types/DiscountTypes' import { DiscountItemType } from './types/DiscountTypes'
import moment from 'moment-jalaali' import moment from 'moment-jalaali'
import EmptyDiscount from './components/EmptyDiscount'
const MyDiscountList: FC = () => { const MyDiscountList: FC = () => {
@@ -17,6 +18,7 @@ const MyDiscountList: FC = () => {
getDiscounts.isPending ? getDiscounts.isPending ?
<PageLoading /> <PageLoading />
: :
getDiscounts.data?.data?.discounts?.length > 0 ?
<div className='relative overflow-x-auto rounded-3xl mt-9 w-full'> <div className='relative overflow-x-auto rounded-3xl mt-9 w-full'>
<table className='w-full text-sm '> <table className='w-full text-sm '>
<thead className='thead'> <thead className='thead'>
@@ -33,6 +35,7 @@ const MyDiscountList: FC = () => {
</thead> </thead>
<tbody> <tbody>
{ {
getDiscounts.data?.data?.discounts?.map((item: DiscountItemType, index: number) => { getDiscounts.data?.data?.discounts?.map((item: DiscountItemType, index: number) => {
return ( return (
<tr key={item.id} className='tr'> <tr key={item.id} className='tr'>
@@ -53,6 +56,8 @@ const MyDiscountList: FC = () => {
</tbody> </tbody>
</table> </table>
</div> </div>
:
<EmptyDiscount />
} }
</div> </div>
) )
@@ -0,0 +1,33 @@
import { FC } from 'react'
import empty from '../../../assets/images/discount_empty_icon.png'
import { useTranslation } from 'react-i18next'
import Button from '../../../components/Button'
import { Add } from 'iconsax-react'
import { Link } from 'react-router-dom'
import { Pages } from '../../../config/Pages'
const EmptyDiscount: FC = () => {
const { t } = useTranslation('global')
return (
<div className='bg-white xl:p-8 p-4 rounded-3xl w-full'>
<div className='flex flex-col items-center justify-center'>
<img src={empty} alt='empty' className='w-[85px]' />
<div className='mt-6 text-xs'>
{t('empty.empty_discount')}
</div>
<Link to={Pages.services.mine} className='mt-6'>
<Button
className='w-full px-4'
>
<div className='flex items-center gap-2'>
<Add size={20} color='white' />
{t('empty.my_services')}
</div>
</Button>
</Link>
</div>
</div>
)
}
export default EmptyDiscount
+4
View File
@@ -8,6 +8,7 @@ import { AdsDisplayLocation } from '../ads/types/AdsTypes'
import { Helmet } from 'react-helmet-async' import { Helmet } from 'react-helmet-async'
import ServiceItemSkeleton from './components/ServiceItemSkeleton' import ServiceItemSkeleton from './components/ServiceItemSkeleton'
import ServiceItem from '../../components/ServiceItem' import ServiceItem from '../../components/ServiceItem'
import EmptyMyService from './components/EmptyMyService'
const MyServices: FC = () => { const MyServices: FC = () => {
@@ -55,6 +56,7 @@ const MyServices: FC = () => {
getServices.isPending ? getServices.isPending ?
Array.from({ length: 4 }).map((_, index) => <ServiceItemSkeleton key={index} />) Array.from({ length: 4 }).map((_, index) => <ServiceItemSkeleton key={index} />)
: :
getServices.data?.data?.subscriptions?.length > 0 ?
getServices.data?.data?.subscriptions?.map((item: MyServicesItem) => { getServices.data?.data?.subscriptions?.map((item: MyServicesItem) => {
return ( return (
<ServiceItem <ServiceItem
@@ -66,6 +68,8 @@ const MyServices: FC = () => {
/> />
) )
}) })
:
<EmptyMyService />
} }
<div className='flex-1 min-w-[40%] xl:min-w-[20%] px-6'></div> <div className='flex-1 min-w-[40%] xl:min-w-[20%] px-6'></div>
<div className='flex-1 min-w-[40%] xl:min-w-[20%] px-6'></div> <div className='flex-1 min-w-[40%] xl:min-w-[20%] px-6'></div>
@@ -0,0 +1,33 @@
import { FC } from 'react'
import empty from '../../../assets/images/myservices_empty_icon.png'
import { useTranslation } from 'react-i18next'
import Button from '../../../components/Button'
import { Add } from 'iconsax-react'
import { Link } from 'react-router-dom'
import { Pages } from '../../../config/Pages'
const EmptyMyService: FC = () => {
const { t } = useTranslation('global')
return (
<div className='bg-white xl:p-8 p-4 rounded-3xl w-full'>
<div className='flex flex-col items-center justify-center'>
<img src={empty} alt='empty' className='w-[85px]' />
<div className='mt-6 text-xs'>
{t('empty.empty_my_service')}
</div>
<Link to={Pages.services.other} className='mt-6'>
<Button
className='w-full px-4'
>
<div className='flex items-center gap-2'>
<Add size={20} color='white' />
{t('empty.add_service')}
</div>
</Button>
</Link>
</div>
</div>
)
}
export default EmptyMyService