OrdersList
Recent orders and orders needing attention with sync details and retry actions
Import
import { OrdersList } from '@tallyui/components';Usage
<OrdersList
orders={orders}
onRetry={(orderIds) => outbox.requeue(orderIds)}
stuck={outbox.state.stuck}
/>Renders Recent orders and a Needs attention section when applicable, with expandable line and payment details, sync status, and warnings. Eligible rejected orders have a Retry action that calls onRetry.
Server order history
Pass the store's order history as history to show it in Recent with the till's own sales. Each row is platform-neutral, and the app maps its own store's orders into it:
import { OrdersList, type OrderHistoryRow } from '@tallyui/components';
const history: OrderHistoryRow[] = storeOrders.map((order) => ({
id: order.id,
clientOrderId: order.clientOrderId, // the till's PosOrder id, when the till placed it
reference: order.code,
placedAt: order.placedAt,
totalMinor: order.totalMinor,
currency: order.currency,
itemCount: order.itemCount,
stateLabel: order.stateLabel,
}));
<OrdersList orders={orders} history={history} onRetry={(orderIds) => outbox.requeue(orderIds)} />- The outbox row wins. A history row whose
clientOrderIdis theidof an order inordersis hidden while that order is there. - Newest first. Recent merges outbox orders (by
createdAt) and history rows (byplacedAt). At equal times the outbox order comes first. A time that does not parse goes last. - Read-only. A history row shows
Order <reference> · <n> itemsand<date> · <total> · <stateLabel>, withreference,itemCountandstateLabelas given. It has no detail, no Retry and no warnings, and never appears under Needs attention.
Without history, the list renders exactly as before, with orders in the given order.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
orders | PosOrder[] | required | Orders shown in Recent and filtered into Needs attention |
onRetry | (orderIds: string[]) => Promise<number> | required | Requeues rejected orders; a result of zero re-enables Retry immediately |
formatDate | (iso: string) => string | defaultFormatDate | Formats order times; the default uses a medium date and short time, leaving unparseable values unchanged |
footer | ReactNode | --- | App content rendered after the order sections |
stuck | OutboxState['stuck'] | --- | Outbox entries that make pending orders need attention and supply each order's waiting-since time |
history | OrderHistoryRow[] | --- | The store's orders, shown read-only in Recent; a row is hidden while an outbox order has its clientOrderId as id |