diff --git a/frontend/src/ts/popups/tribe-start-race-popup.ts b/frontend/src/ts/popups/tribe-start-race-popup.ts deleted file mode 100644 index d190b4b9a..000000000 --- a/frontend/src/ts/popups/tribe-start-race-popup.ts +++ /dev/null @@ -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(); - } -}); diff --git a/frontend/src/ts/tribe/tribe.ts b/frontend/src/ts/tribe/tribe.ts index a83c1ca7d..c013950ff 100644 --- a/frontend/src/ts/tribe/tribe.ts +++ b/frontend/src/ts/tribe/tribe.ts @@ -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, + }; + }, +});