Better detection for action screen.

logins
Thomas Hintz 5 years ago
parent bbd1c04c7a
commit 89e67b3150

@ -1232,6 +1232,7 @@ class Action extends React.Component {
} }
} }
return ( return (
<div ref={x => this.props.forwardRef(x)}>
<Row> <Row>
<Col width={'12'}> <Col width={'12'}>
<div className={'action'}> <div className={'action'}>
@ -1243,6 +1244,7 @@ class Action extends React.Component {
</div> </div>
</Col> </Col>
</Row> </Row>
</div>
); );
} }
} }
@ -1447,6 +1449,13 @@ class BoardApp extends React.Component {
card: props.ui.card card: props.ui.card
}; };
this.myRef = React.createRef(); 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 => { showScreen = screen => {
@ -1475,7 +1484,7 @@ class BoardApp extends React.Component {
// it as handled. // it as handled.
if (this.props.ui.unhandledAlert && if (this.props.ui.unhandledAlert &&
this.props.ui.unhandledAlert.type === ALERTS.beginTurn && this.props.ui.unhandledAlert.type === ALERTS.beginTurn &&
this.state.screen === SCREENS.action) { this.actionShowing()) {
this.props.alertHandled(this.props.ui.unhandledAlert.id); this.props.alertHandled(this.props.ui.unhandledAlert.id);
} }
} }
@ -1567,7 +1576,7 @@ class BoardApp extends React.Component {
</Fragment> </Fragment>
</AlertOverlay> </AlertOverlay>
); );
} else if (alert && this.state.screen !== SCREENS.action) { } else if (alert && !this.actionShowing()) {
switch (alert.type) { switch (alert.type) {
case ALERTS.beginTurn: case ALERTS.beginTurn:
alertOverlay = ( alertOverlay = (
@ -1651,6 +1660,7 @@ class BoardApp extends React.Component {
</div> </div>
<div className={this.tabClass(SCREENS.action)}> <div className={this.tabClass(SCREENS.action)}>
<Action <Action
forwardRef={x => this.actionRef = x}
spaces={this.props.spaces} spaces={this.props.spaces}
player={this.props.player} player={this.props.player}
game={this.props.game} game={this.props.game}
@ -1699,6 +1709,7 @@ class BoardApp extends React.Component {
<div className='static-tab-container show-for-large'> <div className='static-tab-container show-for-large'>
<div className='tab show'> <div className='tab show'>
<Action <Action
forwardRef={x => this.actionRefExtra = x}
spaces={this.props.spaces} spaces={this.props.spaces}
player={this.props.player} player={this.props.player}
game={this.props.game} game={this.props.game}

Loading…
Cancel
Save