call back and service item skeleton
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
import { CloseCircle, InfoCircle, TickCircle } from 'iconsax-react'
|
||||
import { FC } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { NumberFormat } from '../../config/func'
|
||||
import Button from '../../components/Button'
|
||||
import { useSearchParams } from "react-router-dom";
|
||||
import moment from 'moment-jalaali'
|
||||
|
||||
const CallBack: FC = () => {
|
||||
|
||||
const [searchParams] = useSearchParams();
|
||||
const { t } = useTranslation('global')
|
||||
|
||||
const params = {
|
||||
status: searchParams.get('status') as 'PENDING' | 'FAILED' | 'COMPLETED',
|
||||
id: searchParams.get('id'),
|
||||
date: searchParams.get('date'),
|
||||
amount: searchParams.get('amount'),
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<div className='flex mt-10 flex-col justify-center items-center flex-1 h-full'>
|
||||
{
|
||||
params.status === 'COMPLETED' ?
|
||||
<TickCircle
|
||||
size={64}
|
||||
color={'#00712D'}
|
||||
/>
|
||||
:
|
||||
params.status === 'FAILED' ?
|
||||
<CloseCircle
|
||||
size={64}
|
||||
color='#D52903'
|
||||
/>
|
||||
:
|
||||
<InfoCircle
|
||||
size={64}
|
||||
color='#FFA800'
|
||||
/>
|
||||
}
|
||||
|
||||
<div className='mt-7 text-xl'>
|
||||
{
|
||||
params.status === 'COMPLETED' ?
|
||||
t('callback.title_success')
|
||||
:
|
||||
params.status === 'FAILED' ?
|
||||
t('callback.failed')
|
||||
:
|
||||
t('callback.pending')
|
||||
}
|
||||
</div>
|
||||
|
||||
<div className='mt-7'>
|
||||
{
|
||||
params.status === 'COMPLETED' ?
|
||||
t('callback.desc_success')
|
||||
:
|
||||
params.status === 'FAILED' ?
|
||||
t('callback.desc_failed')
|
||||
:
|
||||
t('callback.desc_pending')
|
||||
}
|
||||
</div>
|
||||
|
||||
<div className='mt-16 xl:min-w-[560px] bg-[#FBFBFD] p-8 text-sm'>
|
||||
<div className='flex justify-between'>
|
||||
<div>
|
||||
{t('callback.order_number')}
|
||||
</div>
|
||||
<div>
|
||||
{params.id}
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex justify-between mt-6'>
|
||||
<div>
|
||||
{t('callback.amount')}
|
||||
</div>
|
||||
<div>
|
||||
{NumberFormat(Number(params.amount)) + ' ' + t('toman')}
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex justify-between mt-6'>
|
||||
<div>
|
||||
{t('callback.date')}
|
||||
</div>
|
||||
<div>
|
||||
{moment(params.date).format('jYYYY/jMM/jDD')}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
label={t('callback.back')}
|
||||
className='xl:max-w-[560px] mt-8'
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default CallBack
|
||||
@@ -26,7 +26,7 @@ const Email: FC<Props> = (props: Props) => {
|
||||
const handleShowModal = () => {
|
||||
updateEmail.mutate({ email: email }, {
|
||||
onSuccess: () => {
|
||||
setShowModal(true)
|
||||
toast.success(t('profile.link_email'))
|
||||
},
|
||||
onError: (error: ErrorType) => {
|
||||
toast.error(error.response?.data?.error.message[0])
|
||||
|
||||
@@ -23,12 +23,12 @@ export const updateProfile = async (params: UpdateProfileType) => {
|
||||
};
|
||||
|
||||
export const updateEmail = async (params: UpdateEmailType) => {
|
||||
const { data } = await axios.patch(`/users/update-email`, params);
|
||||
const { data } = await axios.patch(`/users/change-email`, params);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const updatePhone = async (params: UpdatePhoneType) => {
|
||||
const { data } = await axios.patch(`/users/update-phone`, params);
|
||||
const { data } = await axios.patch(`/users/change-phone`, params);
|
||||
return data;
|
||||
};
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import { MyServicesItem } from './types/ServiecTypes'
|
||||
import { useGetAds } from '../ads/hooks/useAdsData'
|
||||
import { AdsDisplayLocation } from '../ads/types/AdsTypes'
|
||||
import { Helmet } from 'react-helmet-async'
|
||||
import ServiceItemSkeleton from './components/ServiceItemSkeleton'
|
||||
|
||||
const MyServices: FC = () => {
|
||||
|
||||
@@ -53,40 +54,42 @@ const MyServices: FC = () => {
|
||||
</div>
|
||||
|
||||
<div className='flex items-stretch flex-wrap xl:gap-6 gap-4 xl:items-center mt-8'>
|
||||
|
||||
{
|
||||
getServices.data?.data?.subscriptions?.map((item: MyServicesItem) => {
|
||||
return (
|
||||
<Link key={item.id} to={Pages.services.detail + item.id} className='flex-1 min-w-[40%] xl:min-w-[20%] bg-white rounded-3xl p-6'>
|
||||
<ServiceSection
|
||||
item={{
|
||||
author: item.plan.service.author,
|
||||
createDate: item.plan?.service?.createDate,
|
||||
createdAt: item.createdAt,
|
||||
description: item.plan?.service?.title,
|
||||
icon: item.plan?.service.icon,
|
||||
id: item.plan.service.id,
|
||||
isActive: item.plan.isActive,
|
||||
isDanakSuggest: item.plan.service.isDanakSuggest,
|
||||
link: item.plan.service.link,
|
||||
metaDescription: item.plan.service.metaDescription,
|
||||
name: item.plan.service.name,
|
||||
serviceLanguage: item.plan.service.serviceLanguage,
|
||||
softwareLanguage: item.plan.service.softwareLanguage,
|
||||
updatedAt: item.plan.service.updatedAt,
|
||||
userCount: item.plan.service?.userCount
|
||||
}}
|
||||
/>
|
||||
<div className='mt-6 flex gap-1 items-center'>
|
||||
<StatusCircle
|
||||
color='#00BA4B'
|
||||
getServices.isPending ?
|
||||
Array.from({ length: 4 }).map((_, index) => <ServiceItemSkeleton key={index} />)
|
||||
:
|
||||
getServices.data?.data?.subscriptions?.map((item: MyServicesItem) => {
|
||||
return (
|
||||
<Link key={item.id} to={Pages.services.detail + item.id} className='flex-1 min-w-[40%] xl:min-w-[20%] bg-white rounded-3xl p-6'>
|
||||
<ServiceSection
|
||||
item={{
|
||||
author: item.plan.service.author,
|
||||
createDate: item.plan?.service?.createDate,
|
||||
createdAt: item.createdAt,
|
||||
description: item.plan?.service?.title,
|
||||
icon: item.plan?.service.icon,
|
||||
id: item.plan.service.id,
|
||||
isActive: item.plan.isActive,
|
||||
isDanakSuggest: item.plan.service.isDanakSuggest,
|
||||
link: item.plan.service.link,
|
||||
metaDescription: item.plan.service.metaDescription,
|
||||
name: item.plan.service.name,
|
||||
serviceLanguage: item.plan.service.serviceLanguage,
|
||||
softwareLanguage: item.plan.service.softwareLanguage,
|
||||
updatedAt: item.plan.service.updatedAt,
|
||||
userCount: item.plan.service?.userCount
|
||||
}}
|
||||
/>
|
||||
<div className='text-xs text-description'>1 {t('service.active_menu')}</div>
|
||||
</div>
|
||||
<div className='mt-6 flex gap-1 items-center'>
|
||||
<StatusCircle
|
||||
color='#00BA4B'
|
||||
/>
|
||||
<div className='text-xs text-description'>1 {t('service.active_menu')}</div>
|
||||
</div>
|
||||
|
||||
</Link>
|
||||
)
|
||||
})
|
||||
</Link>
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import { FC } from 'react'
|
||||
import Skeleton from 'react-loading-skeleton'
|
||||
|
||||
const ServiceItemSkeleton: FC = () => {
|
||||
return (
|
||||
<Skeleton
|
||||
containerClassName='flex-1 min-w-[40%] xl:min-w-[20%]'
|
||||
className='min-h-[128px] !rounded-3xl '
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export default ServiceItemSkeleton
|
||||
@@ -11,5 +11,5 @@ export const updateSettings = async (params: UpdateSettingType) => {
|
||||
};
|
||||
|
||||
export const changePassword = async (params: ChangePasswordType) => {
|
||||
await axios.patch(`/auth/password`, params);
|
||||
await axios.patch(`/auth/change-password`, params);
|
||||
};
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
import { TickCircle } from 'iconsax-react'
|
||||
import { FC } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { NumberFormat } from '../../config/func'
|
||||
import Button from '../../components/Button'
|
||||
|
||||
const CallBack: FC = () => {
|
||||
|
||||
const { t } = useTranslation('global')
|
||||
|
||||
return (
|
||||
<div className='flex mt-10 flex-col justify-center items-center flex-1 h-full'>
|
||||
<TickCircle
|
||||
size={64}
|
||||
color='#00712D'
|
||||
/>
|
||||
|
||||
<div className='mt-7 text-xl'>
|
||||
{t('callback.title_success')}
|
||||
</div>
|
||||
|
||||
<div className='mt-7'>
|
||||
{t('callback.desc_success')}
|
||||
</div>
|
||||
|
||||
<div className='mt-16 xl:min-w-[560px] bg-[#FBFBFD] p-8 text-sm'>
|
||||
<div className='flex justify-between'>
|
||||
<div>
|
||||
{t('callback.order_number')}
|
||||
</div>
|
||||
<div>
|
||||
#1234
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex justify-between mt-6'>
|
||||
<div>
|
||||
{t('callback.amount')}
|
||||
</div>
|
||||
<div>
|
||||
{NumberFormat(200000) + ' ' + t('toman')}
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex justify-between mt-6'>
|
||||
<div>
|
||||
{t('callback.date')}
|
||||
</div>
|
||||
<div>
|
||||
۲۹ بهمن ۱۴۰۳
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
label={t('callback.back')}
|
||||
className='xl:max-w-[560px] mt-8'
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default CallBack
|
||||
Reference in New Issue
Block a user