diff --git a/src/app/ItemTradesPage.js b/src/app/ItemTradesPage.js index 07eae83..766cb2b 100644 --- a/src/app/ItemTradesPage.js +++ b/src/app/ItemTradesPage.js @@ -143,6 +143,11 @@ function ItemTradesTable({ md: "18ex", }; + const trades = [...(data?.item?.trades || [])].sort( + (a, b) => + new Date(b.user.lastTradeActivity) - new Date(a.user.lastTradeActivity) + ); + return ( - List - - {userHeading} - {/* A small wording tweak to fit better on the xsmall screens! */} Last active Active at + + {userHeading} + {shouldShowCompareColumn && ( Compare )} + List {loading && ( <> - - - - - + + + + + )} {!loading && - data.item.trades.length > 0 && - data.item.trades.map((trade) => ( + trades.length > 0 && + trades.map((trade) => ( ))} - {!loading && data.item.trades.length === 0 && ( + {!loading && trades.length === 0 && ( - - - {listName} - - - - {username} - {new Intl.DateTimeFormat("en", { month: "short", year: "numeric", }).format(new Date(lastTradeActivity))} + + {username} + {shouldShowCompareColumn && ( )} + + + {listName} + + ); } -function ItemTradesTableRowSkeleton() { +function ItemTradesTableRowSkeleton({ shouldShowCompareColumn }) { return ( @@ -310,9 +325,11 @@ function ItemTradesTableRowSkeleton() { X - - X - + {shouldShowCompareColumn && ( + + X + + )} ); }