diff --git a/app/[locale]/catalog_page/products/[slug]/page.tsx b/app/[locale]/catalog_page/products/[slug]/page.tsx index cf032e0..3e7992c 100644 --- a/app/[locale]/catalog_page/products/[slug]/page.tsx +++ b/app/[locale]/catalog_page/products/[slug]/page.tsx @@ -35,7 +35,6 @@ interface ProductDetail { export default function SlugPage() { const searchParams = useSearchParams(); const productId = searchParams.get("productId"); - console.log("product Id : ", productId); const productZustand = useProductPageInfo((state) => state.product); const id = productId ? Number(productId) : productZustand.id; const { data: product, isLoading } = useQuery({ @@ -44,8 +43,6 @@ export default function SlugPage() { select: (data) => data?.data?.data as ProductDetail, }); - useEffect(() => console.log("product detail: ", product)); - // Loading State if (isLoading) { return ; diff --git a/app/[locale]/services/detail/page.tsx b/app/[locale]/services/detail/page.tsx index 43985f7..ed3415c 100644 --- a/app/[locale]/services/detail/page.tsx +++ b/app/[locale]/services/detail/page.tsx @@ -13,11 +13,11 @@ import { useServiceDetail } from "@/store/useService"; import { useQuery } from "@tanstack/react-query"; import httpClient from "@/request/api"; import { endPoints } from "@/request/links"; +import { cardVariants, containerVariants } from "@/lib/animations"; export default function OperationalSystemsPage() { const t = useTranslations("operationalSystems"); const serviceId = useServiceDetail((state) => state.serviceId); - console.log("service id: ", serviceId); const { data, @@ -29,8 +29,6 @@ export default function OperationalSystemsPage() { select: (data) => data?.data?.data, }); - console.log("service detail: ", data); - // Demo data - fallback ma'lumotlar const demoData: SystemFeature[] = [ { @@ -48,41 +46,6 @@ export default function OperationalSystemsPage() { }, ]; - // Animation variants - const containerVariants = { - hidden: { opacity: 0 }, - visible: { - opacity: 1, - transition: { - staggerChildren: 0.15, - }, - }, - }; - - const itemVariants = { - hidden: { opacity: 0, y: 30 }, - visible: { - opacity: 1, - y: 0, - transition: { - duration: 0.6, - ease: [0.22, 1, 0.36, 1] as const, - }, - }, - }; - - const cardVariants = { - hidden: { opacity: 0, scale: 0.95 }, - visible: { - opacity: 1, - scale: 1, - transition: { - duration: 0.5, - ease: [0.22, 1, 0.36, 1] as const, - }, - }, - }; - // Loading state if (loading) { return ( diff --git a/app/[locale]/services/page.tsx b/app/[locale]/services/page.tsx index 480bf72..e865a5a 100644 --- a/app/[locale]/services/page.tsx +++ b/app/[locale]/services/page.tsx @@ -1,11 +1,15 @@ -import { OurService, Video } from "@/components/pages/home"; -import { ServiceBanner, ServiceFaq } from "@/components/pages/services"; +import { Video } from "@/components/pages/home"; +import { + ServiceBanner, + ServiceFaq, + ServicePageServices, +} from "@/components/pages/services"; export default function Page() { return (
- +
diff --git a/components/breadCrumb.tsx b/components/breadCrumb.tsx index ef886a8..4c15891 100644 --- a/components/breadCrumb.tsx +++ b/components/breadCrumb.tsx @@ -21,7 +21,6 @@ export function Breadcrumb({ const category = useCategory((state) => state.category); const subCategory = useSubCategory((state) => state.subCategory); const product = useProductPageInfo((state) => state.product); - console.log("sub category: ", subCategory); // Pathdan segments olish const segments = pathname.split("/").filter((segment) => segment !== ""); diff --git a/components/layout/footer.tsx b/components/layout/footer.tsx index f6f13f5..fae5984 100644 --- a/components/layout/footer.tsx +++ b/components/layout/footer.tsx @@ -63,7 +63,6 @@ export function Footer() { if (email) { // Telefon raqamni tozalash (faqat raqamlar) const cleanPhone = email.replace(/\D/g, ""); - console.log("without 998: ", cleanPhone.slice(3)); formRequest.mutate({ number: Number(cleanPhone.slice(3)) }); } }; @@ -239,11 +238,11 @@ export function Footer() { {/* Copyright Section */} -
+
-
+
{locale === "uz" ? ( -
+ ) : ( -
+
{locale === "ru" ?

Разработано -

:

Created by -

}
httpClient(endPoints.services.all), - select: (data) => data?.data?.data?.results, + select: (data) => data?.data?.data?.results.slice(0, 4), }); - console.log("service data: ", data); - - // Animation variants - const containerVariants = { - hidden: { opacity: 0 }, - visible: { - opacity: 1, - transition: { - staggerChildren: 0.1, - }, - }, - }; - - const cardVariants = { - hidden: { opacity: 0, y: 20 }, - visible: { - opacity: 1, - y: 0, - transition: { - duration: 0.5, - ease: [0.22, 1, 0.36, 1] as const, - }, - }, - }; - return (
@@ -116,30 +92,34 @@ export function OurService() { - setServiceId(data[1].id)} - variants={cardVariants} + -
-

- {data[1].title} -

-

- {data[1].subtitle} -

- - images -
-
+ setServiceId(data[1].id)} + variants={cardVariants} + > +
+

+ {data[1].title} +

+

+ {data[1].subtitle} +

+ + images +
+
+
@@ -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} +

+ + images + +
+ )} + + {item[1] && ( + + setServiceId(item[1]?.id)} + variants={cardVariants} + > +
+

+ {item[1]?.title} +

+

+ {item[1]?.subtitle} +

+ + images +
+
+ + )} +
+ +
+ {item[2] && ( + setServiceId(item[2]?.id)} + className="sm:w-[40%] w-full -mt-5" + > + + images +
+

+ {item[2]?.title} +

+

+ {item[2]?.subtitle} +

+ +
+ +
+ )} + +
+ {item[3] && ( + setServiceId(item[3]?.id)} + variants={cardVariants} + > + +
+

+ {item[3]?.title} +

+

+ {item[3]?.subtitle} +

+ + images +
+ +
+ )} +
+
+
+ )) + )} +
+
+ ); +} 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() {
); -} \ No newline at end of file +} diff --git a/lib/animations.ts b/lib/animations.ts new file mode 100644 index 0000000..65266f9 --- /dev/null +++ b/lib/animations.ts @@ -0,0 +1,33 @@ +export const containerVariants = { + hidden: { opacity: 0 }, + visible: { + opacity: 1, + transition: { + staggerChildren: 0.1, + }, + }, +}; + +export const itemVariants = { + hidden: { opacity: 0, y: 30 }, + visible: { + opacity: 1, + y: 0, + transition: { + duration: 0.6, + ease: [0.22, 1, 0.36, 1] as const, + }, + }, +}; + +export const cardVariants = { + hidden: { opacity: 0, scale: 0.95 }, + visible: { + opacity: 1, + scale: 1, + transition: { + duration: 0.5, + ease: [0.22, 1, 0.36, 1] as const, + }, + }, +}; diff --git a/messages/en.json b/messages/en.json index f992586..060f49a 100644 --- a/messages/en.json +++ b/messages/en.json @@ -136,12 +136,12 @@ "subject": "Subject", "message": "Leave us a message" }, - "privacy": "You agree to our friendly privacy policy", + "privacy": "You agree to our Privacy Policy.", "send": "SEND MESSAGE", "email": "EMAIL", "emailAddress": "info@ignum-tech.com", "location": "Our Location", - "address": "Toshkent shahri , Yunusabod tumani , Niyozbek yo'li 3 tor ko'chasi , 39 uy", + "address": "39, 3rd Niyozbek Yoli Street, Yunusabad District, Tashkent, Uzbekistan", "phone": "Phone" } }, @@ -291,6 +291,8 @@ "send": "Sent", "error": "Error!", "succes": "sent!", + "loadingError": "An error occurred while loading data", + "productsNotFound": "Products not found", "priceModal": { "title": "Get Price", "product": { diff --git a/messages/ru.json b/messages/ru.json index 79728f9..656af55 100644 --- a/messages/ru.json +++ b/messages/ru.json @@ -136,12 +136,12 @@ "subject": "Тема", "message": "Оставьте нам сообщение" }, - "privacy": "Вы соглашаетесь с нашей дружественной политикой конфиденциальности", + "privacy": "Вы соглашаетесь с нашей Политикой конфиденциальности.", "send": "ОТПРАВИТЬ СООБЩЕНИЕ", "email": "ЭЛЕКТРОННАЯ ПОЧТА", "emailAddress": "info@ignum-tech.com", "location": "Наше Местоположение", - "address": "Toshkent shahri , Yunusabod tumani , Niyozbek yo'li 3 tor ko'chasi , 39 uy", + "address": "г. Ташкент, Юнусабадский район, 3-й проезд Ниёзбек йули, дом 39", "phone": "Телефон" } }, @@ -291,6 +291,8 @@ "send": "Отправить", "error": "Ошибка!", "succes": "Отправлено!", + "loadingError": "Произошла ошибка при загрузке данных", + "productsNotFound": "Товары не найдены", "priceModal": { "title": "Узнать цену", "product": { diff --git a/messages/uz.json b/messages/uz.json index 1654f6a..49c093a 100644 --- a/messages/uz.json +++ b/messages/uz.json @@ -136,7 +136,7 @@ "subject": "Mavzu", "message": "Xabaringizni qoldiring" }, - "privacy": "Bizning maxfiylik siyosatimizga rozilik bildirasiz", + "privacy": "Siz bizning Maxfiylik siyosatimizga rozilik bildirasiz.", "send": "XABAR YUBORISH", "email": "ELEKTRON POCHTA", "emailAddress": "info@ignum-tech.com", @@ -291,6 +291,8 @@ "send": "Yuborish", "error": "Xatolik!", "succes": "Yuborildi!", + "loadingError": "Ma'lumotlarni yuklashda xatolik yuz berdi", + "productsNotFound": "Mahsulotlar topilmadi", "priceModal": { "title": "Narxni bilish", "product": { diff --git a/request/links.ts b/request/links.ts index 2afd773..3195c9e 100644 --- a/request/links.ts +++ b/request/links.ts @@ -6,7 +6,7 @@ export const endPoints = { byId: (id: number) => `subCategory/?category=${id}`, }, services: { - all: "firesafety/", + all: "firesafety/?page_size=500", detail: (id: number) => `firesafety/${id}`, }, product: {