From eb4ae7be05ed97bd02b7f3e9cc56393f435188e2 Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Wed, 14 Jun 2023 13:22:20 +0700
Subject: layout promotion program di detail product dan layout modal popup

---
 .../product/components/Product/ProductDesktop.jsx  | 24 +++++++++-------------
 1 file changed, 10 insertions(+), 14 deletions(-)

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

diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx
index c3addbb9..f1a001a6 100644
--- a/src/lib/product/components/Product/ProductDesktop.jsx
+++ b/src/lib/product/components/Product/ProductDesktop.jsx
@@ -15,9 +15,12 @@ import ProductCard from '../ProductCard'
 import productSimilarApi from '../../api/productSimilarApi'
 import whatsappUrl from '@/core/utils/whatsappUrl'
 import PromotionType from '@/lib/promotinProgram/components/PromotionType'
+import useAuth from '@/core/hooks/useAuth'
 
 const ProductDesktop = ({ product, wishlist, toggleWishlist }) => {
   const router = useRouter()
+  const auth = useAuth()
+  const { slug } = router.query
 
   const [lowestPrice, setLowestPrice] = useState(null)
 
@@ -55,6 +58,10 @@ const ProductDesktop = ({ product, wishlist, toggleWishlist }) => {
   }
 
   const handleAddToCart = (variantId) => {
+    if(!auth) {
+      router.push(`/login?next=/shop/product/${slug}`)
+      return
+    }
     const quantity = variantQuantityRefs.current[variantId].value
     if (!validQuantity(quantity)) return
     updateItemCart({
@@ -159,8 +166,7 @@ const ProductDesktop = ({ product, wishlist, toggleWishlist }) => {
                   </div>
                 </div>
                 <div className='pt-3'>
-                  <div className='text-h-lg font-semibold'>Promotion Program</div>
-                  <div className='flex mt-3'>
+                  <div className='flex mt-1'>
                     <PromotionType></PromotionType>
                   </div>
                 </div>
@@ -237,7 +243,7 @@ const ProductDesktop = ({ product, wishlist, toggleWishlist }) => {
                 </span>
               )}
             </h3>
-            <div className='mt-5'>
+            {/* <div className='mt-5'>
               <button
                 type='button'
                 onClick={() => setPromotionType(true)}
@@ -246,7 +252,7 @@ const ProductDesktop = ({ product, wishlist, toggleWishlist }) => {
                 <span className='text-left'>%</span>
                 <span className='text-left ml-5'>Makin Hemat Pakai Promo </span>
               </button>
-            </div>
+            </div> */}
             {product.variants.length > 1 ? (
               <button
                 type='button'
@@ -420,16 +426,6 @@ const ProductDesktop = ({ product, wishlist, toggleWishlist }) => {
             </LazyLoad>
           </div>
         </BottomPopup>
-        <BottomPopup
-          className='!w-[32%]'
-          title='Pakai Promo'
-          active={promotionType}
-          close={() => setPromotionType(false)}
-        >
-          <div className='flex mt-4'>
-            <PromotionType></PromotionType>
-          </div>
-        </BottomPopup>
       </div>
     </DesktopView>
   )
-- 
cgit v1.2.3

