diff --git a/app/[locale]/about/notePP/page.tsx b/app/[locale]/about/notePP/page.tsx index 5a872ab..fe4a2cf 100644 --- a/app/[locale]/about/notePP/page.tsx +++ b/app/[locale]/about/notePP/page.tsx @@ -1,34 +1,8 @@ -"use client"; - -import Image from "next/image"; -import { motion } from "framer-motion"; import { useTranslations } from "next-intl"; import { Guides } from "@/components/pages/about/aboutDetail/guides"; -const ease = [0.22, 1, 0.36, 1] as [number, number, number, number]; - export default function NotePPPage() { const t = useTranslations(); - - const guides = [ - { - image: "/images/about/pp.avif", - title: t("about.notePPPage.hero.title"), - description: t("about.notePPPage.hero.description"), - eyebrow: t("about.notePPPage.hero.eyebrow"), - titleLine1: t("about.notePPPage.hero.titleLine1"), - titleLine2: t("about.notePPPage.hero.titleLine2"), - }, - { - image: "/images/about/pp.avif", - title: t("about.noteTrailerPage.hero.title"), - description: t("about.noteTrailerPage.hero.description"), - eyebrow: t("about.noteTrailerPage.hero.eyebrow"), - titleLine1: t("about.noteTrailerPage.hero.titleLine1"), - titleLine2: t("about.noteTrailerPage.hero.titleLine2"), - }, - ]; - return (
diff --git a/app/[locale]/about/sertificate/page.tsx b/app/[locale]/about/sertificate/page.tsx index b4c92ae..8f757bf 100644 --- a/app/[locale]/about/sertificate/page.tsx +++ b/app/[locale]/about/sertificate/page.tsx @@ -1,12 +1,30 @@ -"use client" +"use client"; import { CertCard } from "@/components/pages/about/aboutDetail/sertificateCard"; +import PaginationLite from "@/components/paginationUI"; import { certs } from "@/lib/demoData"; +import httpClient from "@/request/api"; +import { endPoints } from "@/request/links"; +import { useQuery } from "@tanstack/react-query"; import { motion } from "framer-motion"; import { Award } from "lucide-react"; import { useTranslations } from "next-intl"; +import { useState } from "react"; export default function SertificatePage() { const t = useTranslations(); + const [currentPage, setCurrentPage] = useState(1); + const { data, isLoading } = useQuery({ + queryKey: ["sertificate"], + queryFn: () => httpClient(endPoints.sertificate), + select: (res) => ({ + results: res.data?.data?.results, + current_page: res.data?.data?.current_page, + total_pages: res.data?.data?.total_pages, + }), + }); + + console.log(data); + const generallydata = data?.results ?? certs; return (
@@ -70,10 +88,19 @@ export default function SertificatePage() { {/* ── Cards ── */}
- {certs.map((c, i) => ( + {generallydata.map((c:any, i:number) => ( ))}
+ + {/*pagination*/} + {data?.total_pages > 1 && ( + + )}
); } diff --git a/components/layout/navbar.tsx b/components/layout/navbar.tsx index fd08436..1dcf67f 100644 --- a/components/layout/navbar.tsx +++ b/components/layout/navbar.tsx @@ -85,7 +85,7 @@ export function Navbar() {
{navbarItems?.results ? ( navbarItems.results.map((item: NavbarItem) => ( - + {navbarItems?.results ? ( navbarItems.results.map((item: NavbarItem) => ( - + ({ export default function NormativBazaPage() { const t = useTranslations(); - const cards = [ - { - icon: BookOpen, - title: t("about.normativBaza.cards.card1.title"), - text: t("about.normativBaza.cards.card1.text"), - number: "01", - }, - { - icon: Flame, - title: t("about.normativBaza.cards.card2.title"), - text: t("about.normativBaza.cards.card2.text"), - number: "02", - }, - { - icon: ShieldCheck, - title: t("about.normativBaza.cards.card3.title"), - text: t("about.normativBaza.cards.card3.text"), - number: "03", - }, - ]; - return (
{/* ── Hero ── */} diff --git a/components/pages/about/aboutDetail/guides.tsx b/components/pages/about/aboutDetail/guides.tsx index 085a646..50a6249 100644 --- a/components/pages/about/aboutDetail/guides.tsx +++ b/components/pages/about/aboutDetail/guides.tsx @@ -1,40 +1,68 @@ +"use client"; import { useTranslations } from "next-intl"; import DownloadCard from "./card"; +import { useState } from "react"; +import { useQuery } from "@tanstack/react-query"; +import httpClient from "@/request/api"; +import { endPoints } from "@/request/links"; +import PaginationLite from "@/components/paginationUI"; export function Guides() { const t = useTranslations(); + const [currentPage, setCurrentPage] = useState(1); const guides = [ { - fileUrl: "/varnix.pdf", - fileName: t("about.notePPPage.varnix"), - fileType: "PDF", - fileSize: "368.51 KB", + file: "/varnix.pdf", + name: t("about.notePPPage.varnix"), + file_type: "PDF", + file_size: "368.51 KB", }, { - fileUrl: "/ppFlanes.pdf", - fileName: t("about.notePPPage.ppFlanes"), - fileType: "PDF", - fileSize: "368.51 KB", + file: "/ppFlanes.pdf", + name: t("about.notePPPage.ppFlanes"), + file_type: "PDF", + file_size: "368.51 KB", }, { - fileUrl: "/ppFiting.pdf", - fileName: t("about.notePPPage.ppFiting"), - fileType: "PDF", - fileSize: "368.51 KB", + file: "/ppFiting.pdf", + name: t("about.notePPPage.ppFiting"), + file_type: "PDF", + file_size: "368.51 KB", }, ]; + const { data } = useQuery({ + queryKey: ["guides"], + queryFn: () => httpClient(endPoints.guides), + select: (res) => ({ + results: res.data?.data?.results, + current_page: res.data?.data?.current_page, + total_pages: res.data?.data?.total_pages, + }), + }); + + const guidedata = data?.results ?? guides; + return ( -
- {guides.map((guide, index) => ( - +
+ {guidedata.map((guide: any, index: number) => ( + + ))} +
+ {data?.total_pages > 1 && ( + - ))} + )}
); } diff --git a/components/pages/about/aboutDetail/loading.tsx b/components/pages/about/aboutDetail/loading.tsx new file mode 100644 index 0000000..390c2a7 --- /dev/null +++ b/components/pages/about/aboutDetail/loading.tsx @@ -0,0 +1,44 @@ +export function CertCardSkeleton({ count = 6 }: { count?: number }) { + return ( + <> +
+ {/* Badge row */} +
+
+
+ {/* Award badge */} +
+
+
+
+ {/* Category pill */} +
+
+ + {/* Title lines */} +
+
+
+
+
+
+ + {/* Divider */} +
+ + {/* Document list */} +
    + {Array.from({ length: 3 }).map((_, di) => ( +
  • + +
    +
  • + ))} +
+
+ + ); +} diff --git a/components/pages/about/aboutDetail/normativeCard.tsx b/components/pages/about/aboutDetail/normativeCard.tsx index 9409b62..7b74472 100644 --- a/components/pages/about/aboutDetail/normativeCard.tsx +++ b/components/pages/about/aboutDetail/normativeCard.tsx @@ -4,62 +4,94 @@ import { motion } from "framer-motion"; import { useTranslations } from "next-intl"; import { Award } from "lucide-react"; import { normativeData } from "@/lib/demoData"; +import httpClient from "@/request/api"; +import { endPoints } from "@/request/links"; +import { useQuery } from "@tanstack/react-query"; +import { useState } from "react"; +import PaginationLite from "@/components/paginationUI"; +import { CertCardSkeleton } from "./loading"; export function NormativeCard() { const t = useTranslations(); + const [currentPage, setCurrentPage] = useState(1); + + const { data, isLoading } = useQuery({ + queryKey: ["normativeData"], + queryFn: () => httpClient(endPoints.normative), + select: (res) => ({ + results: res.data?.data?.results, + current_page: res.data?.data?.current_page, + total_pages: res.data?.data?.total_pages, + }), + }); + + console.log(data); + + const generallyData = data?.results ?? normativeData; + + if (isLoading) return ; return ( -
- {normativeData.map((c, i) => ( - - {/* Meta + actions */} -
-
- {/* Badge row */} -
-
- - - {t("about.certificatePage.card.badge")} +
+
+ {generallyData.map((c: any, i: number) => ( + + {/* Meta + actions */} +
+
+ {/* Badge row */} +
+
+ + + {t("about.certificatePage.card.badge")} + +
+ + {c.artikul}
- - {c.category} - + + {/* Title */} +

+ {t(c.title)} +

- - {/* Title */} -

- {t(c.titleKey)} -

-
- {/* Divider */} -
+ {/* Divider */} +
- {/* Documents list */} -
-
    - {c.documents.map((doc, di) => ( -
  • - -

    - {t(doc)} -

    -
  • - ))} -
-
- - ))} + {/* Documents list */} +
+
    + {c.features.map((doc: any, di: number) => ( +
  • + +

    + {t(doc?.name)} +

    +
  • + ))} +
+
+ + ))} +
+ {data?.total_pages > 1 && ( + + )}
); -} \ No newline at end of file +} diff --git a/components/pages/about/aboutDetail/sertificateCard.tsx b/components/pages/about/aboutDetail/sertificateCard.tsx index ff8babe..0f7d506 100644 --- a/components/pages/about/aboutDetail/sertificateCard.tsx +++ b/components/pages/about/aboutDetail/sertificateCard.tsx @@ -28,7 +28,7 @@ export function CertCard({ c, i }: { c: (typeof certs)[0]; i: number }) {
- {c.category} + {c.artikul}
@@ -45,12 +45,18 @@ export function CertCard({ c, i }: { c: (typeof certs)[0]; i: number }) { {/* Collapsible document list */}
    - {c.documents.map((doc, di) => ( -
  • - -

    {doc}

    -
  • - ))} + {c.features.length > 0 && + c.features.map((doc: any, di: number) => { + const { name } = doc; + return ( +
  • + +

    + {name || ""} +

    +
  • + ); + })}
diff --git a/lib/demoData.ts b/lib/demoData.ts index e3d989a..3afdb32 100644 --- a/lib/demoData.ts +++ b/lib/demoData.ts @@ -1,11 +1,13 @@ +import { title } from "process"; + export const certs = [ { id: 1, src: "/images/about/sertificate.webp", title: "Пожаростойкие армированные трубы SLT BLOCKFIRE PP-R-GF", year: "2024", - category: "PP-R-GF", - documents: [ + artikul: "PP-R-GF", + features: [ "СТО 22.21.29-015-17207509-2022 (версия 2) — согласован МЧС России в качестве нормативного документа по пожарной безопасности.", "СТО 22.21.29-021-17207509-2024 «Автоматическая противопожарная защита многоярусных стеллажных конструкций» — согласован МЧС России №ГУ-исх-66586 от 05.07.2024.", "Протоколы испытаний по ГОСТ Р 58832 ИЛ НИЦ ПТ и СП ФГБУ ВНИИПО МЧС России № 2249/2.1-2022 от 03.03.2022, №2683/2.1-2023 от 06.10.2023.", @@ -17,8 +19,8 @@ export const certs = [ src: "/images/about/sertificate.webp", title: "Пожаростойкие однослойные трубы SLT BLOCKFIRE PP-R", year: "2023", - category: "PP-R", - documents: [ + artikul: "PP-R", + features: [ "СТО 22.21.29-015-17207509-2022 (версия 2) — согласован МЧС России в качестве нормативного документа по пожарной безопасности.", "СТО 22.21.29-021-17207509-2024 «Автоматическая противопожарная защита многоярусных стеллажных конструкций» — согласован МЧС России №ГУ-исх-66586 от 05.07.2024.", "Протоколы испытаний ИЛ НИЦ ПТ и СП ФГБУ ВНИИПО МЧС России № 2249/2.1-2022 от 03.03.2022, №2683/2.1-2023 от 06.10.2023.", @@ -30,8 +32,8 @@ export const certs = [ src: "/images/about/sertificate.webp", title: "Пожаростойкие фитинги SLT BLOCKFIRE PP-R", year: "2023", - category: "Фитинги", - documents: [ + artikul: "Фитинги", + features: [ "СТО 22.21.29-015-17207509-2022 (версия 2) — согласован МЧС России в качестве нормативного документа по пожарной безопасности.", "СТО 22.21.29-021-17207509-2024 «Автоматическая противопожарная защита многоярусных стеллажных конструкций» — согласован МЧС России №ГУ-исх-66586 от 05.07.2024.", "Протоколы испытаний по ГОСТ Р 58832 ИЛ НИЦ ПТ и СП ФГБУ ВНИИПО МЧС России № 2249/2.1-2022 от 03.03.2022, №2683/2.1-2023 от 06.10.2023.", @@ -45,12 +47,12 @@ export const DATA = [ name: "P-0834405", title: "Elektr yong'in detektori-Ypres ver.3", status: "full", - description: `Xavfsizlik va yong'in qo'l detektori barcha turdagi qabul qilish va nazorat qilish moslamalari bilan ishlash uchun mo'ljallangan. - Detektor GOST R 53325-2012 bo'yicha a sinfiga mos keladi va himoya qopqog'ini ochib, qo'zg'aysan elementini - ishning markazidagi tugmachani - bosgandan so'ng signal signalini hosil qiladi.Detektor korpusining kichik qalinligi uni shikastlanishdan himoya qiladi, tashqi ko'rinishini - yaxshilaydi va faqat o'rnatish uchun qo'shimcha variantni ishlatishga imkon beradi. Elektr detektori-IPR ver.3 faqat HP signal kabellarida ishlashni ta'minlaydi. - Detektorning navbatchilik rejimi qizil rangdagi ko'rinishlar bilan ko'rsatiladi, "yong'in" rejimi - qizil indikatorni doimiy ravishda yoqish orqali. - Tugmani bosgandan va mahkamlagandan so'ng uni dastlabki holatiga qulay tarzda qaytarish( asbob bilan, maxsus kalitsiz); etkazib berish to'plamida shaffof himoya + description: `Xavfsizlik va yong'in qo'l detektori barcha turdagi qabul qilish va nazorat qilish moslamalari bilan ishlash uchun mo'ljallangan. + Detektor GOST R 53325-2012 bo'yicha a sinfiga mos keladi va himoya qopqog'ini ochib, qo'zg'aysan elementini - ishning markazidagi tugmachani + bosgandan so'ng signal signalini hosil qiladi.Detektor korpusining kichik qalinligi uni shikastlanishdan himoya qiladi, tashqi ko'rinishini + yaxshilaydi va faqat o'rnatish uchun qo'shimcha variantni ishlatishga imkon beradi. Elektr detektori-IPR ver.3 faqat HP signal kabellarida ishlashni ta'minlaydi. + Detektorning navbatchilik rejimi qizil rangdagi ko'rinishlar bilan ko'rsatiladi, "yong'in" rejimi - qizil indikatorni doimiy ravishda yoqish orqali. + Tugmani bosgandan va mahkamlagandan so'ng uni dastlabki holatiga qulay tarzda qaytarish( asbob bilan, maxsus kalitsiz); etkazib berish to'plamida shaffof himoya qopqog'ining mavjudligi; tizimga texnik xizmat ko'rsatishni soddalashtirish uchun muhrlash qobiliyati.`, features: [ "Signal pallasida besleme zo'riqishida-9 + 28V;", @@ -283,9 +285,9 @@ export const result = [ export const normativeData = [ { - titleKey: "certs.slt_blockfire.title", - category: "SLT BLOCKFIRE", - documents: [ + title: "certs.slt_blockfire.title", + artikul: "SLT BLOCKFIRE", + features: [ "certs.slt_blockfire.doc1", "certs.slt_blockfire.doc2", "certs.slt_blockfire.doc3", @@ -293,14 +295,12 @@ export const normativeData = [ "certs.slt_blockfire.doc5", "certs.slt_blockfire.doc6", "certs.slt_blockfire.doc7", - "certs.slt_blockfire.doc8" - ] + "certs.slt_blockfire.doc8", + ], }, { - titleKey: "certs.slt_aqua.title", - category: "SLT AQUA", - documents: [ - "certs.slt_aqua.doc1" - ] - } + title: "certs.slt_aqua.title", + artikul: "SLT AQUA", + features: ["certs.slt_aqua.doc1"], + }, ]; diff --git a/request/links.ts b/request/links.ts index e4b30f2..c72085d 100644 --- a/request/links.ts +++ b/request/links.ts @@ -36,7 +36,10 @@ export const endPoints = { contact: "contact/", statistics: "statistics/", banner: "banner/?page_size=500", - navbar:"navigationitem/?page_size=500", + navbar: "navigationitem/?page_size=500", + sertificate: "document/?type=certificate", + normative: "document/?type=normative", + guides:"guide/", filter: { size: "size/", sizePageItems: "size/?page_size=500",