Better detection for action screen.
This commit is contained in:
@@ -1232,17 +1232,19 @@ class Action extends React.Component {
|
||||
}
|
||||
}
|
||||
return (
|
||||
<Row>
|
||||
<Col width={'12'}>
|
||||
<div className={'action'}>
|
||||
{view}
|
||||
</div>
|
||||
<br />
|
||||
<div className={'center'}>
|
||||
{this.props.otherPlayersTurn ? (<Fragment />) : buttons}
|
||||
</div>
|
||||
</Col>
|
||||
</Row>
|
||||
<div ref={x => this.props.forwardRef(x)}>
|
||||
<Row>
|
||||
<Col width={'12'}>
|
||||
<div className={'action'}>
|
||||
{view}
|
||||
</div>
|
||||
<br />
|
||||
<div className={'center'}>
|
||||
{this.props.otherPlayersTurn ? (<Fragment />) : buttons}
|
||||
</div>
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1447,6 +1449,13 @@ class BoardApp extends React.Component {
|
||||
card: props.ui.card
|
||||
};
|
||||
this.myRef = React.createRef();
|
||||
this.actionRef = React.createRef();
|
||||
this.actionRefExtra = React.createRef();
|
||||
}
|
||||
|
||||
actionShowing = () => {
|
||||
return (this.actionRef && this.actionRef.offsetParent) ||
|
||||
(this.actionRefExtra && this.actionRefExtra.offsetParent)
|
||||
}
|
||||
|
||||
showScreen = screen => {
|
||||
@@ -1475,7 +1484,7 @@ class BoardApp extends React.Component {
|
||||
// it as handled.
|
||||
if (this.props.ui.unhandledAlert &&
|
||||
this.props.ui.unhandledAlert.type === ALERTS.beginTurn &&
|
||||
this.state.screen === SCREENS.action) {
|
||||
this.actionShowing()) {
|
||||
this.props.alertHandled(this.props.ui.unhandledAlert.id);
|
||||
}
|
||||
}
|
||||
@@ -1567,7 +1576,7 @@ class BoardApp extends React.Component {
|
||||
</Fragment>
|
||||
</AlertOverlay>
|
||||
);
|
||||
} else if (alert && this.state.screen !== SCREENS.action) {
|
||||
} else if (alert && !this.actionShowing()) {
|
||||
switch (alert.type) {
|
||||
case ALERTS.beginTurn:
|
||||
alertOverlay = (
|
||||
@@ -1651,6 +1660,7 @@ class BoardApp extends React.Component {
|
||||
</div>
|
||||
<div className={this.tabClass(SCREENS.action)}>
|
||||
<Action
|
||||
forwardRef={x => this.actionRef = x}
|
||||
spaces={this.props.spaces}
|
||||
player={this.props.player}
|
||||
game={this.props.game}
|
||||
@@ -1699,6 +1709,7 @@ class BoardApp extends React.Component {
|
||||
<div className='static-tab-container show-for-large'>
|
||||
<div className='tab show'>
|
||||
<Action
|
||||
forwardRef={x => this.actionRefExtra = x}
|
||||
spaces={this.props.spaces}
|
||||
player={this.props.player}
|
||||
game={this.props.game}
|
||||
|
||||
Reference in New Issue
Block a user