From 776d26572e69fa9d0b57b586262e4bd86b21dd92 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 8 Sep 2025 15:04:49 +0700
Subject: <hafid> validation Address

---
 src/lib/checkout/components/Checkout.jsx | 45 +++++++++++++++++++-------------
 1 file changed, 27 insertions(+), 18 deletions(-)

(limited to 'src/lib/checkout/components/Checkout.jsx')

diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx
index d8ede118..b36c09bf 100644
--- a/src/lib/checkout/components/Checkout.jsx
+++ b/src/lib/checkout/components/Checkout.jsx
@@ -1321,24 +1321,33 @@ const Checkout = () => {
                 <PickupAddress label='Alamat Pickup' />
               )}
               {selectedCarrierId != SELF_PICKUP_ID && (
-                <Skeleton
-                  isLoaded={
-                    !!selectedAddress.invoicing && !!selectedAddress.shipping
-                  }
-                  minHeight={290}
-                >
-                  <SectionAddress
-                    address={selectedAddress.shipping}
-                    label='Alamat Pengiriman'
-                    url='/my/address?select=shipping'
-                  />
-                  <Divider />
-                  <SectionAddress
-                    address={selectedAddress.invoicing}
-                    label='Alamat Penagihan'
-                    url='/my/address?select=invoice'
-                  />
-                </Skeleton>
+                <>
+                  {(!selectedAddress?.shipping || !selectedAddress?.invoicing) ? (
+                    <div className="p-4 border rounded-xl text-center text-red-600 bg-red-50">
+                      <p>⚠️ Anda belum memiliki alamat yang terdaftar.</p>
+                      <a
+                        href="/my/address?select=shipping"
+                        className="mt-2 inline-block px-4 py-2 bg-solid-red text-white rounded-lg"
+                      >
+                        Tambahkan Alamat
+                      </a>
+                    </div>
+                  ) : (
+                    <Skeleton isLoaded minHeight={290}>
+                      <SectionAddress
+                        address={selectedAddress.shipping}
+                        label="Alamat Pengiriman"
+                        url="/my/address?select=shipping"
+                      />
+                      <Divider />
+                      <SectionAddress
+                        address={selectedAddress.invoicing}
+                        label="Alamat Penagihan"
+                        url="/my/address?select=invoice"
+                      />
+                    </Skeleton>
+                  )}
+                </>
               )}
               {products && <SectionExpedition products={products} />}
               <Divider />
-- 
cgit v1.2.3

