add leave game dialog
This commit is contained in:
parent
9ea7ecfe93
commit
886852611b
@ -32,6 +32,9 @@ export type Texts = {
|
|||||||
UCanOnlyPlayYourOwnPits: string,
|
UCanOnlyPlayYourOwnPits: string,
|
||||||
UMustWaitUntilCurrentMoveComplete: string,
|
UMustWaitUntilCurrentMoveComplete: string,
|
||||||
UCanNotPlayEmptyPit: string,
|
UCanNotPlayEmptyPit: string,
|
||||||
|
AreYouSureToLeaveGame: string,
|
||||||
|
Yes: string,
|
||||||
|
Cancel: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const EnUs: Texts = {
|
export const EnUs: Texts = {
|
||||||
@ -67,7 +70,9 @@ export const EnUs: Texts = {
|
|||||||
UCanOnlyPlayYourOwnPits: "You can only play your own pits",
|
UCanOnlyPlayYourOwnPits: "You can only play your own pits",
|
||||||
UMustWaitUntilCurrentMoveComplete: "You must wait until the current move is complete",
|
UMustWaitUntilCurrentMoveComplete: "You must wait until the current move is complete",
|
||||||
UCanNotPlayEmptyPit: "You can not play empty pit",
|
UCanNotPlayEmptyPit: "You can not play empty pit",
|
||||||
|
AreYouSureToLeaveGame: "Are you sure to leave game?",
|
||||||
|
Yes: "Yes",
|
||||||
|
Cancel: "Cancel",
|
||||||
}
|
}
|
||||||
|
|
||||||
export const TrTr: Texts = {
|
export const TrTr: Texts = {
|
||||||
@ -103,4 +108,7 @@ export const TrTr: Texts = {
|
|||||||
UCanOnlyPlayYourOwnPits: "Sadece sana ait olan kuyular ile oynayabilirsin",
|
UCanOnlyPlayYourOwnPits: "Sadece sana ait olan kuyular ile oynayabilirsin",
|
||||||
UMustWaitUntilCurrentMoveComplete: "Devam eden haraketin bitmesini beklemelisin",
|
UMustWaitUntilCurrentMoveComplete: "Devam eden haraketin bitmesini beklemelisin",
|
||||||
UCanNotPlayEmptyPit: "Boş kuyu ile oynayamazsın",
|
UCanNotPlayEmptyPit: "Boş kuyu ile oynayamazsın",
|
||||||
|
AreYouSureToLeaveGame: "Oyundan ayrılmak istediğine emin misin?",
|
||||||
|
Yes: "Evet",
|
||||||
|
Cancel: "İptal"
|
||||||
}
|
}
|
||||||
@ -29,6 +29,7 @@ import BoardViewModel from '../viewmodel/BoardViewModel';
|
|||||||
import Center from '../components/Center';
|
import Center from '../components/Center';
|
||||||
import { Game, GameUsersConnectionInfo } from '../models/Game';
|
import { Game, GameUsersConnectionInfo } from '../models/Game';
|
||||||
import notyf from '../util/Notyf';
|
import notyf from '../util/Notyf';
|
||||||
|
import swal from 'sweetalert';
|
||||||
|
|
||||||
const GamePage: FunctionComponent<{
|
const GamePage: FunctionComponent<{
|
||||||
context: Context,
|
context: Context,
|
||||||
@ -138,7 +139,17 @@ const GamePage: FunctionComponent<{
|
|||||||
const checkHasAnOngoingAction = () => hasOngoingAction;
|
const checkHasAnOngoingAction = () => hasOngoingAction;
|
||||||
|
|
||||||
const onLeaveGameClick = () => {
|
const onLeaveGameClick = () => {
|
||||||
|
swal({
|
||||||
|
title: context.texts.AreYouSureToLeaveGame,
|
||||||
|
icon: "warning",
|
||||||
|
buttons: [context.texts.Yes, context.texts.Cancel],
|
||||||
|
dangerMode: true,
|
||||||
|
})
|
||||||
|
.then((cancel) => {
|
||||||
|
if (!cancel) {
|
||||||
context.rtmt.sendMessage(channel_leave_game, {});
|
context.rtmt.sendMessage(channel_leave_game, {});
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const onNewGameClick = () => {
|
const onNewGameClick = () => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user