add game ended message

This commit is contained in:
Halit Aksoy 2022-09-07 22:28:03 +03:00
parent 19735d340d
commit dcb98f8ffe

View File

@ -161,6 +161,10 @@ const GamePage: FunctionComponent<{
if (!game || isSpectator || !userKey) { if (!game || isSpectator || !userKey) {
return; return;
} }
if(game.mancalaGame.state === "ended") {
notyf.error(context.texts.GameEnded);
return;
}
if (Util.checkConnectionAndMaybeAlert(context)) return; if (Util.checkConnectionAndMaybeAlert(context)) return;
if (game.mancalaGame.getPlayerIdByIndex(index) !== userKey) { if (game.mancalaGame.getPlayerIdByIndex(index) !== userKey) {
notyf.error(context.texts.UCanOnlyPlayYourOwnPits); notyf.error(context.texts.UCanOnlyPlayYourOwnPits);