state.setCategory);
+ const { data, isLoading } = useQuery({
+ queryKey: ["category", language],
+ queryFn: () => httpClient(endPoints.category.all),
+ select: (data): CategoryType[] => data?.data?.results,
+ });
+ useEffect(() => {
+ console.log("product catalog data: ", data);
+ }, [data]);
+
+ if (isLoading) {
+ return (
+
+ {[...Array(3)].map((_, index) => (
+
+ ))}
+
+ );
+ }
+
+ // Ma'lumot yo'q holati
+ if (!data || data.length === 0) {
+ return (
+
+ );
+ }
+
+ return (
+
+ {data?.map((item) => (
+
setCategory(item)}
+ className="shrink-0 group relative w-55 h-60 overflow-hidden rounded-2xl bg-[#17161679] border border-white/10 transition-all duration-500 hover:-translate-y-1 hover:border-red-700 cursor-pointer"
+ >
+ {/* Background glow effect */}
+
+
+ {/* Decorative corner accent */}
+
+
+ {/* Content container */}
+
+ {/* Title section */}
+
+
+ {/* Image container */}
+
+
+
+ ))}
+
+ );
+}
diff --git a/components/pages/products/filter/catalog/loading.tsx b/components/pages/products/filter/catalog/loading.tsx
new file mode 100644
index 0000000..a0a42ce
--- /dev/null
+++ b/components/pages/products/filter/catalog/loading.tsx
@@ -0,0 +1,23 @@
+// components/CatalogCardSkeletonSmall.tsx
+export default function CatalogCardSkeletonSmall() {
+ return (
+
+
+
+ {/* Title skeleton */}
+
+
+ {/* Image skeleton */}
+
+
+
+ {/* Shimmer */}
+
+
+ );
+}
diff --git a/components/pages/products/filter/filter.tsx b/components/pages/products/filter/filter.tsx
index 1988f2d..45a1d17 100644
--- a/components/pages/products/filter/filter.tsx
+++ b/components/pages/products/filter/filter.tsx
@@ -67,86 +67,85 @@ export default function Filter() {
const visibleSectionNumber = numberExpanded
? sizeData
: sizeData.slice(0, 10);
-
- console.log("have suncategory: ", category.have_sub_category);
- if (category.have_sub_category || subCategory.id !== 0) {
- return null;
- }
- console.log("filter: ",filter);
+ console.log("filter: ", filter);
return (
-
+
{/* Bo'lim filtri */}
-
-
- Bo'lim
-
-
- {visibleSectionData.map((item) => (
-
toggleFilter(item)}
- className="hover:cursor-pointer flex items-center gap-2"
- >
-
+
+ Bo'lim
+
+
+ {visibleSectionData.map((item) => (
+
toggleFilter(item)}
+ className="hover:cursor-pointer flex items-center gap-2 w-auto shrink-0"
>
- {hasData(item.name) && (
-
- )}
-
-
{item.name}
-
- ))}
+
+ {hasData(item.name) && (
+
+ )}
+
+
{item.name}
+
+ ))}
+
+
-
-
+ )}
{/* O'lcham filtri */}
-
-
- O'lcham
-
-
- {visibleSectionNumber.map((item) => (
-
toggleFilter(item)}
- className="hover:cursor-pointer flex items-center gap-2"
- >
-
+
+ O'lcham
+
+
+ {visibleSectionNumber.map((item) => (
+
toggleFilter(item)}
+ className="hover:cursor-pointer flex items-center gap-2 w-auto shrink-0"
>
- {hasData(item.name) && (
-
- )}
-
-
{item.name}
-
- ))}
+
+ {hasData(item.name) && (
+
+ )}
+
+
{item.name}
+
+ ))}
+
+
-
-
+ )}
);
}
diff --git a/components/pages/products/product/products.tsx b/components/pages/products/product/products.tsx
index 13781d7..88d3c41 100644
--- a/components/pages/products/product/products.tsx
+++ b/components/pages/products/product/products.tsx
@@ -4,9 +4,9 @@ import MainProduct from "./mianProduct";
export function Products() {
return (
-
+
-
+
{/* filter part */}
diff --git a/components/pages/subCategory/card.tsx b/components/pages/subCategory/card.tsx
index fa59743..a10f533 100644
--- a/components/pages/subCategory/card.tsx
+++ b/components/pages/subCategory/card.tsx
@@ -32,7 +32,7 @@ export default function Card({
image,
category,
});
- router.push(`/${locale}/products/${slug}`);
+ router.push(`/${locale}/products`);
};
return (