mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-12-28 02:48:43 +08:00
disconect on tribe leave
This commit is contained in:
parent
53a3e7cdc6
commit
5bf8f5ecf7
2 changed files with 12 additions and 1 deletions
|
|
@ -4,6 +4,8 @@ import * as TribeState from "../tribe/tribe-state";
|
|||
import * as TribeChat from "../tribe/tribe-chat";
|
||||
import { qsr } from "../utils/dom";
|
||||
import { CLIENT_STATE } from "../tribe/types";
|
||||
import tribeSocket from "../tribe/tribe-socket";
|
||||
import * as TribePagePreloader from "../tribe/pages/tribe-page-preloader";
|
||||
|
||||
export const page = new Page({
|
||||
id: "tribe",
|
||||
|
|
@ -15,6 +17,8 @@ export const page = new Page({
|
|||
afterHide: async () => {
|
||||
// TODO: Fill it up later
|
||||
TribeChat.reset("lobby");
|
||||
tribeSocket.disconnect();
|
||||
TribePagePreloader.reset();
|
||||
},
|
||||
beforeShow: async () => {
|
||||
if (TribeState.isInARoom()) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
export function updateIcon(iconName: string, spinning = false): void {
|
||||
$(".pageTribe .tribePage.preloader .icon").html(
|
||||
`<i class="fas fa-fw fa-${iconName} ${spinning ? "fa-spin" : ""}"></i>`
|
||||
`<i class="fas fa-fw fa-${iconName} ${spinning ? "fa-spin" : ""}"></i>`,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -27,3 +27,10 @@ export function showReconnectButton(): void {
|
|||
export function hideReconnectButton(): void {
|
||||
$(".pageTribe .tribePage.preloader .reconnectButton").addClass(`hidden`);
|
||||
}
|
||||
|
||||
export function reset(): void {
|
||||
updateIcon("circle-notch", true);
|
||||
updateText("Connecting to Tribe");
|
||||
updateSubtext("Please wait...");
|
||||
hideReconnectButton();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue