From 92c2a229d9c9b510d71b928978872a8b107e9d5a Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Tue, 11 Apr 2023 09:47:25 +0700
Subject: Documentation and refactor code

---
 src/lib/cart/components/Cart.jsx | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

(limited to 'src/lib/cart/components/Cart.jsx')

diff --git a/src/lib/cart/components/Cart.jsx b/src/lib/cart/components/Cart.jsx
index e2173268..d18b1a28 100644
--- a/src/lib/cart/components/Cart.jsx
+++ b/src/lib/cart/components/Cart.jsx
@@ -28,7 +28,7 @@ const Cart = () => {
 
   const [deleteConfirmation, setDeleteConfirmation] = useState(null)
 
-  const [productRecomendation, setProductRecomendation] = useState(null);
+  const [productRecomendation, setProductRecomendation] = useState(null)
 
   useEffect(() => {
     if (cart.data && !products) {
@@ -74,13 +74,14 @@ const Cart = () => {
   useEffect(() => {
     const LoadProductSImilar = async () => {
       const randProductIndex = Math.floor(Math.random() * products.length)
-      const productLoad = await productSearchApi({ query: `q=${products?.[randProductIndex].parent.name}&limit=10` })
-
-      setProductRecomendation(productLoad);
+      const productLoad = await productSearchApi({
+        query: `q=${products?.[randProductIndex].parent.name}&limit=10`
+      })
 
+      setProductRecomendation(productLoad)
     }
-    if(products?.length > 0) LoadProductSImilar()
-  },[products])
+    if (products?.length > 0) LoadProductSImilar()
+  }, [products])
 
   const updateQuantity = (value, productId, operation = '') => {
     let productIndex = products.findIndex((product) => product.id == productId)
@@ -424,7 +425,13 @@ const Cart = () => {
                 height={60}
               />
               <div className='text-gray_r-12/90'>
-                Tanya stock untuk pembelian anda sebelum melanjutkan pembayaran!<span> <a href='https://wa.me/628128080622' className='text-danger-500'>Hubungi Kami</a></span>
+                Tanya stock untuk pembelian anda sebelum melanjutkan pembayaran!
+                <span>
+                  {' '}
+                  <a href='https://wa.me/628128080622' className='text-danger-500'>
+                    Hubungi Kami
+                  </a>
+                </span>
               </div>
             </div>
           </div>
@@ -465,7 +472,7 @@ const Cart = () => {
           </div>
 
           <div className='col-span-9 pt-2 pb-6 mt-6'>
-          <h1 className='text-title-sm font-semibold mb-6'>Product Yang Mungkin Kamu Suka</h1>
+            <h1 className='text-title-sm font-semibold mb-6'>Product Yang Mungkin Kamu Suka</h1>
             <div className='grid grid-cols-5 gap-x-3 gap-y-6'>
               {productRecomendation &&
                 productRecomendation.response.products.map((product) => (
@@ -474,7 +481,6 @@ const Cart = () => {
             </div>
           </div>
         </div>
-       
       </DesktopView>
     </>
   )
-- 
cgit v1.2.3

