Add oldest sort

This commit is contained in:
James Grugett 2022-02-04 16:04:30 -06:00
parent 0959ec7679
commit 247f5e9275
2 changed files with 4 additions and 0 deletions

View File

@ -221,6 +221,8 @@ export function SearchableGrid(props: {
matches,
(contract) => -1 * (contract.resolutionTime ?? 0)
)
} else if (sort === 'oldest') {
matches.sort((a, b) => a.createdTime - b.createdTime)
} else if (sort === 'close-date') {
matches = _.sortBy(matches, ({ volume24Hours }) => -1 * volume24Hours)
matches = _.sortBy(matches, (contract) => contract.closeTime)
@ -265,6 +267,7 @@ export function SearchableGrid(props: {
<option value="24-hour-vol">24h volume</option>
<option value="close-date">Closing soon</option>
<option value="newest">Newest</option>
<option value="oldest">Oldest</option>
<option value="tag">By tag</option>
{!byOneCreator && <option value="creator">By creator</option>}

View File

@ -4,6 +4,7 @@ export type Sort =
| 'creator'
| 'tag'
| 'newest'
| 'oldest'
| 'most-traded'
| '24-hour-vol'
| 'close-date'