@@ -209,7 +189,7 @@ export function OurService() {
{t("home.services.viewMoreServices")}
{t("home.services.viewMore")}
diff --git a/components/pages/products/filter/catalog/filterCatalog.tsx b/components/pages/products/filter/catalog/filterCatalog.tsx
index 3830752..e0cab24 100644
--- a/components/pages/products/filter/catalog/filterCatalog.tsx
+++ b/components/pages/products/filter/catalog/filterCatalog.tsx
@@ -6,7 +6,6 @@ import { getRouteLang } from "@/request/getLang";
import { endPoints } from "@/request/links";
import { useCategory } from "@/store/useCategory";
import { useQuery } from "@tanstack/react-query";
-import { useEffect } from "react";
import CatalogCardSkeletonSmall from "./loading";
import Image from "next/image";
import { ArrowUpRight } from "lucide-react";
@@ -19,9 +18,6 @@ export default function FilterCatalog() {
queryFn: () => httpClient(endPoints.category.all),
select: (data): CategoryType[] => data?.data?.results,
});
- useEffect(() => {
- console.log("product catalog data: ", data);
- }, [data]);
if (isLoading) {
return (
diff --git a/components/pages/products/filter/filter.tsx b/components/pages/products/filter/filter.tsx
index 9523aa5..4d732bc 100644
--- a/components/pages/products/filter/filter.tsx
+++ b/components/pages/products/filter/filter.tsx
@@ -38,10 +38,7 @@ export default function Filter() {
const { data: categoryBack } = useQuery({
queryKey: ["category"],
queryFn: () => httpClient(endPoints.category.all),
- select: (data) => {
- console.log("category data on filter: ", data?.data?.results);
- return data?.data?.results;
- },
+ select: (data) => data?.data?.results,
});
// ⭐ O'ZGARTIRILDI: subCategory so'rovi faqat dropdown ochilganda va have_sub_category true bo'lganda
@@ -53,10 +50,7 @@ export default function Filter() {
!!category.id &&
category.have_sub_category === true &&
openDropdowns[category.id] === true,
- select: (data) => {
- console.log("subCategory filter data: ", data?.data?.results);
- return data?.data?.results;
- },
+ select: (data) => data?.data?.results,
});
// ⭐ O'ZGARTIRILDI: Catalog va Size query'lari category yoki subCategory ID'ga qarab ishlaydi
diff --git a/components/pages/products/product/mianProduct.tsx b/components/pages/products/product/mianProduct.tsx
index 3af9664..d5c9c64 100644
--- a/components/pages/products/product/mianProduct.tsx
+++ b/components/pages/products/product/mianProduct.tsx
@@ -5,18 +5,18 @@ import { useQuery } from "@tanstack/react-query";
import ProductCard from "./productCard";
import { useCategory } from "@/store/useCategory";
import { useFilter } from "@/lib/filter-zustand";
-import { useEffect, useMemo } from "react";
+import { useMemo } from "react";
import { useProductPageInfo } from "@/store/useProduct";
import { useSubCategory } from "@/store/useSubCategory";
+import { useTranslations } from "next-intl";
export default function MainProduct() {
+ const t = useTranslations();
const category = useCategory((state) => state.category);
const subCategory = useSubCategory((state) => state.subCategory);
const filter = useFilter((state) => state.filter);
const getFiltersByType = useFilter((state) => state.getFiltersByType);
const setProduct = useProductPageInfo((state) => state.setProducts);
-
- console.log("subCategory data: ", subCategory);
// Query params yaratish
const queryParams = useMemo(() => {
const catalog = getFiltersByType("catalog");
@@ -40,15 +40,12 @@ export default function MainProduct() {
// Query params qo'shish
return `${baseLink}${queryParams}`;
- }, [category.id, category.have_sub_category, queryParams , subCategory.id]);
+ }, [category.id, category.have_sub_category, queryParams, subCategory.id]);
const { data, isLoading, error } = useQuery({
queryKey: ["products", subCategory.id, queryParams],
queryFn: () => httpClient(requestLink),
- select: (data) => {
- console.log("product: ", data?.data?.data?.results);
- return data?.data?.data?.results;
- },
+ select: (data) => data?.data?.data?.results,
});
if (isLoading) {
@@ -62,17 +59,13 @@ export default function MainProduct() {
}
if (error) {
- return (
-
- Ma'lumotlarni yuklashda xatolik yuz berdi
-
- );
+ return
{t("loadingError")}
;
}
if (!data || data.length === 0) {
return (
- Mahsulotlar topilmadi
+ {t("productsNotFound")}
);
}
diff --git a/components/pages/services/index.ts b/components/pages/services/index.ts
index 63f5f8e..e4d3b34 100644
--- a/components/pages/services/index.ts
+++ b/components/pages/services/index.ts
@@ -1,2 +1,3 @@
export { ServiceBanner } from "./serviceBanner";
export { ServiceFaq } from "./serviceFaq";
+export { ServicePageServices } from "./servicePageServices";
diff --git a/components/pages/services/servicePageServices.tsx b/components/pages/services/servicePageServices.tsx
new file mode 100644
index 0000000..c205a3d
--- /dev/null
+++ b/components/pages/services/servicePageServices.tsx
@@ -0,0 +1,222 @@
+"use client";
+import DotAnimatsiya from "@/components/dot/DotAnimatsiya";
+import httpClient from "@/request/api";
+import { endPoints } from "@/request/links";
+import { useQuery } from "@tanstack/react-query";
+import { ChevronRight } from "lucide-react";
+import { useLocale, useTranslations } from "next-intl";
+import Image from "next/image";
+import Link from "next/link";
+import { motion } from "framer-motion";
+import { ServicesLoading } from "./loading";
+import { EmptyServices } from "./empty";
+import { useServiceDetail } from "@/store/useService";
+import { cardVariants, containerVariants } from "@/lib/animations";
+
+export function ServicePageServices() {
+ const t = useTranslations();
+ const locale = useLocale();
+ const setServiceId = useServiceDetail((state) => state.setServiceId);
+
+ // get request
+ const { data, isLoading, isError } = useQuery({
+ queryKey: ["firesafety"],
+ queryFn: () => httpClient(endPoints.services.all),
+ select: (data) => {
+ const serviceData = data?.data?.data?.results;
+ return serviceData.reduce(
+ (resultArray: any, item: any, index: number) => {
+ const chunkIndex = Math.floor(index / 4);
+
+ if (!resultArray[chunkIndex]) {
+ resultArray[chunkIndex] = []; // Yangi chunk boshlash
+ }
+
+ resultArray[chunkIndex].push(item);
+
+ return resultArray;
+ },
+ [] as any[][],
+ );
+ },
+ });
+
+ console.log("service page services: ", data);
+
+ return (
+
+
+ {/* Header for github */}
+
+
+
+ {t("home.services.title")}
+
+
+ {t("home.services.subtitle")}
+
+
+ {t("home.services.description")}
+
+
+
+ {/* Conditional Rendering */}
+ {isLoading ? (
+
+
+
+ ) : !data || (Array.isArray(data) && data.length === 0) ? (
+
+
+
+ ) : (
+ data.map((item: any, index: number) => (
+
+ {/* cards */}
+
+ {item[0] && (
+
setServiceId(item[0].id)}
+ >
+
+
+ {item[0]?.title}
+
+
+ {item[0]?.subtitle}
+
+
+
+
+
+ )}
+
+ {item[1] && (
+
+
setServiceId(item[1]?.id)}
+ variants={cardVariants}
+ >
+
+
+ {item[1]?.title}
+
+
+ {item[1]?.subtitle}
+
+
+
+
+
+
+ )}
+
+
+
+ {item[2] && (
+
setServiceId(item[2]?.id)}
+ className="sm:w-[40%] w-full -mt-5"
+ >
+
+
+
+
+ {item[2]?.title}
+
+
+ {item[2]?.subtitle}
+
+
+
+
+
+ )}
+
+
+ {item[3] && (
+
setServiceId(item[3]?.id)}
+ variants={cardVariants}
+ >
+
+
+
+ {item[3]?.title}
+
+
+ {item[3]?.subtitle}
+
+
+
+
+
+
+ )}
+
+
+
+ ))
+ )}
+
+
+ );
+}
diff --git a/components/priceContact.tsx b/components/priceContact.tsx
index 94ebee6..6e625bc 100644
--- a/components/priceContact.tsx
+++ b/components/priceContact.tsx
@@ -55,7 +55,7 @@ export function PriceModal() {
});
setErrors({
name: "",
- number: '',
+ number: "",
});
}
}, [isOpen]);
@@ -144,8 +144,6 @@ export function PriceModal() {
number: Number(cleanPhone.slice(3)), // ✅ String sifatida yuborish
product: product?.id || 0,
};
-
- console.log("Sended data:", sendedData);
formRequest.mutate(sendedData);
};
@@ -264,4 +262,4 @@ export function PriceModal() {