Skip to content

Commit

Permalink
feat: optionally sort the scores if revealed
Browse files Browse the repository at this point in the history
  • Loading branch information
psykzz authored Oct 1, 2024
1 parent 17b1e02 commit 0266737
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/UserList/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ export const UserList = ({ me, users, scores }) => {
// Stops the user list jumping around
users?.sort((a, b) => a.id.localeCompare(b.id));
try {
// Try to sort by score as well.
users?.sort((a,b) => (scoreByUser[a.id]?.score ?? 0) - (scoreByUser[b.id]?.score ?? 0));
if (showScores) {
// Try to sort by score as well.
users?.sort((a,b) => (scoreByUser[a.id]?.score ?? 0) - (scoreByUser[b.id]?.score ?? 0));
}
} catch (e) { console.error(e); }
console.log({users})

Expand Down

0 comments on commit 0266737

Please sign in to comment.