-
+ if (isLoading) {
+ content = (
+
+
+
+ );
+ } else if (!product) {
+ content = (
+
+
+
+
Product not found
+
-
-
-
-
Product not found
-
-
-
-
-
-
-
+
+
+ );
+ } else {
+ content = (
+ <>
+
+
0 ? variants : undefined}
+ quantity={quantityVariant}
+ ribbon={meta.ribbon}
+ inventoryStatus={meta.inventoryStatus}
+ inventoryQuantity={meta.inventoryQuantity}
+ sku={meta.sku}
+ buttons={[
+ { text: "Add To Cart", onClick: handleAddToCart },
+ { text: "Buy Now", onClick: handleBuyNow },
+ ]}
+ />
+
+
setCartOpen(false)}
+ items={cartItems}
+ onQuantityChange={updateQuantity}
+ onRemove={removeItem}
+ total={`$${cartTotal}`}
+ buttons={[
+ {
+ text: isCheckoutLoading ? "Processing..." : "Check Out", onClick: handleCheckout,
+ },
+ ]}
+ />
+ >
);
}
@@ -193,49 +170,14 @@ function ProductPageContent({ params }: ProductPageProps) {
>
-
-
-
-
0 ? variants : undefined}
- quantity={quantityVariant}
- ribbon={meta.ribbon}
- inventoryStatus={meta.inventoryStatus}
- inventoryQuantity={meta.inventoryQuantity}
- sku={meta.sku}
- buttons={[
- { text: "Add To Cart", onClick: handleAddToCart },
- { text: "Buy Now", onClick: handleBuyNow },
- ]}
- />
-
-
-
setCartOpen(false)}
- items={cartItems}
- onQuantityChange={updateQuantity}
- onRemove={removeItem}
- total={`$${cartTotal}`}
- buttons={[
- {
- text: isCheckoutLoading ? "Processing..." : "Check Out", onClick: handleCheckout,
- },
- ]}
- />
+
+ {content}
-
+
+ {isLoading ? (
+
+ ) : (
+
+ )}
+