From eab36a77ee894d64c1ffff04b50a143d7f74a5ee Mon Sep 17 00:00:00 2001
From: Mqdd <ahmadmiqdad27@gmail.com>
Date: Thu, 4 Dec 2025 14:05:05 +0700
Subject: <Miqdad> fix no image product variant

---
 .../product/components/Product/ProductDesktopVariant.jsx  | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

(limited to 'src/lib/product/components/Product/ProductDesktopVariant.jsx')

diff --git a/src/lib/product/components/Product/ProductDesktopVariant.jsx b/src/lib/product/components/Product/ProductDesktopVariant.jsx
index a6871fa2..1584dc92 100644
--- a/src/lib/product/components/Product/ProductDesktopVariant.jsx
+++ b/src/lib/product/components/Product/ProductDesktopVariant.jsx
@@ -314,6 +314,11 @@ const ProductDesktopVariant = ({
     fetchData();
   }, [product]);
 
+  const getImageVariant = (img) => {
+    if (!img || img.trim() === '') return '/images/noimage.jpeg';
+    return `${img}?variant=True`;
+  };
+
   return (
     <DesktopView>
       <div className='relative'>
@@ -332,8 +337,8 @@ const ProductDesktopVariant = ({
           <div className='w-full flex flex-wrap'>
             <div className='w-5/12'>
               <Image
-                src={product.image + '?variant=True'}
-                alt={product.name}
+                src={getImageVariant(product?.image)}
+                alt={product?.name}
                 className='w-full h-[350px]'
               />
             </div>
@@ -345,9 +350,9 @@ const ProductDesktopVariant = ({
                     size={18}
                     className='text-red-600 shrink-0 mx-2'
                   />
-                    <div className='text-red-600 font-normal text-h-lg p-2'>
-                      Maaf untuk saat ini Produk yang anda cari tidak tersedia
-                    </div>
+                  <div className='text-red-600 font-normal text-h-lg p-2'>
+                    Maaf untuk saat ini Produk yang anda cari tidak tersedia
+                  </div>
                 </div>
               )}
               <h1 className='text-title-md leading-10 font-medium'>
-- 
cgit v1.2.3

