import { Image } from '@components/common/Image.js';
import { ProductNoThumbnail } from '@components/common/ProductNoThumbnail.js';
import {
Order,
useCustomer
} from '@components/frontStore/customer/CustomerContext.jsx';
import { _ } from '@evershop/evershop/lib/locale/translate/_';
import React from 'react';
const OrderDetail: React.FC<{ order: Order }> = ({ order }) => {
return (
{order.items.map((item) => (
{item.thumbnail && (
)}
{!item.thumbnail && (
)}
{item.productName}
{_('Sku')}: #{item.productSku}
{item.qty} x {item.productPrice.text}
))}
{_('Order')}: #{order.orderNumber}
{order.createdAt.text}
{_('Total')}:{order.grandTotal.text}
);
};
export default function OrderHistory({ title }: { title?: string }) {
const { customer } = useCustomer();
const orders = customer?.orders || [];
return (
{title &&
{title}
}
{orders.length === 0 && (
{_('You have not placed any orders yet')}
)}
{orders.map((order) => (
))}
);
}