diff --git a/src/client/AccountModal.ts b/src/client/AccountModal.ts
index ab57c70b89..8f5b05dda3 100644
--- a/src/client/AccountModal.ts
+++ b/src/client/AccountModal.ts
@@ -64,71 +64,43 @@ export class AccountModal extends BaseModal {
);
}
- render() {
- const content = this.isLoadingUser
- ? this.renderLoadingSpinner(
- translateText("account_modal.fetching_account"),
- )
- : this.renderInner();
-
- if (this.inline) {
- return this.isLoadingUser
- ? html`
- ${modalHeader({
- title: translateText("account_modal.title"),
- onBack: () => this.close(),
- ariaLabel: translateText("common.back"),
- })}
- ${content}
-
`
- : content;
- }
-
- return html`
-
- ${modalHeader({
- title,
- onBack: () => this.close(),
- ariaLabel: translateText("common.back"),
- rightContent: isLoggedIn
- ? html`
-
- ${translateText("account_modal.public_player_id")}
-
-
- `
- : undefined,
- })}
-
-
- ${isLoggedIn ? this.renderAccountInfo() : this.renderLoginOptions()}
-
+
+ ${isLoggedIn ? this.renderAccountInfo() : this.renderLoginOptions()}
`;
}
diff --git a/src/client/ClanModal.ts b/src/client/ClanModal.ts
index 1aebed5dd2..66f7361a00 100644
--- a/src/client/ClanModal.ts
+++ b/src/client/ClanModal.ts
@@ -18,7 +18,6 @@ import "./components/CopyButton";
import { modalHeader } from "./components/ui/ModalHeader";
import { translateText } from "./Utils";
-type Tab = "my-clans" | "browse";
type View =
| "list"
| "detail"
@@ -30,7 +29,6 @@ type View =
@customElement("clan-modal")
export class ClanModal extends BaseModal {
- @state() private activeTab: Tab = "my-clans";
@state() private view: View = "list";
@state() private loading = false;
@@ -59,36 +57,42 @@ export class ClanModal extends BaseModal {
stats: ClanStats | null;
} | null = null;
- render() {
- const onListView = this.view === "list" && !this.selectedClanTag;
- const tabs = onListView
- ? [
- { key: "my-clans", label: translateText("clan_modal.my_clans") },
- { key: "browse", label: translateText("clan_modal.browse") },
- ]
- : [];
- const header = onListView
+ private get onListView(): boolean {
+ return this.view === "list" && !this.selectedClanTag;
+ }
+
+ protected modalConfig() {
+ return {
+ tabs: this.onListView
+ ? [
+ { key: "my-clans", label: translateText("clan_modal.my_clans") },
+ { key: "browse", label: translateText("clan_modal.browse") },
+ ]
+ : [],
+ };
+ }
+
+ protected renderHeaderSlot() {
+ return this.onListView
? modalHeader({
title: translateText("clan_modal.title"),
onBack: () => this.close(),
ariaLabel: translateText("common.back"),
})
: this.renderSubViewHeader();
- return html`
-
this.handleTabChange(key as Tab)}
- >
- ${header ? html`${header}
` : ""}
- ${this.renderInner()}
-
- `;
+ }
+
+ protected renderBody() {
+ return html`
${this.renderInner()}
`;
+ }
+
+ protected onTabEnter(tab: string): void {
+ this.view = "list";
+ this.selectedClan = null;
+ this.selectedClanTag = "";
+ if (tab === "my-clans") {
+ this.loadMyClans();
+ }
}
private tagPill(tag: string) {
@@ -152,16 +156,6 @@ export class ClanModal extends BaseModal {
});
}
- private handleTabChange(tab: Tab) {
- this.activeTab = tab;
- this.view = "list";
- this.selectedClan = null;
- this.selectedClanTag = "";
- if (tab === "my-clans") {
- this.loadMyClans();
- }
- }
-
protected onOpen(): void {
this.loadMyClans();
}
diff --git a/src/client/FlagInputModal.ts b/src/client/FlagInputModal.ts
index 7d33a2240a..8c7210cc69 100644
--- a/src/client/FlagInputModal.ts
+++ b/src/client/FlagInputModal.ts
@@ -122,67 +122,49 @@ export class FlagInputModal extends BaseModal {
`;
}
- render() {
- const content = html`
-
-
- ${modalHeader({
- title: translateText("flag_input.title"),
- onBack: () => this.close(),
- ariaLabel: translateText("common.back"),
- rightContent: html`
`,
- })}
-
-
-
+ ${modalHeader({
+ title: translateText("flag_input.title"),
+ onBack: () => this.close(),
+ ariaLabel: translateText("common.back"),
+ rightContent: html`
`,
+ })}
+
+
+
-
-
-
- {
- this.close();
- window.showPage?.("page-item-store");
- }}
- >
-
-
-
- ${this.renderFlags()}
+ type="text"
+ placeholder=${translateText("flag_input.search_flag")}
+ .value=${this.search}
+ @change=${this.handleSearch}
+ @keyup=${this.handleSearch}
+ />
`;
+ }
- if (this.inline) {
- return content;
- }
-
+ protected renderBody() {
return html`
-
- ${content}
-
+
+ {
+ this.close();
+ window.showPage?.("page-item-store");
+ }}
+ >
+
+
${this.renderFlags()}
`;
}
diff --git a/src/client/HelpModal.ts b/src/client/HelpModal.ts
index ab2e0d943f..f6af03dbe7 100644
--- a/src/client/HelpModal.ts
+++ b/src/client/HelpModal.ts
@@ -57,28 +57,28 @@ export class HelpModal extends BaseModal {
>`;
}
- render() {
- const keybinds = this.keybinds;
+ protected renderHeaderSlot() {
+ return modalHeader({
+ title: translateText("main.help"),
+ onBack: () => this.close(),
+ ariaLabel: translateText("common.back"),
+ });
+ }
- const content = html`
-
- ${modalHeader({
- title: translateText("main.help"),
- onBack: () => this.close(),
- ariaLabel: translateText("common.back"),
- })}
+ protected renderBody() {
+ const keybinds = this.keybinds;
-
+ return html`
+
@@ -1228,22 +1228,6 @@ export class HelpModal extends BaseModal {
`;
-
- if (this.inline) {
- return content;
- }
-
- return html`
-
- ${content}
-
- `;
}
openTroubleshooting() {
diff --git a/src/client/HostLobbyModal.ts b/src/client/HostLobbyModal.ts
index aad4fde6cf..5b683ba568 100644
--- a/src/client/HostLobbyModal.ts
+++ b/src/client/HostLobbyModal.ts
@@ -150,7 +150,25 @@ export class HostLobbyModal extends BaseModal {
this.eventBus?.off(LobbyInfoEvent, this.handleLobbyInfo);
}
- render() {
+ protected renderHeaderSlot() {
+ return modalHeader({
+ title: translateText("host_modal.title"),
+ onBack: () => {
+ this.leaveLobbyOnClose = true;
+ this.close();
+ },
+ ariaLabel: translateText("common.back"),
+ rightContent: html`
+
+ `,
+ });
+ }
+
+ protected renderBody() {
const inputCards = [
html`
`,
];
- const content = html`
-
-
- ${modalHeader({
- title: translateText("host_modal.title"),
- onBack: () => {
- this.leaveLobbyOnClose = true;
- this.close();
- },
- ariaLabel: translateText("common.back"),
- rightContent: html`
-
- `,
- })}
-
-