From 974d31c096238255fee3ddb8b4fb0e146499d9ef Mon Sep 17 00:00:00 2001 From: "nabijonovdavronbek619@gmail.com" Date: Tue, 17 Feb 2026 16:55:41 +0500 Subject: [PATCH] share button complated --- .../catalog_page/products/[slug]/page.tsx | 9 ++++--- components/pages/products/slug/rightSide.tsx | 27 +++++++++++++------ components/pages/services/ourService.tsx | 4 +-- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/app/[locale]/catalog_page/products/[slug]/page.tsx b/app/[locale]/catalog_page/products/[slug]/page.tsx index 7ccee8a..cf032e0 100644 --- a/app/[locale]/catalog_page/products/[slug]/page.tsx +++ b/app/[locale]/catalog_page/products/[slug]/page.tsx @@ -9,6 +9,7 @@ import { LoadingSkeleton } from "@/components/pages/products/slug/loading"; import { EmptyState } from "@/components/pages/products/slug/empty"; import { useEffect } from "react"; import { Breadcrumb } from "@/components/breadCrumb"; +import { useSearchParams } from "next/navigation"; // Types interface ProductImage { @@ -32,13 +33,15 @@ 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({ queryKey: ["product", productZustand.id], - queryFn: () => httpClient(endPoints.product.detail(productZustand.id)), + queryFn: () => httpClient(endPoints.product.detail(id)), select: (data) => data?.data?.data as ProductDetail, - enabled: !!productZustand.id, }); useEffect(() => console.log("product detail: ", product)); diff --git a/components/pages/products/slug/rightSide.tsx b/components/pages/products/slug/rightSide.tsx index 9bb5c6c..32c4b27 100644 --- a/components/pages/products/slug/rightSide.tsx +++ b/components/pages/products/slug/rightSide.tsx @@ -1,7 +1,7 @@ "use client"; import { usePriceModalStore } from "@/store/useProceModalStore"; -import { Instagram, Send, Share2 } from "lucide-react"; +import { Check, Instagram, Send, Share2 } from "lucide-react"; import { useTranslations } from "next-intl"; import { useParams } from "next/navigation"; import { useState } from "react"; @@ -32,7 +32,7 @@ export function RightSide({ const [copied, setCopied] = useState(false); const handleShare = async () => { - const productUrl = `${window.location.origin}/${locale}/products/special_product?productId=${id}`; + const productUrl = `${window.location.origin}/${locale}/catalog_page/products/special_product?productId=${id}`; try { // Modern Web Share API dan foydalanish (mobil qurilmalar uchun) @@ -85,7 +85,7 @@ export function RightSide({ return (
{/* Title */} -

+

{title}

@@ -112,7 +112,7 @@ export function RightSide({
{/* Price Section */} -
+
{/* Price */}

{t("products.price")}:

@@ -131,12 +131,23 @@ export function RightSide({ {/* Social Share */}
- {/* diff --git a/components/pages/services/ourService.tsx b/components/pages/services/ourService.tsx index 24637cd..7fe9d37 100644 --- a/components/pages/services/ourService.tsx +++ b/components/pages/services/ourService.tsx @@ -186,7 +186,7 @@ export function OurService() {

{data[3].subtitle}

- @@ -203,7 +203,7 @@ export function OurService() {

{t("home.services.viewMoreServices")}