|
|
@ -1456,9 +1456,7 @@ class Moving extends React.Component {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
buttons = (<Button onClick={() => this.skip()}>Skip</Button>);
|
|
|
|
buttons = (<Button onClick={() => this.skip()}>Skip</Button>);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const currentPlayer = this.props.player.name === this.props.game.currentPlayer ?
|
|
|
|
const { currentPlayer } = this.props;
|
|
|
|
this.props.player : this.props.game.otherPlayers
|
|
|
|
|
|
|
|
.find(p => p.player.name === this.props.game.currentPlayer).player;
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<Row>
|
|
|
|
<Row>
|
|
|
|
<Col width={'12'}>
|
|
|
|
<Col width={'12'}>
|
|
|
@ -1481,10 +1479,7 @@ class Moving extends React.Component {
|
|
|
|
class Action extends React.Component {
|
|
|
|
class Action extends React.Component {
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
|
let view, buttons;
|
|
|
|
let view, buttons;
|
|
|
|
const currentPlayer = (this.props.player.name === this.props.game.currentPlayer ||
|
|
|
|
const { currentPlayer } = this.props;
|
|
|
|
this.props.game.currentPlayer === '') ?
|
|
|
|
|
|
|
|
this.props.player : this.props.game.otherPlayers
|
|
|
|
|
|
|
|
.find(p => p.player.name === this.props.game.currentPlayer).player;
|
|
|
|
|
|
|
|
switch (this.props.ui.action) {
|
|
|
|
switch (this.props.ui.action) {
|
|
|
|
case 'otb':
|
|
|
|
case 'otb':
|
|
|
|
if (this.props.player.name === this.props.game.currentPlayer) {
|
|
|
|
if (this.props.player.name === this.props.game.currentPlayer) {
|
|
|
@ -1884,7 +1879,8 @@ class BoardApp extends React.Component {
|
|
|
|
this.state = {
|
|
|
|
this.state = {
|
|
|
|
screen: SCREENS.summary,
|
|
|
|
screen: SCREENS.summary,
|
|
|
|
card: props.ui.card,
|
|
|
|
card: props.ui.card,
|
|
|
|
timerId: false
|
|
|
|
timerId: false,
|
|
|
|
|
|
|
|
currentPlayer: this.props.player
|
|
|
|
};
|
|
|
|
};
|
|
|
|
this.myRef = React.createRef();
|
|
|
|
this.myRef = React.createRef();
|
|
|
|
this.actionRef = React.createRef();
|
|
|
|
this.actionRef = React.createRef();
|
|
|
@ -1906,7 +1902,7 @@ class BoardApp extends React.Component {
|
|
|
|
this.setState({ card });
|
|
|
|
this.setState({ card });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentDidUpdate() {
|
|
|
|
componentDidUpdate(prevProps) {
|
|
|
|
if (this.state.card.type === 'no-card' &&
|
|
|
|
if (this.state.card.type === 'no-card' &&
|
|
|
|
this.props.ui.cards.length > 0) {
|
|
|
|
this.props.ui.cards.length > 0) {
|
|
|
|
this.setState({ card: this.props.ui.cards[0] });
|
|
|
|
this.setState({ card: this.props.ui.cards[0] });
|
|
|
@ -1925,9 +1921,20 @@ class BoardApp extends React.Component {
|
|
|
|
this.actionShowing()) {
|
|
|
|
this.actionShowing()) {
|
|
|
|
this.props.alertHandled(this.props.ui.unhandledAlert.id);
|
|
|
|
this.props.alertHandled(this.props.ui.unhandledAlert.id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (prevProps.game.currentPlayer !== this.props.game.currentPlayer) {
|
|
|
|
|
|
|
|
const currentPlayer = this.props.player.name === this.props.game.currentPlayer ?
|
|
|
|
|
|
|
|
this.props.player : this.props.game.otherPlayers
|
|
|
|
|
|
|
|
.find(p => p.player.name === this.props.game.currentPlayer).player;
|
|
|
|
|
|
|
|
this.setState({ currentPlayer });
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
componentDidMount() {
|
|
|
|
|
|
|
|
const currentPlayer = this.props.player.name === this.props.game.currentPlayer ?
|
|
|
|
|
|
|
|
this.props.player : this.props.game.otherPlayers
|
|
|
|
|
|
|
|
.find(p => p.player.name === this.props.game.currentPlayer).player;
|
|
|
|
|
|
|
|
this.setState({ currentPlayer });
|
|
|
|
// const midColHeight = (window.innerHeight -
|
|
|
|
// const midColHeight = (window.innerHeight -
|
|
|
|
// (document.getElementsByClassName('flex-row')[0].offsetHeight * 2)) + 'px';
|
|
|
|
// (document.getElementsByClassName('flex-row')[0].offsetHeight * 2)) + 'px';
|
|
|
|
// const midCols = document.getElementsByClassName('mid-col');
|
|
|
|
// const midCols = document.getElementsByClassName('mid-col');
|
|
|
@ -2076,6 +2083,7 @@ class BoardApp extends React.Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const actionComponent = (
|
|
|
|
const actionComponent = (
|
|
|
|
<Action
|
|
|
|
<Action
|
|
|
|
|
|
|
|
currentPlayer={this.state.currentPlayer}
|
|
|
|
timerId={this.state.timerId}
|
|
|
|
timerId={this.state.timerId}
|
|
|
|
setTimerId={this.setTimerId}
|
|
|
|
setTimerId={this.setTimerId}
|
|
|
|
forwardRef={x => this.actionRef = x}
|
|
|
|
forwardRef={x => this.actionRef = x}
|
|
|
|