|
|
@@ -1,40 +1,59 @@
|
|
|
"use client";
|
|
|
|
|
|
+import { useState } from "react";
|
|
|
import Image from "next/image";
|
|
|
+import clsx from "clsx";
|
|
|
import { useRouter } from 'next/navigation';
|
|
|
+import type { OrderDetails } from "@/types/customer/type";
|
|
|
+import { UnpaidOrderSection } from "./UnpaidOrderSection";
|
|
|
|
|
|
-
|
|
|
-export function EmptyCart({isGuest}:{isGuest: boolean;}) {
|
|
|
+export function EmptyCart({
|
|
|
+ isGuest,
|
|
|
+ hasUnPaidOrder,
|
|
|
+ unpaidOrder
|
|
|
+}:{
|
|
|
+ isGuest: boolean;
|
|
|
+ hasUnPaidOrder: boolean;
|
|
|
+ unpaidOrder: Omit<OrderDetails, 'addresses'> | null;
|
|
|
+}) {
|
|
|
|
|
|
const router = useRouter();
|
|
|
+ const [showTips, setShowTips] = useState(true);
|
|
|
return (
|
|
|
- <div className="w-full box-border">
|
|
|
- <div className="w-37.5 h-37.5 mt-6 mx-auto">
|
|
|
+ <div className="w-full box-border mt-12">
|
|
|
+ {(hasUnPaidOrder && unpaidOrder !== null) &&
|
|
|
+ <div className="w-130 mx-auto">
|
|
|
+ <UnpaidOrderSection
|
|
|
+ orderDetail={unpaidOrder}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ }
|
|
|
+ <div className="w-50 h-50 mx-auto mt-6">
|
|
|
<Image src="/image/empty-cart.webp"
|
|
|
- width={150}
|
|
|
- height={150}
|
|
|
+ width={200}
|
|
|
+ height={200}
|
|
|
alt="empty cart"
|
|
|
/>
|
|
|
</div>
|
|
|
- <p className="text-center text-ly-16">Your Cart Is Empty</p>
|
|
|
+ <p className="text-center text-ly-18 mt-6">Your Cart Is Empty</p>
|
|
|
{isGuest && <>
|
|
|
- <p className="mt-2 text-center text-ly-12 leading-5 text-ly-placeholder">Have an account? Sign in to view your cart</p>
|
|
|
- <div className="relative border-box w-full px-4 mt-15">
|
|
|
+ <p className="mt-2 text-center text-ly-14 leading-5 text-ly-placeholder">Have an account? Sign in to view your cart</p>
|
|
|
+ <div className="relative border-box w-85.75 px-4 mt-15 mx-auto">
|
|
|
<button className="flex items-center justify-center w-full bg-ly-middlegreen text-ly-16 text-white h-12 rounded-3xl"
|
|
|
onClick={() => {router.replace('/customer/login')}}
|
|
|
>
|
|
|
Sign In
|
|
|
</button>
|
|
|
- <button className="mt-3 flex items-center justify-center w-full text-ly-16 h-12 rounded-3xl border-1"
|
|
|
+ <button className="mt-4 flex items-center justify-center w-full text-ly-16 h-12 rounded-3xl border-1"
|
|
|
onClick={() => {router.replace('/')}}
|
|
|
>
|
|
|
Back To Shop
|
|
|
</button>
|
|
|
- <div className="text-ly-12 absolute -top-4 left-1/2 -translate-x-1/2 -translate-y-full flex items-center bg-[#ffe033] w-max h-7 px-2 rounded-sm">
|
|
|
+ <div className={clsx("text-ly-12 absolute -top-4 left-1/2 -translate-x-1/2 -translate-y-full flex items-center bg-[#ffe033] w-max h-7 px-2 rounded-sm", !showTips && "hidden")}>
|
|
|
<span className="absolute left-12.5 bottom-0 translate-y-2/5 bg-[#ffe033] w-3 h-3 rotate-z-45 rotate-y-30"></span>
|
|
|
<span className="font-bold px-1 leading-5 rounded-xs bg-white mr-2">$200+</span>
|
|
|
Log In To Unlock VIP CouponPack
|
|
|
- <button className="ml-1 w-6 h-6">
|
|
|
+ <button className="ml-1 w-6 h-6" onClick={() => setShowTips(false)}>
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink" width="24" height="24" viewBox="0 0 24 24" fill="none"><path stroke="rgba(0, 0, 0, 1)" strokeWidth="1.5" strokeLinejoin="round" strokeLinecap="square" d="M7 7L17 17"></path><path stroke="rgba(0, 0, 0, 1)" strokeWidth="1.5" strokeLinejoin="round" strokeLinecap="square" d="M7 17L17 7"></path></svg>
|
|
|
</button>
|
|
|
|