"use client"; import Image from "next/image"; import { useCart } from "@/app/providers/cart-provider"; import { useAuth } from "@/app/providers/auth-provider"; import { formatPrice } from "@/lib/meshkee/format"; import { customerContinueCheckoutUrl } from "@/lib/meshkee/urls"; export function CartDrawer() { const { cart, open, setOpen, updateQuantity, removeItem, guestItems, loading } = useCart(); const { isAuthenticated } = useAuth(); if (!open) return null; const continueUrl = customerContinueCheckoutUrl( isAuthenticated, isAuthenticated ? [] : guestItems, ); return (
{cart.items.length === 0 ? (

هنوز محصولی به سبد اضافه نشده است.

) : ( cart.items.map((item) => (
{item.image ? ( {item.name} ) : (
)}

{item.name}

{item.optionLabel ?

{item.optionLabel}

: null} {formatPrice(item.price)}
{item.quantity}
)) )}
جمع {formatPrice(cart.total)}
ادامه
); }