Sort by close date

This commit is contained in:
jahooma 2022-01-23 13:34:03 -06:00
parent b9a82b652e
commit c5a5869f21
2 changed files with 4 additions and 0 deletions

View File

@ -226,6 +226,8 @@ export function SearchableGrid(props: {
matches, matches,
(contract) => -1 * (contract.resolutionTime ?? 0) (contract) => -1 * (contract.resolutionTime ?? 0)
) )
} else if (sort === 'close-date') {
matches = _.sortBy(matches, (contract) => contract.closeTime)
} else if (sort === 'most-traded') { } else if (sort === 'most-traded') {
matches.sort( matches.sort(
(a, b) => contractMetrics(b).truePool - contractMetrics(a).truePool (a, b) => contractMetrics(b).truePool - contractMetrics(a).truePool
@ -266,6 +268,7 @@ export function SearchableGrid(props: {
<option value="most-traded">Most traded</option> <option value="most-traded">Most traded</option>
<option value="newest">Newest</option> <option value="newest">Newest</option>
<option value="resolved">Resolved</option> <option value="resolved">Resolved</option>
<option value="close-date">Close date</option>
</select> </select>
</div> </div>

View File

@ -5,6 +5,7 @@ export type Sort =
| 'tag' | 'tag'
| 'newest' | 'newest'
| 'most-traded' | 'most-traded'
| 'close-date'
| 'resolved' | 'resolved'
| 'all' | 'all'