From 4e8068071f3e0bddb651a2871f8fd81507bab400 Mon Sep 17 00:00:00 2001 From: hamid zarghami Date: Sat, 29 Nov 2025 09:38:27 +0330 Subject: [PATCH] list of category themes --- src/pages/theme/List.tsx | 42 +++++++++++++++++++++++++ src/pages/theme/service/ThemeService.ts | 8 +++-- src/pages/theme/type/Types.ts | 16 ++++++++++ 3 files changed, 63 insertions(+), 3 deletions(-) diff --git a/src/pages/theme/List.tsx b/src/pages/theme/List.tsx index 5d5498a..98a1e21 100644 --- a/src/pages/theme/List.tsx +++ b/src/pages/theme/List.tsx @@ -5,11 +5,18 @@ import Button from '@/components/Button'; import { Link } from 'react-router-dom'; import { Pages } from '@/config/Pages'; import { Plus } from 'lucide-react'; +import Td from '@/components/Td'; +import TrashWithConfrim from '@/components/TrashWithConfrim'; +import { Eye } from 'iconsax-react'; const ThemeList: FC = () => { const { data, isLoading } = useGetThemes(); + if (isLoading) { + return
در حال بارگذاری...
; + } + return (
@@ -24,6 +31,41 @@ const ThemeList: FC = () => {
+ +
+ + + + + + + { + data?.results?.data?.map((item) => { + return ( + + + + ) + }) + } + +
+ + +
+ + +
+ + + + null} + isLoading={false} + /> +
+
+
) } diff --git a/src/pages/theme/service/ThemeService.ts b/src/pages/theme/service/ThemeService.ts index 8dfe5f4..517c091 100644 --- a/src/pages/theme/service/ThemeService.ts +++ b/src/pages/theme/service/ThemeService.ts @@ -1,8 +1,10 @@ import axios from "@/config/axios"; -import type { CreateThemeType } from "../type/Types"; +import type { CreateThemeType, GetThemesResponseType } from "../type/Types"; -export const getThemes = async () => { - const { data } = await axios.get("/admin/category/theme"); +export const getThemes = async (): Promise => { + const { data } = await axios.get( + "/admin/category/theme" + ); return data; }; diff --git a/src/pages/theme/type/Types.ts b/src/pages/theme/type/Types.ts index e369715..7755277 100644 --- a/src/pages/theme/type/Types.ts +++ b/src/pages/theme/type/Types.ts @@ -4,3 +4,19 @@ export type CreateThemeType = { title: string; inputType: ThemeInputType; }; + +export type ThemeType = { + _id: string; + title: string; + inputType: ThemeInputType; + createdAt: string; + updatedAt: string; +}; + +export type GetThemesResponseType = { + status: number; + success: boolean; + results: { + data: ThemeType[]; + }; +};