Invert closed markets sort

This commit is contained in:
James Grugett 2022-03-18 21:15:27 -05:00
parent 7d5d945a20
commit 5f4908b072

View File

@ -236,7 +236,10 @@ export function SearchableGrid(props: {
matches.sort((a, b) => a.createdTime - b.createdTime)
} else if (sort === 'close-date' || sort === 'closed') {
matches = _.sortBy(matches, ({ volume24Hours }) => -1 * volume24Hours)
matches = _.sortBy(matches, (contract) => contract.closeTime)
matches = _.sortBy(
matches,
(contract) => -1 * (contract.closeTime ?? Infinity)
)
const hideClosed = sort === 'closed'
matches = matches.filter(
({ closeTime }) => closeTime && closeTime > Date.now() !== hideClosed