Closed sort option
This commit is contained in:
parent
042fdb3cbe
commit
5d38018a53
|
@ -32,6 +32,7 @@ const sortIndexes = [
|
||||||
{ label: 'Most traded', value: 'contracts-most-traded' },
|
{ label: 'Most traded', value: 'contracts-most-traded' },
|
||||||
{ label: '24h volume', value: 'contracts-24-hour-vol' },
|
{ label: '24h volume', value: 'contracts-24-hour-vol' },
|
||||||
{ label: 'Closing soon', value: 'contracts-closing-soon' },
|
{ label: 'Closing soon', value: 'contracts-closing-soon' },
|
||||||
|
{ label: 'Closed', value: 'contracts-closed' },
|
||||||
{ label: 'Resolved', value: 'contracts-resolved' },
|
{ label: 'Resolved', value: 'contracts-resolved' },
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -120,7 +121,11 @@ export function ContractSearchInner(props: {
|
||||||
const tag = querySortOptions?.filter?.tag
|
const tag = querySortOptions?.filter?.tag
|
||||||
useFilterTag(tag)
|
useFilterTag(tag)
|
||||||
|
|
||||||
if (!creatorId) {
|
if (
|
||||||
|
!creatorId ||
|
||||||
|
index === 'contracts-closed' ||
|
||||||
|
index === 'contracts-resolved'
|
||||||
|
) {
|
||||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||||
useFilterClosed(index)
|
useFilterClosed(index)
|
||||||
|
|
||||||
|
@ -168,7 +173,9 @@ const useFilterClosed = (index: string) => {
|
||||||
const [now] = useState(Date.now())
|
const [now] = useState(Date.now())
|
||||||
useRange({
|
useRange({
|
||||||
attribute: 'closeTime',
|
attribute: 'closeTime',
|
||||||
min: index === 'contracts-resolved' ? 0 : now,
|
min:
|
||||||
|
index === 'contracts-resolved' || index === 'contracts-closed' ? 0 : now,
|
||||||
|
max: index === 'contracts-closed' ? now : undefined,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,6 @@ import { useSearchBox } from 'react-instantsearch-hooks-web'
|
||||||
const MARKETS_SORT = 'markets_sort'
|
const MARKETS_SORT = 'markets_sort'
|
||||||
|
|
||||||
export type Sort =
|
export type Sort =
|
||||||
| 'creator'
|
|
||||||
| 'tag'
|
|
||||||
| 'newest'
|
| 'newest'
|
||||||
| 'oldest'
|
| 'oldest'
|
||||||
| 'most-traded'
|
| 'most-traded'
|
||||||
|
@ -15,7 +13,6 @@ export type Sort =
|
||||||
| 'closing-soon'
|
| 'closing-soon'
|
||||||
| 'closed'
|
| 'closed'
|
||||||
| 'resolved'
|
| 'resolved'
|
||||||
| 'all'
|
|
||||||
|
|
||||||
export function useInitialQueryAndSort(options?: {
|
export function useInitialQueryAndSort(options?: {
|
||||||
defaultSort: Sort
|
defaultSort: Sort
|
||||||
|
|
Loading…
Reference in New Issue
Block a user