import * as React from 'react'; import Box from '@mui/material/Box'; import Button from '@mui/material/Button'; import Card from '@mui/material/Card'; import CardActions from '@mui/material/CardActions'; import CardHeader from '@mui/material/CardHeader'; import Chip from '@mui/material/Chip'; import Divider from '@mui/material/Divider'; import type { SxProps } from '@mui/material/styles'; import Table from '@mui/material/Table'; import TableBody from '@mui/material/TableBody'; import TableCell from '@mui/material/TableCell'; import TableHead from '@mui/material/TableHead'; import TableRow from '@mui/material/TableRow'; import { ArrowRightIcon } from '@phosphor-icons/react/dist/ssr/ArrowRight'; import dayjs from 'dayjs'; const statusMap = { pending: { label: 'Pending', color: 'warning' }, delivered: { label: 'Delivered', color: 'success' }, refunded: { label: 'Refunded', color: 'error' }, } as const; export interface Order { id: string; customer: { name: string }; amount: number; status: 'pending' | 'delivered' | 'refunded'; createdAt: Date; } export interface LatestOrdersProps { orders?: Order[]; sx?: SxProps; } export function LatestOrders({ orders = [], sx }: LatestOrdersProps): React.JSX.Element { return ( Order Customer Date Status {orders.map((order) => { const { label, color } = statusMap[order.status] ?? { label: 'Unknown', color: 'default' }; return ( {order.id} {order.customer.name} {dayjs(order.createdAt).format('MMM D, YYYY')} ); })}
); }