mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-12-29 11:26:13 +08:00
added functions for showing and hiding leave queue button
This commit is contained in:
parent
65ca667ca0
commit
83c9815687
2 changed files with 15 additions and 16 deletions
|
|
@ -25,9 +25,6 @@ export function resetBanner() {
|
|||
export function disableLobbyButtons() {
|
||||
$(".pageTribe .prelobby .matchmaking .buttons .button").addClass("disabled");
|
||||
$(".pageTribe .prelobby .privateRooms .button").addClass("disabled");
|
||||
$(".pageTribe .prelobby .matchmaking .leaveMatchmakingButton").removeClass(
|
||||
"hidden"
|
||||
);
|
||||
}
|
||||
|
||||
export function enableLobbyButtons() {
|
||||
|
|
@ -35,6 +32,15 @@ export function enableLobbyButtons() {
|
|||
"disabled"
|
||||
);
|
||||
$(".pageTribe .prelobby .privateRooms .button").removeClass("disabled");
|
||||
}
|
||||
|
||||
export function showLeaveQueueButton() {
|
||||
$(".pageTribe .prelobby .matchmaking .leaveMatchmakingButton").removeClass(
|
||||
"hidden"
|
||||
);
|
||||
}
|
||||
|
||||
export function hideLeaveQueueButton() {
|
||||
$(".pageTribe .prelobby .matchmaking .leaveMatchmakingButton").addClass(
|
||||
"hidden"
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1142,6 +1142,7 @@ socket.on("mp_room_leave", () => {
|
|||
resetLobby();
|
||||
resetRace();
|
||||
Matchmaking.enableLobbyButtons();
|
||||
Matchmaking.hideLeaveQueueButton();
|
||||
Matchmaking.hideBanner();
|
||||
// swapElements($(".pageTribe .lobby"), $(".pageTribe .prelobby"), 250);
|
||||
});
|
||||
|
|
@ -1504,9 +1505,7 @@ socket.on("mp_room_state_update", (data) => {
|
|||
state = data.newState;
|
||||
Notifications.add(`state changed to ${data.newState}`, 0);
|
||||
if (data.newState === 8) {
|
||||
$(".pageTribe .prelobby .matchmaking .leaveMatchmakingButton").addClass(
|
||||
"hidden"
|
||||
);
|
||||
Matchmaking.hideLeaveQueueButton();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -1980,12 +1979,9 @@ $(".pageTribe .prelobby .matchmaking .button").click((e) => {
|
|||
state = 6;
|
||||
lastQueue = queue;
|
||||
applyRoomConfig(TribeDefaultConfigs[queue]);
|
||||
$(".pageTribe .prelobby .matchmaking .buttons .button").addClass("disabled");
|
||||
$(".pageTribe .prelobby .privateRooms .button").addClass("disabled");
|
||||
Matchmaking.disableLobbyButtons();
|
||||
setTimeout(() => {
|
||||
$(".pageTribe .prelobby .matchmaking .leaveMatchmakingButton").removeClass(
|
||||
"hidden"
|
||||
);
|
||||
Matchmaking.showLeaveQueueButton();
|
||||
socket.emit("mp_room_join", { queue: queue });
|
||||
}, 1000);
|
||||
});
|
||||
|
|
@ -1999,13 +1995,10 @@ $(".pageTest #result #queueAgainButton").click((e) => {
|
|||
state = 6;
|
||||
applyRoomConfig(TribeDefaultConfigs[lastQueue]);
|
||||
TestLogic.restart();
|
||||
$(".pageTribe .prelobby .matchmaking .buttons .button").addClass("disabled");
|
||||
$(".pageTribe .prelobby .privateRooms .button").addClass("disabled");
|
||||
Matchmaking.disableLobbyButtons();
|
||||
setTimeout(() => {
|
||||
socket.emit("mp_room_join", { queue: lastQueue });
|
||||
$(".pageTribe .prelobby .matchmaking .leaveMatchmakingButton").removeClass(
|
||||
"hidden"
|
||||
);
|
||||
Matchmaking.showLeaveQueueButton();
|
||||
resetResult();
|
||||
}, 1000);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue