Show 3 patterns at death screen, remove ads (#1971)

## Description:

Show 3 purchasable patterns on the death screen (1 on mobile still)
Also remove death screen ads since they would take up too much space
<img width="743" height="517" alt="Screenshot 2025-08-29 at 8 04 41 PM"
src="https://github.com/user-attachments/assets/3f9a32e4-2a69-478e-8458-6a1ae193b0b3"
/>

## 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
This commit is contained in:
evanpelle
2025-08-29 20:08:37 -07:00
committed by GitHub
parent c79af121a8
commit fae4bb9f96
+22 -14
View File
@@ -9,7 +9,6 @@ import "../../components/PatternButton";
import { fetchPatterns, handlePurchase } from "../../Cosmetics";
import { getUserMe } from "../../jwt";
import { SendWinnerEvent } from "../../Transport";
import { GutterAdModalEvent } from "./GutterAdModal";
import { Layer } from "./Layer";
@customElement("win-modal")
@@ -43,7 +42,7 @@ export class WinModal extends LitElement implements Layer {
return html`
<div
class="${this.isVisible
? "fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-gray-800/70 p-6 rounded-lg z-[9999] shadow-2xl backdrop-blur-sm text-white w-[350px] max-w-[90%] md:max-w-[350px] animate-fadeIn"
? "fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-gray-800/70 p-6 rounded-lg z-[9999] shadow-2xl backdrop-blur-sm text-white w-[350px] max-w-[90%] md:w-[700px] md:max-w-[700px] animate-fadeIn"
: "hidden"}"
>
<h2 class="m-0 mb-4 text-[26px] text-center text-white">
@@ -120,14 +119,27 @@ export class WinModal extends LitElement implements Layer {
return;
}
const pattern = purchasable[Math.floor(Math.random() * purchasable.length)];
// Shuffle the array and take patterns based on screen size
const shuffled = [...purchasable].sort(() => Math.random() - 0.5);
const isMobile = window.innerWidth < 768; // md breakpoint
const maxPatterns = isMobile ? 1 : 3;
const selectedPatterns = shuffled.slice(
0,
Math.min(maxPatterns, shuffled.length),
);
this.patternContent = html`
<pattern-button
.pattern=${pattern}
.onSelect=${(p: Pattern | null) => {}}
.onPurchase=${(p: Pattern) => handlePurchase(p)}
></pattern-button>
<div class="flex gap-4 flex-wrap justify-start">
${selectedPatterns.map(
(pattern) => html`
<pattern-button
.pattern=${pattern}
.onSelect=${(p: Pattern | null) => {}}
.onPurchase=${(p: Pattern) => handlePurchase(p)}
></pattern-button>
`,
)}
</div>
`;
}
@@ -146,11 +158,8 @@ export class WinModal extends LitElement implements Layer {
async show() {
await this.loadPatternContent();
this.eventBus.emit(new GutterAdModalEvent(true));
setTimeout(() => {
this.isVisible = true;
this.requestUpdate();
}, 1500);
this.isVisible = true;
this.requestUpdate();
setTimeout(() => {
this.showButtons = true;
this.requestUpdate();
@@ -158,7 +167,6 @@ export class WinModal extends LitElement implements Layer {
}
hide() {
this.eventBus.emit(new GutterAdModalEvent(false));
this.isVisible = false;
this.showButtons = false;
this.requestUpdate();