From 247f5e9275e4820a98ce0da3dbe7e1e558580641 Mon Sep 17 00:00:00 2001 From: James Grugett Date: Fri, 4 Feb 2022 16:04:30 -0600 Subject: [PATCH] Add oldest sort --- 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 713317f2..c933cb12 100644 --- a/web/components/contracts-list.tsx +++ b/web/components/contracts-list.tsx @@ -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: { + {!byOneCreator && } diff --git a/web/hooks/use-sort-and-query-params.tsx b/web/hooks/use-sort-and-query-params.tsx index 17cf33b4..f63fbcc0 100644 --- a/web/hooks/use-sort-and-query-params.tsx +++ b/web/hooks/use-sort-and-query-params.tsx @@ -4,6 +4,7 @@ export type Sort = | 'creator' | 'tag' | 'newest' + | 'oldest' | 'most-traded' | '24-hour-vol' | 'close-date'