(null)
const width = useObserveWidth(containerRef)
const { visibleItems, remainder } = useMemo(() => {
if (!value || value.length === 0) {
return { visibleItems: [], remainder: 0 }
}
const columns = Math.max(Math.floor(width / 20) - 1, 1)
const visibleItems = value.slice(0, columns)
const remainder = value.length - columns
return { visibleItems, remainder }
}, [value, width])
if (!value) {
return null
}
return (
{visibleItems.map((item) => {
return (
{item.thumbnail ? (

) : (
)}
)
})}
{remainder > 0 && (
{t(
"customer-orders-table-remainder-more",
"+ {{remainder}} more",
{ remainder }
)}
)}
)
},
},
{
Header: t("customer-orders-table-date", "Date"),
accessor: "created_at",
Cell: ({ value }) => {
return moment(value).format("DD MMM YYYY hh:mm")
},
},
{
Header: t("customer-orders-table-fulfillment", "Fulfillment"),
accessor: "fulfillment_status",
Cell: ({ value }) => {
return decideFulfillmentStatus(value, t)
},
},
{
Header: t("customer-orders-table-status", "Status"),
accessor: "payment_status",
Cell: ({ value }) => {
return decidePaymentStatus(value, t)
},
},
{
Header: () => (
{t("customer-orders-table-total", "Total")}
),
accessor: "total",
Cell: ({
value,
row: {
original: { currency_code },
},
}) => {
return (
{stringDisplayPrice({
amount: value,
currencyCode: currency_code,
})}
)
},
},
] as Column[]
}, [])
return columns
}