pare down sorts; only show high/low prob on groups
This commit is contained in:
parent
9ff2b62740
commit
c15285aa64
|
@ -49,17 +49,15 @@ export const SORTS = [
|
||||||
{ label: 'Newest', value: 'newest' },
|
{ label: 'Newest', value: 'newest' },
|
||||||
{ label: 'Trending', value: 'score' },
|
{ label: 'Trending', value: 'score' },
|
||||||
{ label: `Most traded`, value: 'most-traded' },
|
{ label: `Most traded`, value: 'most-traded' },
|
||||||
{ label: '24h volume', value: '24-hour-vol' },
|
|
||||||
{ label: '24h change', value: 'prob-change-day' },
|
|
||||||
{ label: 'Last updated', value: 'last-updated' },
|
{ label: 'Last updated', value: 'last-updated' },
|
||||||
{ label: 'Subsidy', value: 'liquidity' },
|
{ label: 'Closing soon', value: 'close-date' },
|
||||||
{ label: 'Close date', value: 'close-date' },
|
|
||||||
{ label: 'Resolve date', value: 'resolve-date' },
|
{ label: 'Resolve date', value: 'resolve-date' },
|
||||||
{ label: 'Highest %', value: 'prob-descending' },
|
{ label: 'Highest %', value: 'prob-descending' },
|
||||||
{ label: 'Lowest %', value: 'prob-ascending' },
|
{ label: 'Lowest %', value: 'prob-ascending' },
|
||||||
] as const
|
] as const
|
||||||
|
|
||||||
export type Sort = typeof SORTS[number]['value']
|
export type Sort = typeof SORTS[number]['value']
|
||||||
|
export const PROB_SORTS = ['prob-descending', 'prob-ascending']
|
||||||
|
|
||||||
type filter = 'personal' | 'open' | 'closed' | 'resolved' | 'all'
|
type filter = 'personal' | 'open' | 'closed' | 'resolved' | 'all'
|
||||||
|
|
||||||
|
@ -95,6 +93,7 @@ export function ContractSearch(props: {
|
||||||
persistPrefix?: string
|
persistPrefix?: string
|
||||||
useQueryUrlParam?: boolean
|
useQueryUrlParam?: boolean
|
||||||
isWholePage?: boolean
|
isWholePage?: boolean
|
||||||
|
includeProbSorts?: boolean
|
||||||
noControls?: boolean
|
noControls?: boolean
|
||||||
maxResults?: number
|
maxResults?: number
|
||||||
renderContracts?: (
|
renderContracts?: (
|
||||||
|
@ -116,6 +115,7 @@ export function ContractSearch(props: {
|
||||||
headerClassName,
|
headerClassName,
|
||||||
persistPrefix,
|
persistPrefix,
|
||||||
useQueryUrlParam,
|
useQueryUrlParam,
|
||||||
|
includeProbSorts,
|
||||||
isWholePage,
|
isWholePage,
|
||||||
noControls,
|
noControls,
|
||||||
maxResults,
|
maxResults,
|
||||||
|
@ -221,6 +221,7 @@ export function ContractSearch(props: {
|
||||||
persistPrefix={persistPrefix}
|
persistPrefix={persistPrefix}
|
||||||
hideOrderSelector={hideOrderSelector}
|
hideOrderSelector={hideOrderSelector}
|
||||||
useQueryUrlParam={useQueryUrlParam}
|
useQueryUrlParam={useQueryUrlParam}
|
||||||
|
includeProbSorts={includeProbSorts}
|
||||||
user={user}
|
user={user}
|
||||||
onSearchParametersChanged={onSearchParametersChanged}
|
onSearchParametersChanged={onSearchParametersChanged}
|
||||||
noControls={noControls}
|
noControls={noControls}
|
||||||
|
@ -250,6 +251,7 @@ function ContractSearchControls(props: {
|
||||||
additionalFilter?: AdditionalFilter
|
additionalFilter?: AdditionalFilter
|
||||||
persistPrefix?: string
|
persistPrefix?: string
|
||||||
hideOrderSelector?: boolean
|
hideOrderSelector?: boolean
|
||||||
|
includeProbSorts?: boolean
|
||||||
onSearchParametersChanged: (params: SearchParameters) => void
|
onSearchParametersChanged: (params: SearchParameters) => void
|
||||||
useQueryUrlParam?: boolean
|
useQueryUrlParam?: boolean
|
||||||
user?: User | null
|
user?: User | null
|
||||||
|
@ -269,6 +271,7 @@ function ContractSearchControls(props: {
|
||||||
user,
|
user,
|
||||||
noControls,
|
noControls,
|
||||||
autoFocus,
|
autoFocus,
|
||||||
|
includeProbSorts,
|
||||||
} = props
|
} = props
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
@ -437,6 +440,7 @@ function ContractSearchControls(props: {
|
||||||
selectSort={selectSort}
|
selectSort={selectSort}
|
||||||
sort={sort}
|
sort={sort}
|
||||||
className={'flex flex-row gap-2'}
|
className={'flex flex-row gap-2'}
|
||||||
|
includeProbSorts={includeProbSorts}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{isMobile && (
|
{isMobile && (
|
||||||
|
@ -450,6 +454,7 @@ function ContractSearchControls(props: {
|
||||||
selectSort={selectSort}
|
selectSort={selectSort}
|
||||||
sort={sort}
|
sort={sort}
|
||||||
className={'flex flex-col gap-4'}
|
className={'flex flex-col gap-4'}
|
||||||
|
includeProbSorts={includeProbSorts}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
@ -504,6 +509,7 @@ export function SearchFilters(props: {
|
||||||
selectSort: (newSort: Sort) => void
|
selectSort: (newSort: Sort) => void
|
||||||
sort: string
|
sort: string
|
||||||
className?: string
|
className?: string
|
||||||
|
includeProbSorts?: boolean
|
||||||
}) {
|
}) {
|
||||||
const {
|
const {
|
||||||
filter,
|
filter,
|
||||||
|
@ -512,7 +518,13 @@ export function SearchFilters(props: {
|
||||||
selectSort,
|
selectSort,
|
||||||
sort,
|
sort,
|
||||||
className,
|
className,
|
||||||
|
includeProbSorts,
|
||||||
} = props
|
} = props
|
||||||
|
|
||||||
|
const sorts = includeProbSorts
|
||||||
|
? SORTS
|
||||||
|
: SORTS.filter((sort) => !PROB_SORTS.includes(sort.value))
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={className}>
|
<div className={className}>
|
||||||
<select
|
<select
|
||||||
|
@ -531,7 +543,7 @@ export function SearchFilters(props: {
|
||||||
value={sort}
|
value={sort}
|
||||||
onChange={(e) => selectSort(e.target.value as Sort)}
|
onChange={(e) => selectSort(e.target.value as Sort)}
|
||||||
>
|
>
|
||||||
{SORTS.map((option) => (
|
{sorts.map((option) => (
|
||||||
<option key={option.value} value={option.value}>
|
<option key={option.value} value={option.value}>
|
||||||
{option.label}
|
{option.label}
|
||||||
</option>
|
</option>
|
||||||
|
|
|
@ -215,6 +215,7 @@ export default function GroupPage(props: {
|
||||||
defaultFilter={suggestedFilter}
|
defaultFilter={suggestedFilter}
|
||||||
additionalFilter={{ groupSlug: group.slug }}
|
additionalFilter={{ groupSlug: group.slug }}
|
||||||
persistPrefix={`group-${group.slug}`}
|
persistPrefix={`group-${group.slug}`}
|
||||||
|
includeProbSorts
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user