replace modal with simple modal

This commit is contained in:
Miodec 2026-01-03 17:44:02 +01:00
parent 88f0a4f9d7
commit e4f5d8f4d9
2 changed files with 17 additions and 54 deletions

View file

@ -1,52 +0,0 @@
import tribeSocket from "../tribe/tribe-socket";
export function show(): void {
if ($("#tribeStartRacePopupWrapper").hasClass("hidden")) {
$("#tribeStartRacePopupWrapper")
.stop(true, true)
.css("opacity", 0)
.removeClass("hidden")
.animate({ opacity: 1 }, 125, () => {
/* noop */
});
}
}
export function hide(): void {
if (!$("#tribeStartRacePopupWrapper").hasClass("hidden")) {
$("#tribeStartRacePopupWrapper")
.stop(true, true)
.css("opacity", 1)
.animate(
{
opacity: 0,
},
100,
() => {
$("#tribeStartRacePopupWrapper").addClass("hidden");
},
);
}
}
$("#tribeStartRacePopupWrapper").on("click", (e) => {
if ($(e.target).attr("id") === "tribeStartRacePopupWrapper") {
hide();
}
});
$("#tribeStartRacePopup .button").on("click", () => {
tribeSocket.out.room.initRace();
hide();
});
$(document).on("keypress", (e) => {
if (
e.key === "Enter" &&
!$("#tribeStartRacePopupWrapper").hasClass("hidden")
) {
tribeSocket.out.room.initRace();
hide();
e.preventDefault();
}
});

View file

@ -14,7 +14,6 @@ import * as TribeBars from "./tribe-bars";
import * as TribeResults from "./tribe-results";
import * as TribeUserList from "./tribe-user-list";
import * as TribeButtons from "./tribe-buttons";
import * as TribeStartRacePopup from "../popups/tribe-start-race-popup";
import * as TribeChartController from "./tribe-chart-controller";
import * as TribeDelta from "./tribe-delta";
import * as TestState from "../test/test-state";
@ -206,7 +205,8 @@ export function initRace(): void {
if (everyoneReady) {
TribeSocket.out.room.init();
} else {
TribeStartRacePopup.show();
// TribeStartRacePopup.show();
startRaceModal.show([], {});
}
}
@ -868,3 +868,18 @@ const enterRoomCodeModal = new SimpleModal({
};
},
});
const startRaceModal = new SimpleModal({
id: "tribeStartRaceModal",
title: "Are you sure?",
buttonText: "Start",
text: "Not everyone is ready. Do you want to start the test without them?",
execFn: async (_thisPopup) => {
TribeSocket.out.room.init();
return {
status: 1,
message: "",
showNotification: false,
};
},
});