Resolved markets sort by resolved time

This commit is contained in:
jahooma 2022-01-23 11:14:04 -06:00
parent b059a44acc
commit b9a82b652e

View File

@ -219,8 +219,13 @@ export function SearchableGrid(props: {
check(c.creatorUsername) check(c.creatorUsername)
) )
if (sort === 'newest' || sort === 'resolved' || sort === 'all') { if (sort === 'newest' || sort === 'all') {
matches.sort((a, b) => b.createdTime - a.createdTime) matches.sort((a, b) => b.createdTime - a.createdTime)
} else if (sort === 'resolved') {
matches = _.sortBy(
matches,
(contract) => -1 * (contract.resolutionTime ?? 0)
)
} 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,7 +271,7 @@ export function SearchableGrid(props: {
{sort === 'tag' ? ( {sort === 'tag' ? (
<TagContractsGrid contracts={matches} /> <TagContractsGrid contracts={matches} />
) : !byOneCreator && (sort === 'creator' || sort === 'resolved') ? ( ) : !byOneCreator && sort === 'creator' ? (
<CreatorContractsGrid contracts={matches} /> <CreatorContractsGrid contracts={matches} />
) : ( ) : (
<ContractsGrid contracts={matches} /> <ContractsGrid contracts={matches} />