+function TeamButton(props) {
+ return <button className="inline"
+ onClick={() => props.game.join_team(props.team)}>
+ {props.label}
+ </button>;
+}
+
+function TeamChoices(props) {
+ let other_team;
+ if (props.player.team === "X")
+ other_team = "O";
+ else
+ other_team = "X";
+
+ if (props.player.team === "") {
+ if (props.first_move) {
+ return null;
+ } else {
+ return [
+ <TeamButton key="X" game={props.game} team="X" label="Join X" />,
+ " ",
+ <TeamButton key="O" game={props.game} team="O" label="Join O" />
+ ];
+ }
+ } else {
+ return <TeamButton game={props.game} team={other_team} label="Switch" />;
+ }
+}
+