list of category themes

This commit is contained in:
hamid zarghami
2025-11-29 09:38:27 +03:30
parent 259fc8af97
commit 4e8068071f
3 changed files with 63 additions and 3 deletions
+42
View File
@@ -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 <div className="flex justify-center items-center h-64">در حال بارگذاری...</div>;
}
return (
<div>
<PageTitle title1='تم ها' />
@@ -24,6 +31,41 @@ const ThemeList: FC = () => {
</Button>
</Link>
</div>
<div className='relative overflow-x-auto rounded-3xl mt-5 w-full'>
<table className='w-full text-sm '>
<thead className='thead'>
<tr>
<Td text={'عنوان'} />
<Td text={'نوع ورودی'} />
<Td text={'عملیات'} />
</tr>
</thead>
<tbody>
{
data?.results?.data?.map((item) => {
return (
<tr className='tr' key={item._id}>
<Td text={item.title} />
<Td text={item.inputType} />
<Td text=''>
<div className='flex gap-2'>
<Link to={`${Pages.products.theme.update}/${item._id}`}>
<Eye size={16} color='#8C90A3' />
</Link>
<TrashWithConfrim
onDelete={() => null}
isLoading={false}
/>
</div>
</Td>
</tr>
)
})
}
</tbody>
</table>
</div>
</div>
)
}
+5 -3
View File
@@ -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<GetThemesResponseType> => {
const { data } = await axios.get<GetThemesResponseType>(
"/admin/category/theme"
);
return data;
};
+16
View File
@@ -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[];
};
};