fix user turn issue in infopanel
This commit is contained in:
parent
eb1a51c41f
commit
6f96842a87
@ -41,10 +41,12 @@ function getInfoPanelTextByGameState(params: {
|
||||
}
|
||||
return context.texts.GameEnded + " " + whoWon;
|
||||
} else {
|
||||
return game?.checkIsPlayerTurn(userKey)
|
||||
if (game) {
|
||||
return game.checkIsPlayerTurn(userKey)
|
||||
? context.texts.YourTurn
|
||||
: context.texts.OpponentTurn;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@ -90,20 +92,25 @@ const InfoPanel: FunctionComponent<{
|
||||
context.themeManager.theme.primary,
|
||||
context.themeManager.theme.primaryLight
|
||||
);
|
||||
return (
|
||||
<InfoPanelContainer context={context} color={containerColor}>
|
||||
<h4 style={{ margin: "0", color: textColor }}>
|
||||
{getInfoPanelTextByGameState({
|
||||
const text = getInfoPanelTextByGameState({
|
||||
context,
|
||||
game,
|
||||
crashMessage,
|
||||
userKey,
|
||||
userKeyWhoLeave,
|
||||
searchingOpponent,
|
||||
})}
|
||||
});
|
||||
if (text) {
|
||||
return (
|
||||
<InfoPanelContainer context={context} color={containerColor}>
|
||||
<h4 style={{ margin: "0", color: textColor }}>
|
||||
{text}
|
||||
</h4>
|
||||
</InfoPanelContainer>
|
||||
);
|
||||
};
|
||||
} else {
|
||||
return (<div></div>)
|
||||
}
|
||||
};
|
||||
|
||||
export default InfoPanel;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user