diff --git a/web/components/contract-card.tsx b/web/components/contract-card.tsx
index 55bf303a..36bfd26b 100644
--- a/web/components/contract-card.tsx
+++ b/web/components/contract-card.tsx
@@ -150,7 +150,8 @@ function AbbrContractDetails(props: {
) : showCloseTime ? (
- Closes {fromNow(closeTime || 0)}
+ {(closeTime || 0) < Date.now() ? 'Closed' : 'Closes'}{' '}
+ {fromNow(closeTime || 0)}
) : (
@@ -312,7 +313,7 @@ function EditableCloseDate(props: {
className="btn btn-xs btn-ghost"
onClick={() => setIsEditingCloseTime(true)}
>
- Edit
+ Edit
))}
>
diff --git a/web/components/contracts-list.tsx b/web/components/contracts-list.tsx
index 911e546e..d64df8d8 100644
--- a/web/components/contracts-list.tsx
+++ b/web/components/contracts-list.tsx
@@ -229,11 +229,13 @@ export function SearchableGrid(props: {
)
} else if (sort === 'oldest') {
matches.sort((a, b) => a.createdTime - b.createdTime)
- } else if (sort === 'close-date') {
+ } else if (sort === 'close-date' || sort === 'closed') {
matches = _.sortBy(matches, ({ volume24Hours }) => -1 * volume24Hours)
matches = _.sortBy(matches, (contract) => contract.closeTime)
- // Hide contracts that have already closed
- matches = matches.filter(({ closeTime }) => (closeTime || 0) > Date.now())
+ const hideClosed = sort === 'closed'
+ matches = matches.filter(
+ ({ closeTime }) => closeTime && closeTime > Date.now() !== hideClosed
+ )
} else if (sort === 'most-traded') {
matches.sort(
(a, b) => contractMetrics(b).truePool - contractMetrics(a).truePool
@@ -272,6 +274,7 @@ export function SearchableGrid(props: {
+
@@ -289,7 +292,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 2270fa4a..3eca5f3c 100644
--- a/web/hooks/use-sort-and-query-params.tsx
+++ b/web/hooks/use-sort-and-query-params.tsx
@@ -10,6 +10,7 @@ export type Sort =
| 'most-traded'
| '24-hour-vol'
| 'close-date'
+ | 'closed'
| 'resolved'
| 'all'