From acd65e337130daab669d95527fc7b5a5f672a6a0 Mon Sep 17 00:00:00 2001 From: evanpelle Date: Mon, 1 Sep 2025 11:34:42 -0700 Subject: [PATCH] bugfix: hide account button and token modal login on game start (#1986) ## Description: The account button persisted after game starting ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: evan --- src/client/AccountModal.ts | 12 ++++++++++++ src/client/Main.ts | 2 ++ 2 files changed, 14 insertions(+) diff --git a/src/client/AccountModal.ts b/src/client/AccountModal.ts index 3e3c56e16..b55929222 100644 --- a/src/client/AccountModal.ts +++ b/src/client/AccountModal.ts @@ -235,6 +235,8 @@ export class AccountButton extends LitElement { @state() private loggedInEmail: string | null = null; @state() private loggedInDiscord: string | null = null; + private isVisible = true; + @query("account-modal") private recoveryModal: AccountModal; constructor() { @@ -266,6 +268,10 @@ export class AccountButton extends LitElement { } render() { + if (!this.isVisible) { + return html``; + } + let buttonTitle = ""; if (this.loggedInEmail) { buttonTitle = translateText("account_modal.logged_in_as", { @@ -313,4 +319,10 @@ export class AccountButton extends LitElement { private open() { this.recoveryModal?.open(); } + + public close() { + this.isVisible = false; + this.recoveryModal?.close(); + this.requestUpdate(); + } } diff --git a/src/client/Main.ts b/src/client/Main.ts index aa7d837d6..b79f04e6c 100644 --- a/src/client/Main.ts +++ b/src/client/Main.ts @@ -528,6 +528,8 @@ class Client { "language-modal", "news-modal", "flag-input-modal", + "account-button", + "token-login", ].forEach((tag) => { const modal = document.querySelector(tag) as HTMLElement & { close?: () => void;