feat : dynamic tutorial page

This commit is contained in:
alij
2024-06-22 16:28:15 +04:30
parent 0dce3ba39f
commit 1cfadd711b
4 changed files with 205 additions and 106 deletions

80
src/types/props.d.ts vendored
View File

@@ -5,6 +5,7 @@ export interface AlertProps {
children: React.ReactNode;
type?: "info" | "danger" | "success" | "warning" | "dark";
message?: string;
extra?: string;
}
// begin Button.tsx
@@ -58,12 +59,16 @@ import React, {
SetStateAction,
} from "react";
import { FormikProps } from "formik";
import { AxiosError } from "axios";
export type TutorialList = { id: number; name: string }[];
export interface ListTutorialsProps {
tutorialList: TutorialList;
activeTutorial: number;
isLoading: boolean;
isFetching: boolean;
error: Error | AxiosError | null;
setActiveTutorial: SetStateAction;
}
@@ -79,7 +84,10 @@ export interface TypewriterProps {
}
export interface ButtonListProps {
ProductsList: { id: number; title: string }[];
ProductsList: { id: number; name: string; label?: string }[];
isLoading: boolean;
isFetching: boolean;
error: Error | AxiosError | null;
activeId: number;
setActiveId: SetStateAction;
}
@@ -110,6 +118,7 @@ export interface MuiModalProps {
nameService?: string;
submitText?: string;
submitOnClick?: () => void;
disabled?: boolean;
children: React.ReactNode;
}
@@ -117,6 +126,8 @@ export interface ConfigItemProps {
dateBuy: string;
configName: string;
isDisabled: boolean;
isShowTraffic: boolean;
textCopy: string;
}
// نوع Item برای آیتم‌های داخل Dropdown
@@ -147,3 +158,70 @@ export interface LoginFormValues {
export interface LoginFromikProps {
formik: FormikProps<LoginFormValues>;
}
interface BuyResponse {
message: string;
}
interface BuyError {
message: string;
}
interface ModalBuyProps {
isOpen: boolean;
setIsOpen: Dispatch<SetStateAction<boolean>>;
// mutation: UseMutationResult<
// AxiosResponse<BuyResponse>,
// BuyError,
// BuyConfigData,
// unknown
// >;
configId: number;
}
interface BuyConfigDataProps {
count?: number;
discount?: string;
status?: string;
}
// تعریف تایپ داده‌های واقعی پروفایل کاربر
type UserProfile = {
id: number;
name: string;
email: string;
mobile: string;
};
// تعریف تایپ پیکربندی‌ها
type Config = {
id: number;
title: string;
url: string;
created_at: string | null;
show_traffic: boolean;
max_traffic: number;
traffic: number;
};
// تعریف تایپ داده‌های برگشتی
type ProfileResponseData = {
result: {
user_profile: UserProfile;
enable_config: number;
disable_config: number;
configs: Config[];
};
status: boolean;
alert: string;
};
// تایپ خطا
type QueryError = Error | AxiosError | null;
interface ProfileDetailsProps {
data: ProfileResponseData;
isLoading: boolean;
isFetching: boolean;
error: Error | AxiosError | null;
userTitle: string;
}