From 809438735f3fb859b82bb78d65038e0c03b50032 Mon Sep 17 00:00:00 2001 From: "nabijonovdavronbek619@gmail.com" Date: Sat, 7 Mar 2026 16:31:18 +0500 Subject: [PATCH] file name and location updayed for better be --- app/[locale]/about/baza/page.tsx | 4 +- app/[locale]/about/layout.tsx | 2 +- app/[locale]/about/notePP/page.tsx | 2 +- app/[locale]/about/page.tsx | 4 +- app/[locale]/about/sertificate/page.tsx | 4 +- app/[locale]/catalog_page/page.tsx | 6 +- .../catalog_page/products/[slug]/page.tsx | 8 +- app/[locale]/catalog_page/products/page.tsx | 8 +- .../catalog_page/subCategory/page.tsx | 4 +- app/[locale]/contact/page.tsx | 2 +- app/[locale]/faq/page.tsx | 2 +- app/[locale]/home/page.tsx | 2 +- app/[locale]/services/detail/page.tsx | 2 +- app/[locale]/services/page.tsx | 4 +- components/breadCrumb.tsx | 6 +- .../products/filter/catalog/filterCatalog.tsx | 92 ------ .../pages/products/filter/catalog/loading.tsx | 23 -- components/pages/products/filter/filter.tsx | 265 ------------------ .../pages/products/filter/filterInfo.tsx | 36 --- components/priceContact.tsx | 2 +- lib/types.ts | 7 + .../pages => pages}/about/aboutBanner.tsx | 0 .../about/aboutDetail/baza.tsx | 0 .../about/aboutDetail/card.tsx | 0 .../about/aboutDetail/guides.tsx | 0 .../about/aboutDetail/loading/guidLoading.tsx | 0 .../about/aboutDetail/loading/loading.tsx | 0 .../about/aboutDetail/normativeCard.tsx | 0 .../about/aboutDetail/sertificateCard.tsx | 0 .../pages => pages}/about/aboutLine.tsx | 0 {components/pages => pages}/about/index.ts | 0 .../pages => pages}/about/innerNavbar.tsx | 0 {components/pages => pages}/about/story.tsx | 0 .../pages => pages}/about/whyChooseUs.tsx | 0 .../pages => pages}/contact/contactHeader.tsx | 0 {components/pages => pages}/contact/form.tsx | 0 {components/pages => pages}/contact/index.ts | 0 {components/pages => pages}/contact/main.tsx | 0 {components/pages => pages}/contact/maps.tsx | 0 .../pages => pages}/faq/answearQuestions.tsx | 0 .../pages => pages}/faq/faqAccardion.tsx | 0 {components/pages => pages}/faq/faqBanner.tsx | 0 {components/pages => pages}/faq/index.ts | 0 {components/pages => pages}/home/about.tsx | 0 .../pages => pages}/home/banner/banner.tsx | 0 .../pages => pages}/home/banner/loading.tsx | 0 .../pages => pages}/home/banner/slider.tsx | 0 .../pages => pages}/home/blog/blog.tsx | 0 .../pages => pages}/home/blog/catalog.tsx | 0 {components/pages => pages}/home/index.ts | 0 {components/pages => pages}/home/line.tsx | 0 .../pages => pages}/home/ourService.tsx | 2 +- .../pages => pages}/home/statistics.tsx | 0 .../pages => pages}/home/testimonal.tsx | 0 {components/pages => pages}/home/video.tsx | 0 .../pages => pages}/products/banner.tsx | 0 .../pages => pages}/products/catalog.tsx | 4 +- pages/products/filter/filter.tsx | 34 +++ {components/pages => pages}/products/index.ts | 0 .../products/product/mianProduct.tsx | 6 +- .../products/product/productCard.tsx | 0 .../products/product/products.tsx | 7 +- .../pages => pages}/products/slug/empty.tsx | 0 .../products/slug/features.tsx | 0 .../pages => pages}/products/slug/loading.tsx | 0 .../products/slug/rightSide.tsx | 2 +- .../pages => pages}/products/slug/slider.tsx | 0 .../pages => pages}/services/empty.tsx | 0 {components/pages => pages}/services/index.ts | 0 .../pages => pages}/services/loading.tsx | 0 .../services/serviceBanner.tsx | 0 .../pages => pages}/services/serviceFaq.tsx | 0 .../services/servicePageServices.tsx | 2 +- .../pages => pages}/subCategory/body.tsx | 2 +- .../pages => pages}/subCategory/card.tsx | 2 +- .../pages => pages}/subCategory/index.ts | 0 request/links.ts | 11 +- {store => zustand}/useCategory.ts | 0 {store => zustand}/useProceModalStore.ts | 0 {store => zustand}/useProduct.ts | 0 {store => zustand}/useService.ts | 0 {store => zustand}/useSubCategory.ts | 0 82 files changed, 87 insertions(+), 470 deletions(-) delete mode 100644 components/pages/products/filter/catalog/filterCatalog.tsx delete mode 100644 components/pages/products/filter/catalog/loading.tsx delete mode 100644 components/pages/products/filter/filter.tsx delete mode 100644 components/pages/products/filter/filterInfo.tsx rename {components/pages => pages}/about/aboutBanner.tsx (100%) rename {components/pages => pages}/about/aboutDetail/baza.tsx (100%) rename {components/pages => pages}/about/aboutDetail/card.tsx (100%) rename {components/pages => pages}/about/aboutDetail/guides.tsx (100%) rename {components/pages => pages}/about/aboutDetail/loading/guidLoading.tsx (100%) rename {components/pages => pages}/about/aboutDetail/loading/loading.tsx (100%) rename {components/pages => pages}/about/aboutDetail/normativeCard.tsx (100%) rename {components/pages => pages}/about/aboutDetail/sertificateCard.tsx (100%) rename {components/pages => pages}/about/aboutLine.tsx (100%) rename {components/pages => pages}/about/index.ts (100%) rename {components/pages => pages}/about/innerNavbar.tsx (100%) rename {components/pages => pages}/about/story.tsx (100%) rename {components/pages => pages}/about/whyChooseUs.tsx (100%) rename {components/pages => pages}/contact/contactHeader.tsx (100%) rename {components/pages => pages}/contact/form.tsx (100%) rename {components/pages => pages}/contact/index.ts (100%) rename {components/pages => pages}/contact/main.tsx (100%) rename {components/pages => pages}/contact/maps.tsx (100%) rename {components/pages => pages}/faq/answearQuestions.tsx (100%) rename {components/pages => pages}/faq/faqAccardion.tsx (100%) rename {components/pages => pages}/faq/faqBanner.tsx (100%) rename {components/pages => pages}/faq/index.ts (100%) rename {components/pages => pages}/home/about.tsx (100%) rename {components/pages => pages}/home/banner/banner.tsx (100%) rename {components/pages => pages}/home/banner/loading.tsx (100%) rename {components/pages => pages}/home/banner/slider.tsx (100%) rename {components/pages => pages}/home/blog/blog.tsx (100%) rename {components/pages => pages}/home/blog/catalog.tsx (100%) rename {components/pages => pages}/home/index.ts (100%) rename {components/pages => pages}/home/line.tsx (100%) rename {components/pages => pages}/home/ourService.tsx (99%) rename {components/pages => pages}/home/statistics.tsx (100%) rename {components/pages => pages}/home/testimonal.tsx (100%) rename {components/pages => pages}/home/video.tsx (100%) rename {components/pages => pages}/products/banner.tsx (100%) rename {components/pages => pages}/products/catalog.tsx (98%) create mode 100644 pages/products/filter/filter.tsx rename {components/pages => pages}/products/index.ts (100%) rename {components/pages => pages}/products/product/mianProduct.tsx (95%) rename {components/pages => pages}/products/product/productCard.tsx (100%) rename {components/pages => pages}/products/product/products.tsx (66%) rename {components/pages => pages}/products/slug/empty.tsx (100%) rename {components/pages => pages}/products/slug/features.tsx (100%) rename {components/pages => pages}/products/slug/loading.tsx (100%) rename {components/pages => pages}/products/slug/rightSide.tsx (98%) rename {components/pages => pages}/products/slug/slider.tsx (100%) rename {components/pages => pages}/services/empty.tsx (100%) rename {components/pages => pages}/services/index.ts (100%) rename {components/pages => pages}/services/loading.tsx (100%) rename {components/pages => pages}/services/serviceBanner.tsx (100%) rename {components/pages => pages}/services/serviceFaq.tsx (100%) rename {components/pages => pages}/services/servicePageServices.tsx (99%) rename {components/pages => pages}/subCategory/body.tsx (96%) rename {components/pages => pages}/subCategory/card.tsx (96%) rename {components/pages => pages}/subCategory/index.ts (100%) rename {store => zustand}/useCategory.ts (100%) rename {store => zustand}/useProceModalStore.ts (100%) rename {store => zustand}/useProduct.ts (100%) rename {store => zustand}/useService.ts (100%) rename {store => zustand}/useSubCategory.ts (100%) diff --git a/app/[locale]/about/baza/page.tsx b/app/[locale]/about/baza/page.tsx index b27f0b7..c80009c 100644 --- a/app/[locale]/about/baza/page.tsx +++ b/app/[locale]/about/baza/page.tsx @@ -1,5 +1,5 @@ -import NormativBazaPage from "@/components/pages/about/aboutDetail/baza"; -import { Statistics } from "@/components/pages/home"; +import NormativBazaPage from "@/pages/about/aboutDetail/baza"; +import { Statistics } from "@/pages/home"; export default function Baza() { return ( diff --git a/app/[locale]/about/layout.tsx b/app/[locale]/about/layout.tsx index 8a591cc..c42e3e9 100644 --- a/app/[locale]/about/layout.tsx +++ b/app/[locale]/about/layout.tsx @@ -1,4 +1,4 @@ -import { AboutBanner } from "@/components/pages/about"; +import { AboutBanner } from "@/pages/about"; import React from "react"; export default function AboutLayout({ diff --git a/app/[locale]/about/notePP/page.tsx b/app/[locale]/about/notePP/page.tsx index fe4a2cf..2476bfe 100644 --- a/app/[locale]/about/notePP/page.tsx +++ b/app/[locale]/about/notePP/page.tsx @@ -1,5 +1,5 @@ import { useTranslations } from "next-intl"; -import { Guides } from "@/components/pages/about/aboutDetail/guides"; +import { Guides } from "@/pages/about/aboutDetail/guides"; export default function NotePPPage() { const t = useTranslations(); diff --git a/app/[locale]/about/page.tsx b/app/[locale]/about/page.tsx index c8bf8bb..a42dd99 100644 --- a/app/[locale]/about/page.tsx +++ b/app/[locale]/about/page.tsx @@ -1,5 +1,5 @@ -import { Story, WhyChooseUs } from "@/components/pages/about"; -import { Statistics } from "@/components/pages/home"; +import { Story, WhyChooseUs } from "@/pages/about"; +import { Statistics } from "@/pages/home"; export default function Page() { return ( diff --git a/app/[locale]/about/sertificate/page.tsx b/app/[locale]/about/sertificate/page.tsx index 86bcaa4..61c7ffb 100644 --- a/app/[locale]/about/sertificate/page.tsx +++ b/app/[locale]/about/sertificate/page.tsx @@ -1,6 +1,6 @@ "use client"; -import { CertCardSkeleton } from "@/components/pages/about/aboutDetail/loading/loading"; -import { CertCard } from "@/components/pages/about/aboutDetail/sertificateCard"; +import { CertCardSkeleton } from "@/pages/about/aboutDetail/loading/loading"; +import { CertCard } from "@/pages/about/aboutDetail/sertificateCard"; import PaginationLite from "@/components/paginationUI"; import { certs } from "@/lib/demoData"; import httpClient from "@/request/api"; diff --git a/app/[locale]/catalog_page/page.tsx b/app/[locale]/catalog_page/page.tsx index bf053ce..d13149c 100644 --- a/app/[locale]/catalog_page/page.tsx +++ b/app/[locale]/catalog_page/page.tsx @@ -1,7 +1,7 @@ import { Breadcrumb } from "@/components/breadCrumb"; -import Catalog from "@/components/pages/home/blog/catalog"; -import { ProductBanner } from "@/components/pages/products"; -import { MainSubCategory } from "@/components/pages/subCategory"; +import Catalog from "@/pages/home/blog/catalog"; +import { ProductBanner } from "@/pages/products"; +import { MainSubCategory } from "@/pages/subCategory"; export default function Page() { return ( diff --git a/app/[locale]/catalog_page/products/[slug]/page.tsx b/app/[locale]/catalog_page/products/[slug]/page.tsx index 3807649..ccdb582 100644 --- a/app/[locale]/catalog_page/products/[slug]/page.tsx +++ b/app/[locale]/catalog_page/products/[slug]/page.tsx @@ -1,12 +1,12 @@ "use client"; -import { Features, RightSide, SliderComp } from "@/components/pages/products"; -import { useProductPageInfo } from "@/store/useProduct"; +import { Features, RightSide, SliderComp } from "@/pages/products"; +import { useProductPageInfo } from "@/zustand/useProduct"; import { useQuery } from "@tanstack/react-query"; import httpClient from "@/request/api"; import { endPoints } from "@/request/links"; -import { LoadingSkeleton } from "@/components/pages/products/slug/loading"; -import { EmptyState } from "@/components/pages/products/slug/empty"; +import { LoadingSkeleton } from "@/pages/products/slug/loading"; +import { EmptyState } from "@/pages/products/slug/empty"; import { useEffect } from "react"; import { Breadcrumb } from "@/components/breadCrumb"; import { useSearchParams } from "next/navigation"; diff --git a/app/[locale]/catalog_page/products/page.tsx b/app/[locale]/catalog_page/products/page.tsx index 31f8b03..a2b1ae9 100644 --- a/app/[locale]/catalog_page/products/page.tsx +++ b/app/[locale]/catalog_page/products/page.tsx @@ -1,17 +1,15 @@ "use client"; import { Breadcrumb } from "@/components/breadCrumb"; -import { ProductBanner, Products } from "@/components/pages/products"; -import FilterCatalog from "@/components/pages/products/filter/catalog/filterCatalog"; -import { useSubCategory } from "@/store/useSubCategory"; +import { ProductBanner, Products } from "@/pages/products"; +import { useSubCategory } from "@/zustand/useSubCategory"; export default function Page() { const subCategory = useSubCategory((state) => state.subCategory); return (
- {/* */}
- +
diff --git a/app/[locale]/catalog_page/subCategory/page.tsx b/app/[locale]/catalog_page/subCategory/page.tsx index 2582ad5..edc3940 100644 --- a/app/[locale]/catalog_page/subCategory/page.tsx +++ b/app/[locale]/catalog_page/subCategory/page.tsx @@ -1,6 +1,6 @@ import { Breadcrumb } from "@/components/breadCrumb"; -import { ProductBanner } from "@/components/pages/products"; -import { MainSubCategory } from "@/components/pages/subCategory"; +import { ProductBanner } from "@/pages/products"; +import { MainSubCategory } from "@/pages/subCategory"; export default function Page() { return ( diff --git a/app/[locale]/contact/page.tsx b/app/[locale]/contact/page.tsx index b6fd9e8..e8097a2 100644 --- a/app/[locale]/contact/page.tsx +++ b/app/[locale]/contact/page.tsx @@ -1,4 +1,4 @@ -import { Contact } from "@/components/pages/contact"; +import { Contact } from "@/pages/contact"; export default function Page() { return ; diff --git a/app/[locale]/faq/page.tsx b/app/[locale]/faq/page.tsx index 7073d60..8e50727 100644 --- a/app/[locale]/faq/page.tsx +++ b/app/[locale]/faq/page.tsx @@ -1,4 +1,4 @@ -import { FaqBanner, Togle } from "@/components/pages/faq"; +import { FaqBanner, Togle } from "@/pages/faq"; export default function Page() { return ( diff --git a/app/[locale]/home/page.tsx b/app/[locale]/home/page.tsx index fef6a32..7e3820f 100644 --- a/app/[locale]/home/page.tsx +++ b/app/[locale]/home/page.tsx @@ -8,7 +8,7 @@ import { Statistics, Testimonial, Video, -} from "@/components/pages/home"; +} from "@/pages/home"; export default function Home() { return ( diff --git a/app/[locale]/services/detail/page.tsx b/app/[locale]/services/detail/page.tsx index b71195a..da793f1 100644 --- a/app/[locale]/services/detail/page.tsx +++ b/app/[locale]/services/detail/page.tsx @@ -7,7 +7,7 @@ import { SystemFeature, } from "@/lib/api/demoapi/operationalSystems"; import { Breadcrumb } from "@/components/breadCrumb"; -import { useServiceDetail } from "@/store/useService"; +import { useServiceDetail } from "@/zustand/useService"; import { useQuery } from "@tanstack/react-query"; import httpClient from "@/request/api"; import { endPoints } from "@/request/links"; diff --git a/app/[locale]/services/page.tsx b/app/[locale]/services/page.tsx index e865a5a..80bc9e6 100644 --- a/app/[locale]/services/page.tsx +++ b/app/[locale]/services/page.tsx @@ -1,9 +1,9 @@ -import { Video } from "@/components/pages/home"; +import { Video } from "@/pages/home"; import { ServiceBanner, ServiceFaq, ServicePageServices, -} from "@/components/pages/services"; +} from "@/pages/services"; export default function Page() { return ( diff --git a/components/breadCrumb.tsx b/components/breadCrumb.tsx index ca2a2a2..a68b770 100644 --- a/components/breadCrumb.tsx +++ b/components/breadCrumb.tsx @@ -3,9 +3,9 @@ import Link from "next/link"; import { usePathname } from "next/navigation"; import { ChevronRight, Home } from "lucide-react"; import { useTranslations } from "next-intl"; -import { useCategory } from "@/store/useCategory"; -import { useSubCategory } from "@/store/useSubCategory"; -import { useProductPageInfo } from "@/store/useProduct"; +import { useCategory } from "@/zustand/useCategory"; +import { useSubCategory } from "@/zustand/useSubCategory"; +import { useProductPageInfo } from "@/zustand/useProduct"; interface BreadcrumbProps { customLabels?: Record; diff --git a/components/pages/products/filter/catalog/filterCatalog.tsx b/components/pages/products/filter/catalog/filterCatalog.tsx deleted file mode 100644 index e0cab24..0000000 --- a/components/pages/products/filter/catalog/filterCatalog.tsx +++ /dev/null @@ -1,92 +0,0 @@ -"use client"; -import EmptyData from "@/components/EmptyData"; -import { CategoryType } from "@/lib/types"; -import httpClient from "@/request/api"; -import { getRouteLang } from "@/request/getLang"; -import { endPoints } from "@/request/links"; -import { useCategory } from "@/store/useCategory"; -import { useQuery } from "@tanstack/react-query"; -import CatalogCardSkeletonSmall from "./loading"; -import Image from "next/image"; -import { ArrowUpRight } from "lucide-react"; - -export default function FilterCatalog() { - const language = getRouteLang(); - const setCategory = useCategory((state) => state.setCategory); - const { data, isLoading } = useQuery({ - queryKey: ["category", language], - queryFn: () => httpClient(endPoints.category.all), - select: (data): CategoryType[] => data?.data?.results, - }); - - 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 */} -
-
-

- {item.name} -

- -
- -
-
-
- - {/* Image container */} -
-
- -
- {item.name} -
-
-
-
- ))} -
- ); -} diff --git a/components/pages/products/filter/catalog/loading.tsx b/components/pages/products/filter/catalog/loading.tsx deleted file mode 100644 index a0a42ce..0000000 --- a/components/pages/products/filter/catalog/loading.tsx +++ /dev/null @@ -1,23 +0,0 @@ -// 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 deleted file mode 100644 index 26fa42d..0000000 --- a/components/pages/products/filter/filter.tsx +++ /dev/null @@ -1,265 +0,0 @@ -"use client"; -import { result } from "@/lib/demoData"; -import { useFilter } from "@/lib/filter-zustand"; -import httpClient from "@/request/api"; -import { endPoints } from "@/request/links"; -import { useCategory } from "@/store/useCategory"; -import { useSubCategory } from "@/store/useSubCategory"; -import { useQuery } from "@tanstack/react-query"; -import { Check, ChevronDown, ChevronUp } from "lucide-react"; -import { useTranslations } from "next-intl"; -import { useEffect, useState } from "react"; - -export default function Filter() { - const filter = useFilter((state) => state.filter); - const toggleFilter = useFilter((state) => state.toggleFilter); - const hasData = useFilter((state) => state.hasFilter); - const category = useCategory((state) => state.category); - const setCategory = useCategory((state) => state.setCategory); - const subCategory = useSubCategory((state) => state.subCategory); - const setSubCategory = useSubCategory((state) => state.setSubCategory); - const clearSubCategory = useSubCategory((state) => state.clearSubCategory); - const t = useTranslations(); - - const [dataExpanded, setDataExpanded] = useState(false); - const [numberExpanded, setNumberExpanded] = useState(false); - - // ⭐ YANGI: Dropdown state'lar - har bir kategoriya uchun - const [openDropdowns, setOpenDropdowns] = useState>( - {}, - ); - - const [catalogData, setCatalogData] = useState< - { id: number; name: string; type: string }[] - >(result[0].items); - const [sizeData, setSizeData] = useState< - { id: number; name: string; type: string }[] - >(result[1].items); - - // Category data - const { data: categoryBack } = useQuery({ - queryKey: ["category"], - queryFn: () => httpClient(endPoints.category.all), - select: (data) => data?.data?.results, - }); - - // ⭐ O'ZGARTIRILDI: subCategory so'rovi faqat dropdown ochilganda va have_sub_category true bo'lganda - const { data: subCategoryBack, isLoading: subCategoryLoading } = useQuery({ - queryKey: ["subCategory", category.id], - queryFn: () => httpClient(endPoints.subCategory.byId(category.id)), - // ⭐ YANGI: Faqat category tanlangan va have_sub_category true bo'lsa ishlaydi - enabled: - !!category.id && - category.have_sub_category === true && - openDropdowns[category.id] === true, - select: (data) => data?.data?.results, - }); - - // ⭐ O'ZGARTIRILDI: Catalog va Size query'lari category yoki subCategory ID'ga qarab ishlaydi - const activeId = subCategory.id || category.id; - - const { data: catalog } = useQuery({ - queryKey: ["catalog", activeId], - queryFn: () => httpClient(endPoints.filter.catalogCategoryId(activeId)), - enabled: !!activeId, - select: (data) => { - const catalogData = data?.data?.results || []; - return catalogData.map((item: any) => ({ - id: item.id, - name: item.name, - type: "catalog", - })); - }, - }); - - const { data: size } = useQuery({ - queryKey: ["size", activeId], - queryFn: () => httpClient(endPoints.filter.sizeCategoryId(activeId)), - enabled: !!activeId, - select: (data) => { - const sizedata = data?.data?.results || []; - return sizedata.map((item: any) => ({ - id: item.id, - name: item.name, - type: "size", - })); - }, - }); - - useEffect(() => { - catalog && setCatalogData(catalog); - size && setSizeData(size); - }, [size, catalog]); - - // Bo'lim uchun ko'rsatiladigan itemlar - const visibleSectionData = dataExpanded - ? catalogData - : catalogData.slice(0, 5); - - // O'lcham uchun ko'rsatiladigan itemlar - const visibleSectionNumber = numberExpanded - ? sizeData - : sizeData.slice(0, 10); - - // ⭐ O'ZGARTIRILDI: Category bosilganda dropdown toggle qilish - const handleCategoryClick = (item: any) => { - if (item.have_sub_category) { - // Agar subCategory bo'lsa, dropdown ochish/yopish - setOpenDropdowns((prev) => ({ - ...prev, - [item.id]: !prev[item.id], - })); - - // Category'ni set qilish (filterlar yangilanishi uchun) - setCategory(item); - - // SubCategory'ni tozalash (yangisini tanlash uchun) - if (!openDropdowns[item.id]) { - clearSubCategory(); - } - } else { - // Agar subCategory bo'lmasa, to'g'ridan-to'g'ri category ni set qilish - setCategory(item); - clearSubCategory(); - - // Barcha dropdown'larni yopish - setOpenDropdowns({}); - } - }; - - // ⭐ YANGI: SubCategory bosilganda - const handleSubCategoryClick = (item: any) => { - setSubCategory(item); - }; - - return ( -
- {/* ⭐ O'ZGARTIRILDI: Category filter with dropdown */} -
-

- {t("category")} -

-
- {categoryBack?.map((item: any) => ( -
- {/* Main Category */} -
handleCategoryClick(item)} - className="hover:cursor-pointer flex items-center gap-2 w-auto shrink-0 hover:bg-gray-600 lg:p-2 rounded transition-colors" - > - {/* Checkbox yoki Dropdown icon */} - {!item.have_sub_category ? ( - - {category.id === item.id && ( - - )} - - ) : ( - - {openDropdowns[item.id] ? ( - - ) : ( - - )} - - )} - -

{item.name}

-
- - {/* ⭐ YANGI: SubCategory Dropdown */} - {item.have_sub_category && openDropdowns[item.id] && ( -
- {subCategoryLoading ? ( -

Yuklanmoqda...

- ) : subCategoryBack && subCategoryBack.length > 0 ? ( - subCategoryBack.map((subItem: any) => ( -
handleSubCategoryClick(subItem)} - className="hover:cursor-pointer flex items-center gap-2 hover:bg-gray-600 p-1.5 rounded transition-colors" - > - - {subCategory.id === subItem.id && ( - - )} - -

- {subItem.name} -

-
- )) - ) : ( -

- {t("subcategory_not_found")} -

- )} -
- )} -
- ))} -
-
- - {/* Bo'lim filtri check */} - {/*{visibleSectionData && visibleSectionData.length > 0 && ( -
-

- {t("section")} -

-
- {visibleSectionData.map((item: any) => ( -
toggleFilter(item)} - className="hover:cursor-pointer flex items-center gap-2 w-auto shrink-0 hover:bg-gray-600 lg:p-2 rounded transition-colors" - > - - {hasData(item.name) && ( - - )} - -

{item.name}

-
- ))} -
- -
- )}*/} -
- ); -} diff --git a/components/pages/products/filter/filterInfo.tsx b/components/pages/products/filter/filterInfo.tsx deleted file mode 100644 index e1e4bbb..0000000 --- a/components/pages/products/filter/filterInfo.tsx +++ /dev/null @@ -1,36 +0,0 @@ -"use client"; - -import { useFilter } from "@/lib/filter-zustand"; -import { X } from "lucide-react"; -import { useTranslations } from "next-intl"; - -export default function FilterInfo() { - const filtered = useFilter((state) => state.filter); - const resetFilter = useFilter((state) => state.resetFilter); - const togleFilter = useFilter((state) => state.toggleFilter); - const t = useTranslations(); - if (filtered.length === 0) { - return null; - } - return ( -
-
- {filtered && - filtered.map((item) => ( -
- - {item.name} -
- ))} -
- -
- ); -} diff --git a/components/priceContact.tsx b/components/priceContact.tsx index 6e625bc..fdc0f1c 100644 --- a/components/priceContact.tsx +++ b/components/priceContact.tsx @@ -3,7 +3,7 @@ import { useTranslations } from "next-intl"; import Image from "next/image"; import { useState, useEffect } from "react"; import { X } from "lucide-react"; -import { usePriceModalStore } from "@/store/useProceModalStore"; +import { usePriceModalStore } from "@/zustand/useProceModalStore"; import { useMutation } from "@tanstack/react-query"; import httpClient from "@/request/api"; import { endPoints } from "@/request/links"; diff --git a/lib/types.ts b/lib/types.ts index 232aa36..e20c5c6 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -54,3 +54,10 @@ export interface BannerType { title: string; description: string; } + +export interface CatalogItem { + id: number; + name: string; + parent: number | null; + children: CatalogItem[]; +} \ No newline at end of file diff --git a/components/pages/about/aboutBanner.tsx b/pages/about/aboutBanner.tsx similarity index 100% rename from components/pages/about/aboutBanner.tsx rename to pages/about/aboutBanner.tsx diff --git a/components/pages/about/aboutDetail/baza.tsx b/pages/about/aboutDetail/baza.tsx similarity index 100% rename from components/pages/about/aboutDetail/baza.tsx rename to pages/about/aboutDetail/baza.tsx diff --git a/components/pages/about/aboutDetail/card.tsx b/pages/about/aboutDetail/card.tsx similarity index 100% rename from components/pages/about/aboutDetail/card.tsx rename to pages/about/aboutDetail/card.tsx diff --git a/components/pages/about/aboutDetail/guides.tsx b/pages/about/aboutDetail/guides.tsx similarity index 100% rename from components/pages/about/aboutDetail/guides.tsx rename to pages/about/aboutDetail/guides.tsx diff --git a/components/pages/about/aboutDetail/loading/guidLoading.tsx b/pages/about/aboutDetail/loading/guidLoading.tsx similarity index 100% rename from components/pages/about/aboutDetail/loading/guidLoading.tsx rename to pages/about/aboutDetail/loading/guidLoading.tsx diff --git a/components/pages/about/aboutDetail/loading/loading.tsx b/pages/about/aboutDetail/loading/loading.tsx similarity index 100% rename from components/pages/about/aboutDetail/loading/loading.tsx rename to pages/about/aboutDetail/loading/loading.tsx diff --git a/components/pages/about/aboutDetail/normativeCard.tsx b/pages/about/aboutDetail/normativeCard.tsx similarity index 100% rename from components/pages/about/aboutDetail/normativeCard.tsx rename to pages/about/aboutDetail/normativeCard.tsx diff --git a/components/pages/about/aboutDetail/sertificateCard.tsx b/pages/about/aboutDetail/sertificateCard.tsx similarity index 100% rename from components/pages/about/aboutDetail/sertificateCard.tsx rename to pages/about/aboutDetail/sertificateCard.tsx diff --git a/components/pages/about/aboutLine.tsx b/pages/about/aboutLine.tsx similarity index 100% rename from components/pages/about/aboutLine.tsx rename to pages/about/aboutLine.tsx diff --git a/components/pages/about/index.ts b/pages/about/index.ts similarity index 100% rename from components/pages/about/index.ts rename to pages/about/index.ts diff --git a/components/pages/about/innerNavbar.tsx b/pages/about/innerNavbar.tsx similarity index 100% rename from components/pages/about/innerNavbar.tsx rename to pages/about/innerNavbar.tsx diff --git a/components/pages/about/story.tsx b/pages/about/story.tsx similarity index 100% rename from components/pages/about/story.tsx rename to pages/about/story.tsx diff --git a/components/pages/about/whyChooseUs.tsx b/pages/about/whyChooseUs.tsx similarity index 100% rename from components/pages/about/whyChooseUs.tsx rename to pages/about/whyChooseUs.tsx diff --git a/components/pages/contact/contactHeader.tsx b/pages/contact/contactHeader.tsx similarity index 100% rename from components/pages/contact/contactHeader.tsx rename to pages/contact/contactHeader.tsx diff --git a/components/pages/contact/form.tsx b/pages/contact/form.tsx similarity index 100% rename from components/pages/contact/form.tsx rename to pages/contact/form.tsx diff --git a/components/pages/contact/index.ts b/pages/contact/index.ts similarity index 100% rename from components/pages/contact/index.ts rename to pages/contact/index.ts diff --git a/components/pages/contact/main.tsx b/pages/contact/main.tsx similarity index 100% rename from components/pages/contact/main.tsx rename to pages/contact/main.tsx diff --git a/components/pages/contact/maps.tsx b/pages/contact/maps.tsx similarity index 100% rename from components/pages/contact/maps.tsx rename to pages/contact/maps.tsx diff --git a/components/pages/faq/answearQuestions.tsx b/pages/faq/answearQuestions.tsx similarity index 100% rename from components/pages/faq/answearQuestions.tsx rename to pages/faq/answearQuestions.tsx diff --git a/components/pages/faq/faqAccardion.tsx b/pages/faq/faqAccardion.tsx similarity index 100% rename from components/pages/faq/faqAccardion.tsx rename to pages/faq/faqAccardion.tsx diff --git a/components/pages/faq/faqBanner.tsx b/pages/faq/faqBanner.tsx similarity index 100% rename from components/pages/faq/faqBanner.tsx rename to pages/faq/faqBanner.tsx diff --git a/components/pages/faq/index.ts b/pages/faq/index.ts similarity index 100% rename from components/pages/faq/index.ts rename to pages/faq/index.ts diff --git a/components/pages/home/about.tsx b/pages/home/about.tsx similarity index 100% rename from components/pages/home/about.tsx rename to pages/home/about.tsx diff --git a/components/pages/home/banner/banner.tsx b/pages/home/banner/banner.tsx similarity index 100% rename from components/pages/home/banner/banner.tsx rename to pages/home/banner/banner.tsx diff --git a/components/pages/home/banner/loading.tsx b/pages/home/banner/loading.tsx similarity index 100% rename from components/pages/home/banner/loading.tsx rename to pages/home/banner/loading.tsx diff --git a/components/pages/home/banner/slider.tsx b/pages/home/banner/slider.tsx similarity index 100% rename from components/pages/home/banner/slider.tsx rename to pages/home/banner/slider.tsx diff --git a/components/pages/home/blog/blog.tsx b/pages/home/blog/blog.tsx similarity index 100% rename from components/pages/home/blog/blog.tsx rename to pages/home/blog/blog.tsx diff --git a/components/pages/home/blog/catalog.tsx b/pages/home/blog/catalog.tsx similarity index 100% rename from components/pages/home/blog/catalog.tsx rename to pages/home/blog/catalog.tsx diff --git a/components/pages/home/index.ts b/pages/home/index.ts similarity index 100% rename from components/pages/home/index.ts rename to pages/home/index.ts diff --git a/components/pages/home/line.tsx b/pages/home/line.tsx similarity index 100% rename from components/pages/home/line.tsx rename to pages/home/line.tsx diff --git a/components/pages/home/ourService.tsx b/pages/home/ourService.tsx similarity index 99% rename from components/pages/home/ourService.tsx rename to pages/home/ourService.tsx index 6104250..b558d98 100644 --- a/components/pages/home/ourService.tsx +++ b/pages/home/ourService.tsx @@ -10,7 +10,7 @@ import Link from "next/link"; import { motion } from "framer-motion"; import { ServicesLoading } from "../services/loading"; import { EmptyServices } from "../services/empty"; -import { useServiceDetail } from "@/store/useService"; +import { useServiceDetail } from "@/zustand/useService"; import { cardVariants, containerVariants } from "@/lib/animations"; export function OurService() { diff --git a/components/pages/home/statistics.tsx b/pages/home/statistics.tsx similarity index 100% rename from components/pages/home/statistics.tsx rename to pages/home/statistics.tsx diff --git a/components/pages/home/testimonal.tsx b/pages/home/testimonal.tsx similarity index 100% rename from components/pages/home/testimonal.tsx rename to pages/home/testimonal.tsx diff --git a/components/pages/home/video.tsx b/pages/home/video.tsx similarity index 100% rename from components/pages/home/video.tsx rename to pages/home/video.tsx diff --git a/components/pages/products/banner.tsx b/pages/products/banner.tsx similarity index 100% rename from components/pages/products/banner.tsx rename to pages/products/banner.tsx diff --git a/components/pages/products/catalog.tsx b/pages/products/catalog.tsx similarity index 98% rename from components/pages/products/catalog.tsx rename to pages/products/catalog.tsx index 14ed875..e532861 100644 --- a/components/pages/products/catalog.tsx +++ b/pages/products/catalog.tsx @@ -48,8 +48,8 @@ import { useLocale, useTranslations } from "next-intl"; import Image from "next/image"; import Link from "next/link"; import { ArrowUpRight } from "lucide-react"; -import { useCategory } from "@/store/useCategory"; -import { useSubCategory } from "@/store/useSubCategory"; +import { useCategory } from "@/zustand/useCategory"; +import { useSubCategory } from "@/zustand/useSubCategory"; interface CatalogProps { id: number; diff --git a/pages/products/filter/filter.tsx b/pages/products/filter/filter.tsx new file mode 100644 index 0000000..e4d1af8 --- /dev/null +++ b/pages/products/filter/filter.tsx @@ -0,0 +1,34 @@ +import { CatalogItem } from "@/lib/types"; +import httpClient from "@/request/api"; +import { endPoints } from "@/request/links"; +import { useQuery } from "@tanstack/react-query"; +import { ChevronDown } from "lucide-react"; + +export default function Filter() { + const { data } = useQuery({ + queryKey: ["catalogsection"], + queryFn: () => httpClient(endPoints.filter.catalog), + select: (res) => res?.data?.data?.results, + }); + + console.log("filter catalog: ", data); + return ( +
+
+ {data?.map((item: CatalogItem) => ( +
+
{item.name}
+ {item.children.length > 0 && ( + + )} +
+ ))} +
+
+ ); +} diff --git a/components/pages/products/index.ts b/pages/products/index.ts similarity index 100% rename from components/pages/products/index.ts rename to pages/products/index.ts diff --git a/components/pages/products/product/mianProduct.tsx b/pages/products/product/mianProduct.tsx similarity index 95% rename from components/pages/products/product/mianProduct.tsx rename to pages/products/product/mianProduct.tsx index 43abccc..24f4c20 100644 --- a/components/pages/products/product/mianProduct.tsx +++ b/pages/products/product/mianProduct.tsx @@ -3,11 +3,11 @@ import httpClient from "@/request/api"; import { endPoints } from "@/request/links"; import { useQuery } from "@tanstack/react-query"; import ProductCard from "./productCard"; -import { useCategory } from "@/store/useCategory"; +import { useCategory } from "@/zustand/useCategory"; import { useFilter } from "@/lib/filter-zustand"; import { useMemo, useState } from "react"; -import { useProductPageInfo } from "@/store/useProduct"; -import { useSubCategory } from "@/store/useSubCategory"; +import { useProductPageInfo } from "@/zustand/useProduct"; +import { useSubCategory } from "@/zustand/useSubCategory"; import { useTranslations } from "next-intl"; import PaginationLite from "@/components/paginationUI"; diff --git a/components/pages/products/product/productCard.tsx b/pages/products/product/productCard.tsx similarity index 100% rename from components/pages/products/product/productCard.tsx rename to pages/products/product/productCard.tsx diff --git a/components/pages/products/product/products.tsx b/pages/products/product/products.tsx similarity index 66% rename from components/pages/products/product/products.tsx rename to pages/products/product/products.tsx index 84a0349..84ce45f 100644 --- a/components/pages/products/product/products.tsx +++ b/pages/products/product/products.tsx @@ -1,19 +1,16 @@ import Filter from "../filter/filter"; -import FilterInfo from "../filter/filterInfo"; import MainProduct from "./mianProduct"; export function Products() { return (
-
+
{/* filter part */} - {/**/} + {/* main products */} - -
diff --git a/components/pages/products/slug/empty.tsx b/pages/products/slug/empty.tsx similarity index 100% rename from components/pages/products/slug/empty.tsx rename to pages/products/slug/empty.tsx diff --git a/components/pages/products/slug/features.tsx b/pages/products/slug/features.tsx similarity index 100% rename from components/pages/products/slug/features.tsx rename to pages/products/slug/features.tsx diff --git a/components/pages/products/slug/loading.tsx b/pages/products/slug/loading.tsx similarity index 100% rename from components/pages/products/slug/loading.tsx rename to pages/products/slug/loading.tsx diff --git a/components/pages/products/slug/rightSide.tsx b/pages/products/slug/rightSide.tsx similarity index 98% rename from components/pages/products/slug/rightSide.tsx rename to pages/products/slug/rightSide.tsx index 417d760..acec2f8 100644 --- a/components/pages/products/slug/rightSide.tsx +++ b/pages/products/slug/rightSide.tsx @@ -1,6 +1,6 @@ "use client"; -import { usePriceModalStore } from "@/store/useProceModalStore"; +import { usePriceModalStore } from "@/zustand/useProceModalStore"; import { Check, Instagram, Send, Share2 } from "lucide-react"; import { useTranslations } from "next-intl"; import { useParams } from "next/navigation"; diff --git a/components/pages/products/slug/slider.tsx b/pages/products/slug/slider.tsx similarity index 100% rename from components/pages/products/slug/slider.tsx rename to pages/products/slug/slider.tsx diff --git a/components/pages/services/empty.tsx b/pages/services/empty.tsx similarity index 100% rename from components/pages/services/empty.tsx rename to pages/services/empty.tsx diff --git a/components/pages/services/index.ts b/pages/services/index.ts similarity index 100% rename from components/pages/services/index.ts rename to pages/services/index.ts diff --git a/components/pages/services/loading.tsx b/pages/services/loading.tsx similarity index 100% rename from components/pages/services/loading.tsx rename to pages/services/loading.tsx diff --git a/components/pages/services/serviceBanner.tsx b/pages/services/serviceBanner.tsx similarity index 100% rename from components/pages/services/serviceBanner.tsx rename to pages/services/serviceBanner.tsx diff --git a/components/pages/services/serviceFaq.tsx b/pages/services/serviceFaq.tsx similarity index 100% rename from components/pages/services/serviceFaq.tsx rename to pages/services/serviceFaq.tsx diff --git a/components/pages/services/servicePageServices.tsx b/pages/services/servicePageServices.tsx similarity index 99% rename from components/pages/services/servicePageServices.tsx rename to pages/services/servicePageServices.tsx index e97a457..f5b2962 100644 --- a/components/pages/services/servicePageServices.tsx +++ b/pages/services/servicePageServices.tsx @@ -10,7 +10,7 @@ import Link from "next/link"; import { motion } from "framer-motion"; import { ServicesLoading } from "./loading"; import { EmptyServices } from "./empty"; -import { useServiceDetail } from "@/store/useService"; +import { useServiceDetail } from "@/zustand/useService"; import { cardVariants, containerVariants } from "@/lib/animations"; export function ServicePageServices() { diff --git a/components/pages/subCategory/body.tsx b/pages/subCategory/body.tsx similarity index 96% rename from components/pages/subCategory/body.tsx rename to pages/subCategory/body.tsx index afecde6..9a768ea 100644 --- a/components/pages/subCategory/body.tsx +++ b/pages/subCategory/body.tsx @@ -3,7 +3,7 @@ import httpClient from "@/request/api"; import { endPoints } from "@/request/links"; import { useQuery } from "@tanstack/react-query"; -import { useCategory } from "@/store/useCategory"; +import { useCategory } from "@/zustand/useCategory"; import Card from "./card"; import { useTranslations } from "next-intl"; diff --git a/components/pages/subCategory/card.tsx b/pages/subCategory/card.tsx similarity index 96% rename from components/pages/subCategory/card.tsx rename to pages/subCategory/card.tsx index f65ed4a..1f6721e 100644 --- a/components/pages/subCategory/card.tsx +++ b/pages/subCategory/card.tsx @@ -1,4 +1,4 @@ -import { useSubCategory } from "@/store/useSubCategory"; +import { useSubCategory } from "@/zustand/useSubCategory"; import { useLocale } from "next-intl"; import Image from "next/image"; import Link from "next/link"; diff --git a/components/pages/subCategory/index.ts b/pages/subCategory/index.ts similarity index 100% rename from components/pages/subCategory/index.ts rename to pages/subCategory/index.ts diff --git a/request/links.ts b/request/links.ts index c72085d..80ab424 100644 --- a/request/links.ts +++ b/request/links.ts @@ -39,14 +39,11 @@ export const endPoints = { navbar: "navigationitem/?page_size=500", sertificate: "document/?type=certificate", normative: "document/?type=normative", - guides:"guide/", + guides: "guide/", filter: { - size: "size/", - sizePageItems: "size/?page_size=500", - sizeCategoryId: (id: number) => `size/?category=${id}&page_size=500`, - catalog: "catalog/", - catalogPageItems: "catalog/?page_size=500", - catalogCategoryId: (id: number) => `catalog/?category=${id}&page_size=500`, + catalog: "catalogsection/?page_size=500", + child: (parenId: number) => + `catalogsection/?page_size=500&parent=${parenId}`, }, post: { sendNumber: "callBack/", diff --git a/store/useCategory.ts b/zustand/useCategory.ts similarity index 100% rename from store/useCategory.ts rename to zustand/useCategory.ts diff --git a/store/useProceModalStore.ts b/zustand/useProceModalStore.ts similarity index 100% rename from store/useProceModalStore.ts rename to zustand/useProceModalStore.ts diff --git a/store/useProduct.ts b/zustand/useProduct.ts similarity index 100% rename from store/useProduct.ts rename to zustand/useProduct.ts diff --git a/store/useService.ts b/zustand/useService.ts similarity index 100% rename from store/useService.ts rename to zustand/useService.ts diff --git a/store/useSubCategory.ts b/zustand/useSubCategory.ts similarity index 100% rename from store/useSubCategory.ts rename to zustand/useSubCategory.ts