]> git.cworth.org Git - lmno.games/blobdiff - tictactoe/tictactoe.jsx
Tighten up the display of the PlayerInfo block
[lmno.games] / tictactoe / tictactoe.jsx
index 6a27a220453ab06e38a3abda72cbc372476dafd6..579526b7dcb401e0310027da092f47c8fead5691 100644 (file)
@@ -84,14 +84,14 @@ function GameInfo(props) {
 }
 
 function PlayerInfo(props) {
-  if (! props.id)
+  if (! props.player.id)
     return null;
 
   return (
     <div className="player-info">
       <h2>Player</h2>
-      {props.name}, ID: {props.id},
-      {props.team ? ` on team ${props.team}` : " not on a team"}
+      {props.player.name}
+      {props.player.team ? ` (${props.player.team})` : ""}
     </div>
   );
 }
@@ -303,9 +303,7 @@ class Game extends React.Component {
       />,
       <PlayerInfo
         key="player-info"
-        id={state.player_info.id}
-        name={state.player_info.name}
-        team={state.player_info.team}
+        player={state.player_info}
       />,
       <div key="game" className="game">
         <button className="inline"