From b9a82b652e2c58427c47ce19d663b81d0f3e1c03 Mon Sep 17 00:00:00 2001 From: jahooma Date: Sun, 23 Jan 2022 11:14:04 -0600 Subject: [PATCH] Resolved markets sort by resolved time --- web/components/contracts-list.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/web/components/contracts-list.tsx b/web/components/contracts-list.tsx index 0246e092..f9e48636 100644 --- a/web/components/contracts-list.tsx +++ b/web/components/contracts-list.tsx @@ -219,8 +219,13 @@ export function SearchableGrid(props: { check(c.creatorUsername) ) - if (sort === 'newest' || sort === 'resolved' || sort === 'all') { + if (sort === 'newest' || sort === 'all') { 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') { matches.sort( (a, b) => contractMetrics(b).truePool - contractMetrics(a).truePool @@ -266,7 +271,7 @@ export function SearchableGrid(props: { {sort === 'tag' ? ( - ) : !byOneCreator && (sort === 'creator' || sort === 'resolved') ? ( + ) : !byOneCreator && sort === 'creator' ? ( ) : (