diff --git a/src/assets/images/support.png b/src/assets/images/support.png new file mode 100644 index 0000000..bdd6a5e Binary files /dev/null and b/src/assets/images/support.png differ diff --git a/src/components/ServiceItem.tsx b/src/components/ServiceItem.tsx index 1de3f4a..9a6bf8f 100644 --- a/src/components/ServiceItem.tsx +++ b/src/components/ServiceItem.tsx @@ -54,7 +54,7 @@ const ServiceItem: FC = (props: Props) => {
- +
+ + ) + }) + } + + +
+
+ { + data?.data?.supportPlans?.[0]?.features.map((row: featureItemType) => ( +
+
+
+ +
+
{t(`support.${row.featureKey}`)}
+
+
+ )) + } +
+ { + data?.data?.supportPlans?.map((item: PlanItemType) => ( +
+ { + item.features.map((row) => ( +
+ { + row.featureType === 'boolean' ? + row.featureValue === 'true' ? + + : + + : +
{row.featureValue}
+ } +
+ )) + } +
+ )) + } +
+ + {/* Mobile View */} +
+ { + data?.data?.supportPlans?.map((plan: PlanItemType) => ( + activeTab === plan.id && ( +
+
+ support +
+
+
{plan.name}
+
ماهیانه
+
{NumberFormat(plan.price)}
+
تومان
+
+
+ { + plan.features.map((row: featureItemType) => ( +
+
+
+ +
+
{t(`support.${row.featureKey}`)}
+
+ { + row.featureType === 'boolean' ? + row.featureValue === 'true' ? + + : + + : +
{row.featureValue}
+ } +
+ )) + } +
+
+ ) + )) + } +
+ + + + + + ) +} + +export default Support \ No newline at end of file diff --git a/src/pages/support/components/SidebarHint.tsx b/src/pages/support/components/SidebarHint.tsx new file mode 100644 index 0000000..90112c2 --- /dev/null +++ b/src/pages/support/components/SidebarHint.tsx @@ -0,0 +1,67 @@ +import { TickSquare } from 'iconsax-react' +import { FC } from 'react' + +const SidebarHint: FC = () => { + return ( +
+
+ جهت انتخاب بهتر به مسائل زیر توجه بفرمایید: +
+ +
+
+
+ +
+
+ سوالات - مشکلاتی که به یک موضوع مربوط میشوند را در یک درخواست پشتیبانی پیگیر باشید و چند درخواست برای یک موضوع باز نکنید. +
+
+
+
+ +
+
+ لطفاً برای بررسی و رفع مشکلات احتمالی صبور باشید بررسی و رفع مشکلات در برخی موارد زمان گیر است. +
+
+
+
+ +
+
+ پاسخگویی 24 ساعته تلفنی را تنها از میهن وب هاست می توانید انتظار داشته باشید .بخش پشتیبانی در هر ساعتی حتی در روز های تعطیل آماده پیگیری سریع مشکلات کاربران است. +
+
+
+
+ +
+
+ لطفاً برای بررسی و رفع مشکلات احتمالی صبور باشید بررسی و رفع مشکلات در برخی موارد زمان گیر است. +
+
+ +
+
+ +
+
+ لطفاً برای بررسی و رفع مشکلات احتمالی صبور باشید بررسی و رفع مشکلات در برخی موارد زمان گیر است. +
+
+ +
+
+ +
+
+ لطفاً برای بررسی و رفع مشکلات احتمالی صبور باشید بررسی و رفع مشکلات در برخی موارد زمان گیر است. +
+
+
+
+ ) +} + +export default SidebarHint \ No newline at end of file diff --git a/src/pages/support/components/SupportIcon.tsx b/src/pages/support/components/SupportIcon.tsx new file mode 100644 index 0000000..141129f --- /dev/null +++ b/src/pages/support/components/SupportIcon.tsx @@ -0,0 +1,45 @@ +import { FC } from 'react' +import { SupportPlanFeatureKey } from '../enum/SupportEnum' +import { + Document, + MessageQuestion, + Clock, + Call, + Save2, + Profile2User, + Location, + Teacher, + Ticket +} from 'iconsax-react' + +type Props = { + keySupport: SupportPlanFeatureKey +} + +const SupportIcon: FC = ({ keySupport }) => { + + switch (keySupport) { + case SupportPlanFeatureKey.LEARNING_DOCS: + return + case SupportPlanFeatureKey.TICKET_SUPPORT: + return + case SupportPlanFeatureKey.RESPONSE_TIME: + return + case SupportPlanFeatureKey.PHONE_SUPPORT: + return + case SupportPlanFeatureKey.BACKUP_VERSION: + return + case SupportPlanFeatureKey.TECHNICAL_EXPERT_ACCESS: + return + case SupportPlanFeatureKey.ON_SITE_SUPPORT: + return + case SupportPlanFeatureKey.ON_SITE_TRAINING: + return + case SupportPlanFeatureKey.TICKET_LIMIT: + return + default: + return + } +} + +export default SupportIcon \ No newline at end of file diff --git a/src/pages/support/components/SupportSkeleton.tsx b/src/pages/support/components/SupportSkeleton.tsx new file mode 100644 index 0000000..842419b --- /dev/null +++ b/src/pages/support/components/SupportSkeleton.tsx @@ -0,0 +1,94 @@ +import { FC } from 'react' +import { Document } from 'iconsax-react' + +const SupportSkeleton: FC = () => { + return ( +
+
+
+ {/* Desktop View */} +
+
+
+
+ + {[1, 2].map((item) => ( +
+
+
+
+
+
+
+
+
+ ))} +
+ +
+
+ {[1, 2, 3, 4, 5].map((item) => ( +
+
+
+
+
+
+ ))} +
+ {[1, 2].map((item) => ( +
+ {[1, 2, 3, 4, 5].map((feature) => ( +
+
+
+ ))} +
+ ))} +
+ + {/* Mobile View */} +
+
+
+
+
+
+
+
+
+
+
+
+ {[1, 2, 3, 4, 5].map((item) => ( +
+
+
+
+
+
+
+ ))} +
+
+
+ +
+
+
+
+ {[1, 2, 3].map((item) => ( +
+
+
+
+ ))} +
+
+
+
+
+ ) +} + +export default SupportSkeleton \ No newline at end of file diff --git a/src/pages/support/enum/SupportEnum.ts b/src/pages/support/enum/SupportEnum.ts new file mode 100644 index 0000000..1c587d2 --- /dev/null +++ b/src/pages/support/enum/SupportEnum.ts @@ -0,0 +1,11 @@ +export enum SupportPlanFeatureKey { + LEARNING_DOCS = "learning_docs", // راهنما و مستندات آموزشی + TICKET_SUPPORT = "ticket_support", // ارسال تیکت + RESPONSE_TIME = "response_time", // زمان پاسخگویی به تیکت + PHONE_SUPPORT = "phone_support", // پاسخگویی تلفنی + BACKUP_VERSION = "backup_version", // نسخه بکاپ + TECHNICAL_EXPERT_ACCESS = "technical_expert_access", // دسترسی به متخصصین فنی + ON_SITE_SUPPORT = "on_site_support", // پشتیبانی در محل + ON_SITE_TRAINING = "on_site_training", // آموزش در محل + TICKET_LIMIT = "ticket_limit", // ظرفیت ارسال تیکت +} diff --git a/src/pages/support/hooks/useSupportData.ts b/src/pages/support/hooks/useSupportData.ts new file mode 100644 index 0000000..0c270b8 --- /dev/null +++ b/src/pages/support/hooks/useSupportData.ts @@ -0,0 +1,12 @@ +import { useQuery, useMutation } from "@tanstack/react-query"; +import { getSupportPlans, buySupportPlan } from "../service/SupportService"; + +export const useGetSupportPlans = () => { + return useQuery({ queryKey: ["support-plans"], queryFn: getSupportPlans }); +}; + +export const useBuySupportPlan = () => { + return useMutation({ + mutationFn: (planId: string) => buySupportPlan(planId), + }); +}; diff --git a/src/pages/support/service/SupportService.ts b/src/pages/support/service/SupportService.ts new file mode 100644 index 0000000..309cb2a --- /dev/null +++ b/src/pages/support/service/SupportService.ts @@ -0,0 +1,11 @@ +import axios from "../../../config/axios"; + +export const getSupportPlans = async () => { + const { data } = await axios.get("/support-plans"); + return data; +}; + +export const buySupportPlan = async (planId: string) => { + const { data } = await axios.post(`/support-plans/${planId}/subscribe`); + return data; +}; diff --git a/src/pages/support/types/SupportTypes.ts b/src/pages/support/types/SupportTypes.ts new file mode 100644 index 0000000..b281010 --- /dev/null +++ b/src/pages/support/types/SupportTypes.ts @@ -0,0 +1,22 @@ +export type featureItemType = { + id: string; + createdAt: string; + updatedAt: string; + featureKey: string; + featureValue: string; + featureType: string; + icon: string | null; +}; + +export type PlanItemType = { + id: string; + createdAt: string; + updatedAt: string; + name: string; + description: string; + price: number; + duration: number; + isActive: boolean; + features: featureItemType[]; + deletedAt: string | null; +}; diff --git a/src/pages/wallet/components/Sheba.tsx b/src/pages/wallet/components/Sheba.tsx index 1430418..f5bf925 100644 --- a/src/pages/wallet/components/Sheba.tsx +++ b/src/pages/wallet/components/Sheba.tsx @@ -51,6 +51,9 @@ const CardtoCard: FC = () => { toast(error.response?.data?.error?.message[0], 'error') } }) + }, + onError: (error: ErrorType) => { + toast(error.response?.data?.error?.message[0], 'error') } }) } diff --git a/src/router/Main.tsx b/src/router/Main.tsx index 29f0498..07a6355 100644 --- a/src/router/Main.tsx +++ b/src/router/Main.tsx @@ -29,6 +29,7 @@ import CallBack from '../pages/payment/CallBack' import MyDiscountList from '../pages/discounts/List' import LearningDetail from '../pages/learning/Detail' import BuyService from '../pages/service/BuyService' +import Support from '../pages/support/Support' const MainRouter: FC = () => { return ( @@ -40,6 +41,7 @@ const MainRouter: FC = () => {
} /> + } /> } /> } /> } /> diff --git a/src/shared/SideBar.tsx b/src/shared/SideBar.tsx index c01852b..b6d6c3a 100644 --- a/src/shared/SideBar.tsx +++ b/src/shared/SideBar.tsx @@ -1,7 +1,7 @@ import { FC } from 'react' import LogoImage from '../assets/images/logo.svg' import { useTranslation } from 'react-i18next' -import { Card, DocumentText, Element3, Element4, Home2, Logout, Messages3, NotificationStatus, Receipt21, Setting2, Teacher } from 'iconsax-react' +import { Card, DocumentText, Element3, Element4, Headphone, Home2, Logout, Messages3, NotificationStatus, Receipt21, Setting2, Teacher } from 'iconsax-react' import SideBarItem from './SideBarItem' import { useLocation } from 'react-router-dom' import { Pages } from '../config/Pages' @@ -53,6 +53,13 @@ const SideBar: FC = () => { isActive={isActive('services')} link={Pages.services.mine} /> + + } + title={t('sidebar.support')} + isActive={isActive('support')} + link={Pages.support.index} + /> } title={t('sidebar.other_service')}