From 712b2bc47347786c59074d38701b33b3860a7ed8 Mon Sep 17 00:00:00 2001 From: Evan Date: Tue, 12 May 2026 07:44:44 -0700 Subject: [PATCH] Show bonus amount on currency packs (#3907) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Show bonus amount on currency packs - Add `bonusAmount` field to `PackSchema` (non-negative int) - Render a rotated green corner ribbon (`+X FREE!`) on pack tiles when `bonusAmount > 0` - Add `cosmetics.free` translation key with `numFree` param Screenshot 2026-05-12 at 7 40 12 AM Describe the PR. - [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 regression is found: evan --- resources/lang/en.json | 3 ++- src/client/components/CosmeticButton.ts | 11 ++++++++++- src/core/CosmeticSchemas.ts | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/resources/lang/en.json b/resources/lang/en.json index 9c534a0bb..1107a5e47 100644 --- a/resources/lang/en.json +++ b/resources/lang/en.json @@ -1271,7 +1271,8 @@ "adfree": "ad-free for life!", "hard": "Plutonium", "soft": "Caps", - "per_day": "/day" + "per_day": "/day", + "free": "+{numFree} BONUS!" }, "flag_input": { "title": "Select Flag", diff --git a/src/client/components/CosmeticButton.ts b/src/client/components/CosmeticButton.ts index 84fce3d23..039bb0fbc 100644 --- a/src/client/components/CosmeticButton.ts +++ b/src/client/components/CosmeticButton.ts @@ -112,7 +112,7 @@ export class CosmeticButton extends LitElement { const colorClass = isHard ? "text-green-400" : "text-amber-700"; const currencyKey = isHard ? "cosmetics.hard" : "cosmetics.soft"; return html`
${icon} ${translateText(currencyKey)} + ${pack.bonusAmount > 0 + ? html`
+ ${translateText("cosmetics.free", { + numFree: pack.bonusAmount.toLocaleString(), + })} +
` + : nothing}
`; } diff --git a/src/core/CosmeticSchemas.ts b/src/core/CosmeticSchemas.ts index 7b6c66f5c..704fc61a3 100644 --- a/src/core/CosmeticSchemas.ts +++ b/src/core/CosmeticSchemas.ts @@ -89,6 +89,7 @@ export const PackSchema = CosmeticSchema.extend({ displayName: z.string(), currency: z.enum(["hard", "soft"]), amount: z.number().int().positive(), + bonusAmount: z.number().int().nonnegative(), }); export const SubscriptionSchema = CosmeticSchema.extend({