Skip to content

Commit d809c25

Browse files
committed
bugfix: Make territory patterns modal inline page like flag input modal
1 parent dbba1dc commit d809c25

2 files changed

Lines changed: 23 additions & 25 deletions

File tree

index.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,11 @@
245245
inline
246246
class="hidden w-full h-full page-content relative z-50"
247247
></flag-input-modal>
248+
<territory-patterns-modal
249+
id="territory-patterns-modal"
250+
inline
251+
class="hidden w-full h-full page-content relative z-50"
252+
></territory-patterns-modal>
248253
<ranked-modal
249254
id="page-ranked"
250255
inline
@@ -259,9 +264,6 @@
259264
</div>
260265

261266
<!-- Global Modals -->
262-
<territory-patterns-modal
263-
id="territory-patterns-modal"
264-
></territory-patterns-modal>
265267
</div>
266268

267269
<!-- Game components -->

src/client/TerritoryPatternsModal.ts

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export class TerritoryPatternsModal extends BaseModal {
2525

2626
private cosmetics: Cosmetics | null = null;
2727
private userSettings: UserSettings = new UserSettings();
28-
private isActive = false;
2928
private userMeResponse: UserMeResponse | false = false;
3029

3130
private _onPatternSelected = async () => {
@@ -137,21 +136,25 @@ export class TerritoryPatternsModal extends BaseModal {
137136
}
138137

139138
render() {
140-
if (!this.isActive && !this.inline) return html``;
141-
142139
const content = html`
143140
<div class="${this.modalContainerClass}">
144-
${modalHeader({
145-
title: translateText("territory_patterns.title"),
146-
onBack: () => this.close(),
147-
ariaLabel: translateText("common.back"),
148-
rightContent: !hasLinkedAccount(this.userMeResponse)
149-
? html`<div class="flex items-center">
150-
${this.renderNotLoggedInWarning()}
151-
</div>`
152-
: undefined,
153-
})}
154-
<div class="overflow-y-auto pr-2 custom-scrollbar mr-1">
141+
<div
142+
class="relative flex flex-col border-b border-white/10 pb-4 shrink-0"
143+
>
144+
${modalHeader({
145+
title: translateText("territory_patterns.title"),
146+
onBack: () => this.close(),
147+
ariaLabel: translateText("common.back"),
148+
rightContent: !hasLinkedAccount(this.userMeResponse)
149+
? html`<div class="flex items-center">
150+
${this.renderNotLoggedInWarning()}
151+
</div>`
152+
: undefined,
153+
})}
154+
</div>
155+
<div
156+
class="flex-1 overflow-y-auto px-3 pb-3 scrollbar-thin scrollbar-thumb-white/20 scrollbar-track-transparent mr-1"
157+
>
155158
${this.renderPatternGrid()}
156159
</div>
157160
</div>
@@ -174,15 +177,8 @@ export class TerritoryPatternsModal extends BaseModal {
174177
`;
175178
}
176179

177-
public async open() {
178-
this.isActive = true;
180+
protected async onOpen(): Promise<void> {
179181
await this.refresh();
180-
super.open();
181-
}
182-
183-
public close() {
184-
this.isActive = false;
185-
super.close();
186182
}
187183

188184
private selectPattern(pattern: PlayerPattern | null) {

0 commit comments

Comments
 (0)