diff --git a/src/components/common/LayoutCheckout/LayoutCheckout.module.scss b/src/components/common/LayoutCheckout/LayoutCheckout.module.scss index 8a32d20a7..82e8d8a0e 100644 --- a/src/components/common/LayoutCheckout/LayoutCheckout.module.scss +++ b/src/components/common/LayoutCheckout/LayoutCheckout.module.scss @@ -4,8 +4,11 @@ flex-direction: column; min-height: 100vh; > main { + display: flex; flex: 1; position: relative; + max-width: min(100%, 1536px); + margin: auto; } .footer { @apply spacing-horizontal; diff --git a/src/components/modules/checkout/CheckoutBill/CheckoutBill.module.scss b/src/components/modules/checkout/CheckoutBill/CheckoutBill.module.scss index 8cd564917..713a984a5 100644 --- a/src/components/modules/checkout/CheckoutBill/CheckoutBill.module.scss +++ b/src/components/modules/checkout/CheckoutBill/CheckoutBill.module.scss @@ -1,6 +1,7 @@ .warpper { padding: 3.2rem; min-width: 100%; + min-height: 100%; @screen lg { max-width: 56.3rem; @apply flex justify-between flex-col; @@ -14,10 +15,14 @@ display: block; } } + .empty { + @apply flex flex-col justify-center items-center; + } .list { - min-height: 52.8rem; + // min-height: 52.8rem; } .bot { + margin-top: auto; .price { margin-top: 3.2rem; .line { diff --git a/src/components/modules/checkout/CheckoutBill/CheckoutBill.tsx b/src/components/modules/checkout/CheckoutBill/CheckoutBill.tsx index 433df66d1..7b4196279 100644 --- a/src/components/modules/checkout/CheckoutBill/CheckoutBill.tsx +++ b/src/components/modules/checkout/CheckoutBill/CheckoutBill.tsx @@ -1,8 +1,11 @@ import { Cart } from '@commerce/types/cart' import React from 'react' -import { CardItemCheckout } from '../../../common' +import { ROUTE } from 'src/utils/constanst.utils' +import { LANGUAGE } from 'src/utils/language.utils' +import { ButtonCommon, CardItemCheckout, EmptyCommon } from '../../../common' import s from './CheckoutBill.module.scss' import FormPromotionCode from './FormPromotionCode/FormPromotionCode' +import Link from 'next/link' interface CheckoutBillProps { // data: CardItemCheckoutProps[] @@ -14,8 +17,18 @@ const CheckoutBill = ({ data }: CheckoutBillProps) => { return (
- Your cart ({data?.totalQuantity}) + Your cart ({data?.totalQuantity || 0})
+ { + !data?.totalQuantity &&
+ + + + {LANGUAGE.BUTTON_LABEL.SHOP_NOW} + + +
+ }
{data?.lineItems?.map((item) => { return @@ -26,11 +39,15 @@ const CheckoutBill = ({ data }: CheckoutBillProps) => {
Discount {(data?.discounts?.length || 0) > 0 && `(${data?.discounts?.map(item => item.description).join(",")})`} -
{data?.totalDiscount} {data?.currency?.code}
+
+ {data?.totalDiscount ? `${data?.totalDiscount} ${data?.currency?.code}` : "0"} +
Subtotal -
{data?.subtotalPrice} {data?.currency?.code}
+
+ {data?.subtotalPrice ? `${data?.subtotalPrice} ${data?.currency?.code}` : "0"} +
Shipping @@ -38,7 +55,7 @@ const CheckoutBill = ({ data }: CheckoutBillProps) => {
Estimated Total -
{data?.totalPrice} {data?.currency?.code}
+
{data?.totalPrice ? `${data?.totalPrice} ${data?.currency?.code}` : "0"}
diff --git a/src/components/modules/checkout/CheckoutInfo/CheckoutInfo.tsx b/src/components/modules/checkout/CheckoutInfo/CheckoutInfo.tsx index a35a13df2..8b3267238 100644 --- a/src/components/modules/checkout/CheckoutInfo/CheckoutInfo.tsx +++ b/src/components/modules/checkout/CheckoutInfo/CheckoutInfo.tsx @@ -116,22 +116,19 @@ const CheckoutInfo = ({ onViewCart }: CheckoutInfoProps) => { ] // TODO: remove - const { addProduct } = useAddProductToCart() - - const createOrder = () => { - addProduct({ variantId: "92", quantity: 2 }, handleAddToCartCallback) - } - const handleAddToCartCallback = (isSuccess: boolean, message?: string) => { - // console.log("after create order: ", isSuccess, message) - } + // const { addProduct } = useAddProductToCart() + // const createOrder = () => { + // addProduct({ variantId: "92", quantity: 2 }, handleAddToCartCallback) + // } + // const handleAddToCartCallback = (isSuccess: boolean, message?: string) => { + // // console.log("after create order: ", isSuccess, message) + // } return (
{/* TODO: remove */} - test create order - test get activeStep order - TOTAL: {order?.totalPrice} + {/* test create order */}
diff --git a/src/components/modules/checkout/CheckoutInfo/components/CustomerInfoForm/CustomerInfoForm.tsx b/src/components/modules/checkout/CheckoutInfo/components/CustomerInfoForm/CustomerInfoForm.tsx index 65177f043..254983dda 100644 --- a/src/components/modules/checkout/CheckoutInfo/components/CustomerInfoForm/CustomerInfoForm.tsx +++ b/src/components/modules/checkout/CheckoutInfo/components/CustomerInfoForm/CustomerInfoForm.tsx @@ -54,6 +54,8 @@ const CustomerInfoForm = ({ id, onConfirm, activeStep }: Props) => { if (error?.errorCode === ErrorCode.EmailAddressConflictError) { // show modal common openModalConfirmLogin() + } else if (error?.errorCode === ErrorCode.NoActiveOrderError) { + showMessageError("Your cart is empty! Please add items to the cart!") } else { showMessageError(error?.message) } diff --git a/src/components/modules/checkout/CheckoutPage/CheckoutPage.module.scss b/src/components/modules/checkout/CheckoutPage/CheckoutPage.module.scss index a1e68d863..bd519be01 100644 --- a/src/components/modules/checkout/CheckoutPage/CheckoutPage.module.scss +++ b/src/components/modules/checkout/CheckoutPage/CheckoutPage.module.scss @@ -1,6 +1,7 @@ @import "../../../../styles/utilities"; .warrper{ @apply flex w-full; + min-height: 100%; .right { display: none; @screen lg {