Also support lowest % first

This commit is contained in:
Austin Chen 2022-09-02 18:27:26 -07:00
parent 1f6cab8cb4
commit 9a101601fb

View File

@ -61,6 +61,10 @@ export default function ContractSearchFirestore(props: {
matches = sortBy(matches, (c) => matches = sortBy(matches, (c) =>
getProbability(c as BinaryContract | PseudoNumericContract) getProbability(c as BinaryContract | PseudoNumericContract)
).reverse() ).reverse()
} else if (sort === 'lowest-percent') {
matches = sortBy(matches, (c) =>
getProbability(c as BinaryContract | PseudoNumericContract)
)
} }
if (additionalFilter) { if (additionalFilter) {
@ -109,12 +113,13 @@ export default function ContractSearchFirestore(props: {
value={sort} value={sort}
onChange={(e) => setSort(e.target.value)} onChange={(e) => setSort(e.target.value)}
> >
<option value="highest-percent">Highest %</option>
<option value="score">Trending</option> <option value="score">Trending</option>
<option value="newest">Newest</option> <option value="newest">Newest</option>
<option value="most-traded">Most traded</option> <option value="most-traded">Most traded</option>
<option value="24-hour-vol">24h volume</option> <option value="24-hour-vol">24h volume</option>
<option value="close-date">Closing soon</option> <option value="close-date">Closing soon</option>
<option value="highest-percent">Highest %</option>
<option value="lowest-percent">Lowest %</option>
</select> </select>
</div> </div>
<ContractsGrid contracts={matches} showTime={showTime} /> <ContractsGrid contracts={matches} showTime={showTime} />