list of category themes
This commit is contained in:
@@ -5,11 +5,18 @@ import Button from '@/components/Button';
|
|||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { Pages } from '@/config/Pages';
|
import { Pages } from '@/config/Pages';
|
||||||
import { Plus } from 'lucide-react';
|
import { Plus } from 'lucide-react';
|
||||||
|
import Td from '@/components/Td';
|
||||||
|
import TrashWithConfrim from '@/components/TrashWithConfrim';
|
||||||
|
import { Eye } from 'iconsax-react';
|
||||||
|
|
||||||
const ThemeList: FC = () => {
|
const ThemeList: FC = () => {
|
||||||
|
|
||||||
const { data, isLoading } = useGetThemes();
|
const { data, isLoading } = useGetThemes();
|
||||||
|
|
||||||
|
if (isLoading) {
|
||||||
|
return <div className="flex justify-center items-center h-64">در حال بارگذاری...</div>;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<PageTitle title1='تم ها' />
|
<PageTitle title1='تم ها' />
|
||||||
@@ -24,6 +31,41 @@ const ThemeList: FC = () => {
|
|||||||
</Button>
|
</Button>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import axios from "@/config/axios";
|
import axios from "@/config/axios";
|
||||||
import type { CreateThemeType } from "../type/Types";
|
import type { CreateThemeType, GetThemesResponseType } from "../type/Types";
|
||||||
|
|
||||||
export const getThemes = async () => {
|
export const getThemes = async (): Promise<GetThemesResponseType> => {
|
||||||
const { data } = await axios.get("/admin/category/theme");
|
const { data } = await axios.get<GetThemesResponseType>(
|
||||||
|
"/admin/category/theme"
|
||||||
|
);
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -4,3 +4,19 @@ export type CreateThemeType = {
|
|||||||
title: string;
|
title: string;
|
||||||
inputType: ThemeInputType;
|
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[];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user