From cf26b778fc25239a3c6dbb8ab1e4009fe51176f7 Mon Sep 17 00:00:00 2001 From: "nabijonovdavronbek619@gmail.com" Date: Wed, 10 Dec 2025 11:43:10 +0500 Subject: [PATCH] pproducts --- app/page.tsx | 1 - app/product/page.tsx | 9 +++++ components/Footer.tsx | 2 +- components/ProductCard.tsx | 8 ++-- components/ProductModal.tsx | 56 ++++++++-------------------- components/ProductViewer.tsx | 2 +- components/ProductsGrid.tsx | 14 ++++++- components/productsPage/products.tsx | 16 ++++++++ lib/allProducts.ts | 10 +++++ lib/products.ts | 6 +-- lib/translations.ts | 4 ++ 11 files changed, 76 insertions(+), 52 deletions(-) create mode 100644 app/product/page.tsx create mode 100644 components/productsPage/products.tsx create mode 100644 lib/allProducts.ts diff --git a/app/page.tsx b/app/page.tsx index a0c9966..e08ae35 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -16,7 +16,6 @@ export default function Home() {
- feature.labelKey diff --git a/app/product/page.tsx b/app/product/page.tsx new file mode 100644 index 0000000..7072957 --- /dev/null +++ b/app/product/page.tsx @@ -0,0 +1,9 @@ +import React from 'react' + +export default function Page() { + return ( +
+ +
+ ) +} diff --git a/components/Footer.tsx b/components/Footer.tsx index 44d75a0..a736328 100644 --- a/components/Footer.tsx +++ b/components/Footer.tsx @@ -85,7 +85,7 @@ export function Footer() {

{t.footer.common.contact}

  • {t.footer.common.email}: info@firma.uz
  • -
  • {t.footer.common.phone}: +998 (99) 123-45-67
  • +
  • {t.footer.common.phone}: +998 (99) 869-74-70
  • {t.footer.common.telegram}: @firma_support
diff --git a/components/ProductCard.tsx b/components/ProductCard.tsx index 5f986c5..75d344f 100644 --- a/components/ProductCard.tsx +++ b/components/ProductCard.tsx @@ -24,7 +24,7 @@ export function ProductCard({ product, onViewDetails }: ProductCardProps) { src={product.images[0]} alt={product.nameKey} fill - className="object-cover group-hover:scale-110 transition-transform duration-300" + className="object-contain group-hover:scale-110 transition-transform duration-300" />
@@ -39,14 +39,14 @@ export function ProductCard({ product, onViewDetails }: ProductCardProps) {

{/* Specs Preview */} -
+ {/*
{product.specs.slice(0, 2).map((spec, idx) => (
{spec.key}: {spec.value}
))} -
+
*/} {/* CTA Button */} onViewDetails(product.slug)} className="w-full flex items-center justify-center gap-2 px-4 py-2 bg-primary/80 text-white rounded-lg font-medium hover:bg-primary transition-colors" > - Batafsil + {t.details} diff --git a/components/ProductModal.tsx b/components/ProductModal.tsx index 44b27c0..c03e9d7 100644 --- a/components/ProductModal.tsx +++ b/components/ProductModal.tsx @@ -2,10 +2,11 @@ import { motion, AnimatePresence } from "framer-motion"; import { X, Download } from "lucide-react"; -import { useTranslations } from "next-intl"; import Image from "next/image"; import { ProductViewer } from "./ProductViewer"; import type { Product } from "@/lib/products"; +import { useLanguage } from "@/context/language-context"; +import Link from "next/link"; interface ProductModalProps { product: Product; @@ -13,7 +14,7 @@ interface ProductModalProps { } export function ProductModal({ product, onClose }: ProductModalProps) { - const t = useTranslations(); + const { t } = useLanguage(); return ( @@ -34,7 +35,7 @@ export function ProductModal({ product, onClose }: ProductModalProps) { {/* Header */}

- {t(product.nameKey)} + {product.nameKey}

- - {/* Image Thumbnails */} - {product.images.length > 1 && ( -
- {product.images.map((img, idx) => ( - - {`${t(product.nameKey)} - - ))} -
- )}
{/* Details */}

{product.longDescriptionKey - ? t(product.longDescriptionKey) - : t(product.shortDescriptionKey)} + ? product.longDescriptionKey + : product.shortDescriptionKey}

{/* Specifications */} @@ -108,21 +89,16 @@ export function ProductModal({ product, onClose }: ProductModalProps) { {/* CTA Buttons */}
- - {t("contact.send")} - - - - Download Datasheet - + + + {t.contact.send} + +
diff --git a/components/ProductViewer.tsx b/components/ProductViewer.tsx index 63a0d2f..2a383b6 100644 --- a/components/ProductViewer.tsx +++ b/components/ProductViewer.tsx @@ -57,7 +57,7 @@ export function ProductViewer({ src={primaryImage} alt="Product" fill - className="object-cover" + className="object-contain" /> ) : ( diff --git a/components/ProductsGrid.tsx b/components/ProductsGrid.tsx index 6c045fb..fe5b1b9 100644 --- a/components/ProductsGrid.tsx +++ b/components/ProductsGrid.tsx @@ -8,11 +8,13 @@ import type { Product } from "@/lib/products"; import { ProductModal } from "./ProductModal"; import Image from "next/image"; import { useLanguage } from "@/context/language-context"; +import Link from "next/link"; +import { ChevronsRight } from "lucide-react"; // hello everyone export function ProductsGrid() { - const {t} = useLanguage(); + const { t } = useLanguage(); const products = getAllProducts(); const [selectedProduct, setSelectedProduct] = useState(null); @@ -47,7 +49,7 @@ export function ProductsGrid() { className="object-cover" /> -
+
{/* Header */}
+
+ + {t.more} + +
{/* Product Modal */} diff --git a/components/productsPage/products.tsx b/components/productsPage/products.tsx new file mode 100644 index 0000000..b5bfff6 --- /dev/null +++ b/components/productsPage/products.tsx @@ -0,0 +1,16 @@ +import { allProduct } from "@/lib/allProducts"; +import React, { useEffect, useState } from "react"; + +export default function Products() { + const [allProducts, setAllProducts] = useState(null); + useEffect(() => { + const all = allProduct(); + all && Array.isArray(all) ? setAllProducts(all) : setAllProducts([]); + setAllProducts; + }, [allProducts]); + return ( +
+
+
+ ); +} diff --git a/lib/allProducts.ts b/lib/allProducts.ts new file mode 100644 index 0000000..efaa6f0 --- /dev/null +++ b/lib/allProducts.ts @@ -0,0 +1,10 @@ +import axios from "axios"; + +export const allProduct = async () => { + try{ + const res = await axios.get('') + }catch(err){ + console.log("all product error: ",err); + + } +}; diff --git a/lib/products.ts b/lib/products.ts index 7a529d2..0ccccee 100644 --- a/lib/products.ts +++ b/lib/products.ts @@ -16,7 +16,7 @@ export const products: Product[] = [ nameKey: "Schotchik Nasos", slug: "Yuqori sifatli schotchik nasos, benzin, dizel va kerosinni tashishda ishlatiladi.", shortDescriptionKey: "Xavfsiz neft mahsulotlarini tashish uchun", - images: ["/images/pump-1.jpg", "/images/pump-1-alt.jpg"], + images: ["/product/product.jpg", "/images/pump-1-alt.jpg"], specs: [ { key: "Flow Rate", value: "100 L/min" }, { key: "Pressure", value: "10 bar" }, @@ -29,7 +29,7 @@ export const products: Product[] = [ nameKey: "Agregat Nasos", slug: "Katta volumli neft mahsulotlarini tashishda o'rnatilgan.", shortDescriptionKey: "Kuchli va ishonchli aggregat nasos", - images: ["/images/pump-2.jpg", "/images/pump-2-alt.jpg"], + images: ["/product/product1.jpg", "/images/pump-2-alt.jpg"], specs: [ { key: "Flow Rate", value: "250 L/min" }, { key: "Pressure", value: "15 bar" }, @@ -42,7 +42,7 @@ export const products: Product[] = [ nameKey: "СЦЛ 20/24", slug:"Chuqurligi 20-24 metrda ishlaydigan professional nasos.", shortDescriptionKey: "Professional kalibrli nasos", - images: ["/images/pump-3.jpg", "/images/pump-3-alt.jpg"], + images: ["/product/product2.jpg", "/images/pump-3-alt.jpg"], specs: [ { key: "Depth Rating", value: "20-24 m" }, { key: "Flow Rate", value: "150 L/min" }, diff --git a/lib/translations.ts b/lib/translations.ts index 2a57504..f5f16a0 100644 --- a/lib/translations.ts +++ b/lib/translations.ts @@ -90,6 +90,8 @@ export const translations = { description: "Chuqurligi 20-24 metrda ishlaydigan professional nasos.", }, }, + more: "Ko'proq ko'rish", + details: "Batafsil", }, ru: { @@ -187,5 +189,7 @@ export const translations = { "Профессиональный насос, работающий на глубине 20-24 метра.", }, }, + more: "Смотреть больше", + details: "Подробнее", }, };