From c5a5869f210baf1333d068bb198a736a9c5408d0 Mon Sep 17 00:00:00 2001 From: jahooma Date: Sun, 23 Jan 2022 13:34:03 -0600 Subject: [PATCH] Sort by close date --- web/components/contracts-list.tsx | 3 +++ web/hooks/use-sort-and-query-params.tsx | 1 + 2 files changed, 4 insertions(+) diff --git a/web/components/contracts-list.tsx b/web/components/contracts-list.tsx index f9e48636..d758899e 100644 --- a/web/components/contracts-list.tsx +++ b/web/components/contracts-list.tsx @@ -226,6 +226,8 @@ export function SearchableGrid(props: { matches, (contract) => -1 * (contract.resolutionTime ?? 0) ) + } else if (sort === 'close-date') { + matches = _.sortBy(matches, (contract) => contract.closeTime) } else if (sort === 'most-traded') { matches.sort( (a, b) => contractMetrics(b).truePool - contractMetrics(a).truePool @@ -266,6 +268,7 @@ export function SearchableGrid(props: { + diff --git a/web/hooks/use-sort-and-query-params.tsx b/web/hooks/use-sort-and-query-params.tsx index ee0db506..6ff6aa5e 100644 --- a/web/hooks/use-sort-and-query-params.tsx +++ b/web/hooks/use-sort-and-query-params.tsx @@ -5,6 +5,7 @@ export type Sort = | 'tag' | 'newest' | 'most-traded' + | 'close-date' | 'resolved' | 'all'