Sort bets reverse-chronologically.

This commit is contained in:
jahooma 2021-12-15 22:40:48 -06:00
parent ea1e66bda1
commit 36591539d3
2 changed files with 6 additions and 0 deletions

View File

@ -44,6 +44,9 @@ export function BetsList(props: { user: User }) {
if (bets.length === 0) return <div>You have not made any bets yet!</div>
// Decending creation time.
bets.sort((bet1, bet2) => bet2.createdTime - bet1.createdTime)
const contractBets = _.groupBy(bets, 'contractId')
const [resolved, unresolved] = _.partition(

View File

@ -75,6 +75,9 @@ function BetsSection(props: { contract: Contract; user: User | null }) {
if (bets === 'loading' || bets.length === 0) return <></>
// Decending creation time.
bets.sort((bet1, bet2) => bet2.createdTime - bet1.createdTime)
const userBets = user && bets.filter((bet) => bet.userId === user.id)
return (