summaryrefslogtreecommitdiff
path: root/src/lib/home
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-09-02 14:46:44 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-09-02 14:46:44 +0700
commit52b6604cac87d06500597de8dd56be61eb6fad10 (patch)
tree341d2d98c403ef88dfd1cf98f50cb7ec38ee4b2a /src/lib/home
parent21dd2c7db3e85bb8d16851c2467a722048198c50 (diff)
<iman> update category management
Diffstat (limited to 'src/lib/home')
-rw-r--r--src/lib/home/components/CategoryDynamic.jsx52
1 files changed, 26 insertions, 26 deletions
diff --git a/src/lib/home/components/CategoryDynamic.jsx b/src/lib/home/components/CategoryDynamic.jsx
index 0ab9312a..c257e9f9 100644
--- a/src/lib/home/components/CategoryDynamic.jsx
+++ b/src/lib/home/components/CategoryDynamic.jsx
@@ -13,32 +13,32 @@ import { Navigation, Pagination, Autoplay } from 'swiper';
const CategoryDynamic = () => {
const { categoryManagement } = useCategoryManagement();
- const [categoryData, setCategoryData] = useState({});
- const [subCategoryData, setSubCategoryData] = useState({});
+ // const [categoryData, setCategoryData] = useState({});
+ // const [subCategoryData, setSubCategoryData] = useState({});
- useEffect(() => {
- const fetchCategoryData = async () => {
- if (categoryManagement && categoryManagement.data) {
- const updatedCategoryData = {};
- const updatedSubCategoryData = {};
+ // useEffect(() => {
+ // const fetchCategoryData = async () => {
+ // if (categoryManagement && categoryManagement.data) {
+ // const updatedCategoryData = {};
+ // const updatedSubCategoryData = {};
- for (const category of categoryManagement.data) {
- const countLevel1 = await odooApi('GET', `/api/v1/category/numFound?parent_id=${category.categoryIdI}`);
+ // for (const category of categoryManagement.data) {
+ // const countLevel1 = await odooApi('GET', `/api/v1/category/numFound?parent_id=${category.categoryIdI}`);
- updatedCategoryData[category.categoryIdI] = countLevel1?.numFound;
+ // updatedCategoryData[category.categoryIdI] = countLevel1?.numFound;
- for (const subCategory of countLevel1?.children) {
- updatedSubCategoryData[subCategory.id] = subCategory?.numFound;
- }
- }
+ // for (const subCategory of countLevel1?.children) {
+ // updatedSubCategoryData[subCategory.id] = subCategory?.numFound;
+ // }
+ // }
- setCategoryData(updatedCategoryData);
- setSubCategoryData(updatedSubCategoryData);
- }
- };
+ // setCategoryData(updatedCategoryData);
+ // setSubCategoryData(updatedSubCategoryData);
+ // }
+ // };
- fetchCategoryData();
- }, [categoryManagement.isLoading]);
+ // fetchCategoryData();
+ // }, [categoryManagement.isLoading]);
const swiperBanner = {
modules: [Pagination, ],
@@ -54,16 +54,16 @@ const CategoryDynamic = () => {
return (
<div>
{categoryManagement && categoryManagement.data?.map((category) => {
- const countLevel1 = categoryData[category.categoryIdI] || 0;
+ // const countLevel1 = categoryData[category.categoryIdI] || 0;
return (
<Skeleton key={category.id} isLoaded={categoryManagement}>
<div key={category.id}>
<div className='bagian-judul flex flex-row justify-start items-center gap-3 mb-4 mt-4'>
<div className='font-semibold sm:text-h-lg mr-2'>{category.name}</div>
- <Skeleton isLoaded={countLevel1 != 0}>
+ {/* <Skeleton isLoaded={countLevel1 != 0}>
<p className={`text-gray_r-10 text-sm`}>{countLevel1} Produk tersedia</p>
- </Skeleton>
+ </Skeleton> */}
<Link href={createSlug('/shop/category/', category?.name, category?.categoryIdI)} className="!text-red-500 font-semibold">Lihat Semua</Link>
</div>
@@ -71,7 +71,7 @@ const CategoryDynamic = () => {
<Swiper {...swiperBanner}
>
{category.categories.map((subCategory) => {
- const countLevel2 = subCategoryData[subCategory.idLevel2] || 0;
+ // const countLevel2 = subCategoryData[subCategory.idLevel2] || 0;
return (
<SwiperSlide key={subCategory.id}>
@@ -87,11 +87,11 @@ const CategoryDynamic = () => {
/>
<div className='bagian-judul flex flex-col justify-center items-start gap-2 ml-2'>
<div className='font-semibold text-lg mr-2'>{subCategory?.name}</div>
- <Skeleton isLoaded={countLevel2 != 0}>
+ {/* <Skeleton isLoaded={countLevel2 != 0}>
<p className={`text-gray_r-10 text-sm`}>
{countLevel2} Produk tersedia
</p>
- </Skeleton>
+ </Skeleton> */}
<Link href={createSlug('/shop/category/', subCategory?.name, subCategory?.idLevel2)} className="!text-red-500 font-semibold">Lihat Semua</Link>
</div>
</div>