import type { Locale } from '@/lib/locale'; import { formatStatus, formatCreatedAt, getStatusBadgeClass, getPaymentDisplayInfo, type MyOrder, } from '@/lib/pay-utils'; interface OrderTableProps { isDark: boolean; locale: Locale; loading: boolean; error: string; orders: MyOrder[]; } export default function OrderTable({ isDark, locale, loading, error, orders }: OrderTableProps) { const text = locale === 'en' ? { empty: 'No matching orders found', orderId: 'Order ID', amount: 'Amount', payment: 'Payment Method', status: 'Status', createdAt: 'Created At', } : { empty: '暂无符合条件的订单记录', orderId: '订单号', amount: '金额', payment: '支付方式', status: '状态', createdAt: '创建时间', }; return (
{loading ? (
) : error ? (
{error}
) : orders.length === 0 ? (
{text.empty}
) : ( <>
{text.orderId} {text.amount} {text.payment} {text.status} {text.createdAt}
{orders.map((order) => (
#{order.id.slice(0, 12)}
¥{order.amount.toFixed(2)}
{getPaymentDisplayInfo(order.paymentType, locale).channel}
{formatStatus(order.status, locale)}
{formatCreatedAt(order.createdAt, locale)}
))}
)}
); }