diff --git a/resources/lang/en.json b/resources/lang/en.json index 9a226b7e0..05c6f7888 100644 --- a/resources/lang/en.json +++ b/resources/lang/en.json @@ -1310,7 +1310,6 @@ }, "store": { "already_subscribed": "Already subscribed.", - "buy_for": "Buy for {price}", "change_tier_failed": "Couldn't update your subscription. Please try again.", "change_tier_success": "Switched to {tier}.", "checkout_failed": "Failed to create checkout session.", @@ -1319,7 +1318,7 @@ "confirm_purchase_title": "Confirm Purchase", "confirm_upgrade": "Upgrade to {tier}? You'll be charged the prorated difference now.", "currency_pack_purchase_success": "Currency pack purchase successful!", - "custom_amount": "Custom Amount", + "custom_amount": "Choose Amount", "custom_currency_purchase_success": "Plutonium purchase successful!", "effects": "Effects", "flags": "Flags", @@ -1332,6 +1331,7 @@ "no_subscriptions": "No subscriptions available. Check back later for new items.", "packs": "Packs", "patterns": "Skins", + "plutonium_amount": "Plutonium amount", "price_per_month": "/mo", "purchase_currency": "Purchase {currency}", "purchase_failed": "Purchase failed. Please try again.", diff --git a/src/client/components/CustomCurrencyCard.ts b/src/client/components/CustomCurrencyCard.ts index 10412dfab..7e6e533eb 100644 --- a/src/client/components/CustomCurrencyCard.ts +++ b/src/client/components/CustomCurrencyCard.ts @@ -2,7 +2,9 @@ import { html, LitElement } from "lit"; import { customElement, state } from "lit/decorators.js"; import { createCustomCurrencyCheckout } from "../Api"; import { translateText } from "../Utils"; +import "./CosmeticContainer"; import "./PlutoniumIcon"; +import "./PurchaseButton"; // Fixed rate: 20 plutonium = $1.00 (5 cents each). Bounds and rate are // enforced server-side; these are for UX only. @@ -13,7 +15,6 @@ const MAX_PLUTONIUM = 2000; export class CustomCurrencyCard extends LitElement { /** Always a clamped integer in [MIN_PLUTONIUM, MAX_PLUTONIUM]. */ @state() private amount = 100; - @state() private busy = false; createRenderRoot() { return this; @@ -36,73 +37,61 @@ export class CustomCurrencyCard extends LitElement { this.amount = this.clamp(Number((e.target as HTMLInputElement).value)); } - private async buy() { - if (this.busy) return; - this.busy = true; - try { - const url = await createCustomCurrencyCheckout(this.amount); - if (url === false) { - alert(translateText("store.checkout_failed")); - return; - } - window.location.href = url; - } finally { - this.busy = false; + private buy = async () => { + const url = await createCustomCurrencyCheckout(this.amount); + if (url === false) { + alert(translateText("store.checkout_failed")); + return; } - } + window.location.href = url; + }; render() { const price = `$${this.priceDollars}`; return html` -