From 9e08b1b85cc467336129e22bc0ece6dfe74d204e Mon Sep 17 00:00:00 2001
From: Carl Worth <cworth@cworth.org>
Date: Thu, 18 Jun 2020 09:14:25 -0700
Subject: [PATCH] Sort player list by overall scores

Making it that much easier to see who is in the lead
---
 empathy/empathy.jsx | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/empathy/empathy.jsx b/empathy/empathy.jsx
index e67bbc8..82bb5ff 100644
--- a/empathy/empathy.jsx
+++ b/empathy/empathy.jsx
@@ -205,16 +205,18 @@ const PlayerInfo = React.memo(props => {
   if (! props.player.id)
     return null;
 
+  const sorted_players = [props.player, ...props.other_players].sort((a,b) => {
+    return b.score - a.score;
+  });
+
   return (
     <div className="player-info">
       <span className="players-header">Players: </span>
-      {props.player.name}
-      {props.player.score > 0 ? ` (${props.player.score})` : ""}
-      {props.other_players.map(other => (
-        <span key={other.id}>
-          {", "}
-          {other.name}
-          {other.score > 0 ? ` (${other.score})` : ""}
+      {sorted_players.map(player => (
+        <span key={player.id}>
+          {player.name}
+          {player.score > 0 ? ` (${player.score})` : ""}
+          {" "}
         </span>
       ))}
     </div>
-- 
2.45.2