]> git.cworth.org Git - lmno.games/commitdiff
Drop the game history interface.
authorCarl Worth <cworth@cworth.org>
Wed, 27 May 2020 04:20:22 +0000 (21:20 -0700)
committerCarl Worth <cworth@cworth.org>
Wed, 27 May 2020 04:20:22 +0000 (21:20 -0700)
Not that it's bad to let the user go back and forth to see what
happened, but the interface here was particularly clunky, (both for
being rendered as a list of buttons and also for allowing the user to
fire off new moves wen viewing old history state).

This commit simply guts the rendering of the "moves" list. It doesn't
yet remove the jumpTo code that's now dead.

tictactoe/tictactoe.jsx

index 654d55ee17c45da10c83ab4ecf1b4ed276b719e7..934faa8e0cc63e37adc530c22beea642f7782fb7 100644 (file)
@@ -137,17 +137,6 @@ class Game extends React.Component {
     const current = history[this.state.stepNumber];
     const winner = calculateWinner(current.squares);
 
-    const moves = history.map((step, move) => {
-      const desc = move ?
-        'Go to move #' + move :
-        'Go to game start';
-      return (
-        <li key={move}>
-          <button onClick={() => this.jumpTo(move)}>{desc}</button>
-        </li>
-      );
-    });
-
     let status;
     if (winner) {
       status = "Winner: " + winner;
@@ -165,7 +154,6 @@ class Game extends React.Component {
         </div>
         <div className="game-info">
           <div>{status}</div>
-          <ol>{moves}</ol>
         </div>
       </div>
     );