From 9661bcf006332508084d4fdf5c0e2041fdfe9162 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Fri, 8 Mar 2024 17:11:36 +0700
Subject: Update empty state on cart page

---
 src-migrate/pages/shop/cart/index.tsx | 10 ++++++++++
 1 file changed, 10 insertions(+)

(limited to 'src-migrate/pages/shop/cart/index.tsx')

diff --git a/src-migrate/pages/shop/cart/index.tsx b/src-migrate/pages/shop/cart/index.tsx
index 9ec58a48..5c047af4 100644
--- a/src-migrate/pages/shop/cart/index.tsx
+++ b/src-migrate/pages/shop/cart/index.tsx
@@ -10,6 +10,7 @@ import { useCartStore } from '~/modules/cart/stores/useCartStore'
 import CartItem from '~/modules/cart/components/Item'
 import CartSummary from '~/modules/cart/components/Summary'
 import clsxm from '~/libs/clsxm'
+import Image from '~/components/ui/image'
 
 const CartPage = () => {
   const auth = getAuth()
@@ -60,6 +61,15 @@ const CartPage = () => {
 
           <div className={style['items']}>
             {cart?.products.map((item) => <CartItem key={item.id} item={item} />)}
+
+            {cart?.products?.length === 0 && (
+              <div className='flex flex-col items-center'>
+                <Image src='/images/empty_cart.svg' alt='Empty Cart' width={450} height={450} />
+                <div className='text-title-sm md:text-title-lg text-center font-semibold'>Keranjangnya masih kosong nih</div>
+                <div className='text-body-2 md:text-body-1 text-center mt-3'>Yuk, tambahin barang-barang yang kamu mau ke keranjang sekarang!<br />Ada banyak potongan belanjanya pakai kode voucher</div>
+                <Link href='/' className='btn-solid-red rounded-full text-body-1 mt-6'>Mulai Belanja</Link>
+              </div>
+            )}
           </div>
         </div>
 
-- 
cgit v1.2.3


From 9a52d9f835e2f30480142c6197fdf14b3fee5ead Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Tue, 12 Mar 2024 09:17:01 +0700
Subject: feedback kerajang di mobile

---
 src-migrate/pages/shop/cart/index.tsx | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 'src-migrate/pages/shop/cart/index.tsx')

diff --git a/src-migrate/pages/shop/cart/index.tsx b/src-migrate/pages/shop/cart/index.tsx
index 9ec58a48..6c37b434 100644
--- a/src-migrate/pages/shop/cart/index.tsx
+++ b/src-migrate/pages/shop/cart/index.tsx
@@ -10,11 +10,15 @@ import { useCartStore } from '~/modules/cart/stores/useCartStore'
 import CartItem from '~/modules/cart/components/Item'
 import CartSummary from '~/modules/cart/components/Summary'
 import clsxm from '~/libs/clsxm'
+import useDevice from '@/core/hooks/useDevice'
+import CartSummaryMobile from '~/modules/cart/components/CartSummaryMobile'
 
 const CartPage = () => {
   const auth = getAuth()
 
   const { loadCart, cart, summary } = useCartStore()
+  
+  const useDivvice = useDevice();
 
   useEffect(() => {
     if (typeof auth === 'object' && !cart) loadCart(auth.id)
@@ -65,7 +69,8 @@ const CartPage = () => {
 
         <div className={style['summary-wrapper']}>
           <div className={style['summary']}>
-            <CartSummary {...summary} isLoaded={!!cart} />
+            {useDivvice.isMobile && <CartSummaryMobile {...summary} isLoaded={!!cart} />}
+            {!useDivvice.isMobile && <CartSummary {...summary} isLoaded={!!cart} />}
 
             <div className={style['summary-buttons']}>
               <Tooltip label={hasSelectedPromo && 'Barang promo tidak dapat dibuat quotation'}>
-- 
cgit v1.2.3


From 5234b7c85ac984bc76d8945934a90b75f4a0d8c0 Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Tue, 12 Mar 2024 15:07:56 +0700
Subject: feeback review

---
 src-migrate/pages/shop/cart/index.tsx | 129 +++++++++++++++++++++-------------
 1 file changed, 80 insertions(+), 49 deletions(-)

(limited to 'src-migrate/pages/shop/cart/index.tsx')

diff --git a/src-migrate/pages/shop/cart/index.tsx b/src-migrate/pages/shop/cart/index.tsx
index d1a6a6ff..4b4de92b 100644
--- a/src-migrate/pages/shop/cart/index.tsx
+++ b/src-migrate/pages/shop/cart/index.tsx
@@ -1,59 +1,57 @@
-import style from './cart.module.css'
+import style from './cart.module.css';
 
-import React, { useEffect, useMemo } from 'react'
-import Link from 'next/link'
-import { Button, Tooltip } from '@chakra-ui/react'
+import React, { useEffect, useMemo } from 'react';
+import Link from 'next/link';
+import { Button, Tooltip } from '@chakra-ui/react';
 
-import { getAuth } from '~/libs/auth'
-import { useCartStore } from '~/modules/cart/stores/useCartStore'
+import { getAuth } from '~/libs/auth';
+import { useCartStore } from '~/modules/cart/stores/useCartStore';
 
-import CartItem from '~/modules/cart/components/Item'
-import CartSummary from '~/modules/cart/components/Summary'
-import clsxm from '~/libs/clsxm'
-import useDevice from '@/core/hooks/useDevice'
-import CartSummaryMobile from '~/modules/cart/components/CartSummaryMobile'
-import Image from '~/components/ui/image'
+import CartItem from '~/modules/cart/components/Item';
+import CartSummary from '~/modules/cart/components/Summary';
+import clsxm from '~/libs/clsxm';
+import useDevice from '@/core/hooks/useDevice';
+import CartSummaryMobile from '~/modules/cart/components/CartSummaryMobile';
+import Image from '~/components/ui/image';
 
 const CartPage = () => {
-  const auth = getAuth()
+  const auth = getAuth();
+
+  const { loadCart, cart, summary } = useCartStore();
 
-  const { loadCart, cart, summary } = useCartStore()
-  
   const useDivvice = useDevice();
 
   useEffect(() => {
-    if (typeof auth === 'object' && !cart) loadCart(auth.id)
-  }, [auth, loadCart, cart])
+    if (typeof auth === 'object' && !cart) loadCart(auth.id);
+  }, [auth, loadCart, cart]);
 
   const hasSelectedPromo = useMemo(() => {
-    if (!cart) return false
+    if (!cart) return false;
     for (const item of cart.products) {
-      if (item.cart_type === 'promotion' && item.selected) return true
+      if (item.cart_type === 'promotion' && item.selected) return true;
     }
-    return false
-  }, [cart])
+    return false;
+  }, [cart]);
 
   const hasSelected = useMemo(() => {
-    if (!cart) return false
+    if (!cart) return false;
     for (const item of cart.products) {
-      if (item.selected) return true
+      if (item.selected) return true;
     }
-    return false
-  }, [cart])
+    return false;
+  }, [cart]);
 
   const hasSelectNoPrice = useMemo(() => {
-    if (!cart) return false
+    if (!cart) return false;
     for (const item of cart.products) {
-      if (item.selected && item.price.price_discount == 0) return true
+      if (item.selected && item.price.price_discount == 0) return true;
     }
-    return false
-  }, [cart])
+    return false;
+  }, [cart]);
 
   return (
     <>
-      <div className={style['title']}>
-        Keranjang Belanja
-      </div>
+      <div className={style['title']}>Keranjang Belanja</div>
 
       <div className='h-6' />
 
@@ -64,26 +62,57 @@ const CartPage = () => {
           </div>
 
           <div className={style['items']}>
-            {cart?.products.map((item) => <CartItem key={item.id} item={item} />)}
+            {cart?.products.map((item) => (
+              <CartItem key={item.id} item={item} />
+            ))}
 
             {cart?.products?.length === 0 && (
               <div className='flex flex-col items-center'>
-                <Image src='/images/empty_cart.svg' alt='Empty Cart' width={450} height={450} />
-                <div className='text-title-sm md:text-title-lg text-center font-semibold'>Keranjangnya masih kosong nih</div>
-                <div className='text-body-2 md:text-body-1 text-center mt-3'>Yuk, tambahin barang-barang yang kamu mau ke keranjang sekarang!<br />Ada banyak potongan belanjanya pakai kode voucher</div>
-                <Link href='/' className='btn-solid-red rounded-full text-body-1 mt-6'>Mulai Belanja</Link>
+                <Image
+                  src='/images/empty_cart.svg'
+                  alt='Empty Cart'
+                  width={450}
+                  height={450}
+                />
+                <div className='text-title-sm md:text-title-lg text-center font-semibold'>
+                  Keranjangnya masih kosong nih
+                </div>
+                <div className='text-body-2 md:text-body-1 text-center mt-3'>
+                  Yuk, tambahin barang-barang yang kamu mau ke keranjang
+                  sekarang!
+                  <br />
+                  Ada banyak potongan belanjanya pakai kode voucher
+                </div>
+                <Link
+                  href='/'
+                  className='btn-solid-red rounded-full text-body-1 mt-6'
+                >
+                  Mulai Belanja
+                </Link>
               </div>
             )}
           </div>
         </div>
-
-        <div className={style['summary-wrapper']}>
+        <div
+          className={`${style['summary-wrapper']} ${
+            useDivvice.isMobile && cart?.product_total === 0 ? 'hidden' : ''
+          }`}
+        >
           <div className={style['summary']}>
-            {useDivvice.isMobile && <CartSummaryMobile {...summary} isLoaded={!!cart} />}
-            {!useDivvice.isMobile && <CartSummary {...summary} isLoaded={!!cart} />}
+            {useDivvice.isMobile && (
+              <CartSummaryMobile {...summary} isLoaded={!!cart} />
+            )}
+            {!useDivvice.isMobile && (
+              <CartSummary {...summary} isLoaded={!!cart} />
+            )}
 
             <div className={style['summary-buttons']}>
-              <Tooltip label={hasSelectedPromo && 'Barang promo tidak dapat dibuat quotation'}>
+              <Tooltip
+                label={
+                  hasSelectedPromo &&
+                  'Barang promo tidak dapat dibuat quotation'
+                }
+              >
                 <Button
                   colorScheme='yellow'
                   w='full'
@@ -95,10 +124,12 @@ const CartPage = () => {
                 </Button>
               </Tooltip>
 
-              <Tooltip label={clsxm({
-                'Tidak ada item yang dipilih': !hasSelected,
-                'Terdapat item yang tidak ada harga': hasSelectNoPrice
-              })}>
+              <Tooltip
+                label={clsxm({
+                  'Tidak ada item yang dipilih': !hasSelected,
+                  'Terdapat item yang tidak ada harga': hasSelectNoPrice,
+                })}
+              >
                 <Button
                   colorScheme='red'
                   w='full'
@@ -114,7 +145,7 @@ const CartPage = () => {
         </div>
       </div>
     </>
-  )
-}
+  );
+};
 
-export default CartPage
\ No newline at end of file
+export default CartPage;
-- 
cgit v1.2.3

