diff --git a/packages/viewer/src/lib/ActionPanel.svelte b/packages/viewer/src/lib/ActionPanel.svelte index 15e1f1b..f950235 100644 --- a/packages/viewer/src/lib/ActionPanel.svelte +++ b/packages/viewer/src/lib/ActionPanel.svelte @@ -123,6 +123,14 @@ const price = (chain: ChainId) => sharePrice(chain, chainSize(game.board, chain)); const cost = $derived(Object.entries(shares).reduce((sum, [chain, n]) => sum + n * price(chain as ChainId), 0)); const total = $derived(Object.values(shares).reduce((sum, n) => sum + n, 0)); + const cash = $derived(seat === undefined ? 0 : game.seats[seat]!.cash); + /** Why one more share of `chain` cannot be added, beyond the shared purchase limit. */ + function buyBlocked(chain: ChainId): string | undefined { + if (total >= buyLimit || canBuy(moves, adjustShares(shares, chain, 1))) { + return undefined; + } + return game.bank[chain] - (shares[chain] ?? 0) <= 0 ? t("buy.soldOut") : t("buy.cantAfford"); + } function placeSelected(): void { if (store.selected !== undefined) { @@ -425,8 +433,23 @@ {#each buyable as chain (chain)} {@const fewer = adjustShares(shares, chain, -1)} {@const more = adjustShares(shares, chain, 1)} + {@const own = game.seats[seat!]!.shares[chain]} + {@const why = buyBlocked(chain)} - + + + {#if own > 0 || shares[chain]} + {t("buy.owned")} + {#if shares[chain]}{own}→{/if}{own + (shares[chain] ?? 0)} + {/if} + {#if why}{why}{/if} + {money(price(chain))} {game.bank[chain]} @@ -456,8 +479,9 @@ count: total, limit: buyLimit, cost: money(cost), - cash: money(game.seats[seat!]!.cash - cost), + cash: money(cash - cost), })} + {#if total >= buyLimit}{t("buy.limitReached", { limit: buyLimit })}{/if}

+ {max === 0 ? 0 : count} + + {#if max > 0}{t("swap.max", { count: max })}{/if} + {#if selected} +

+ + {t("swap.giveDetail", { + count: selected.count, + chain: chainName(from), + value: money(selected.count * priceOf(from)), + })} + + {t("swap.takeDetail", { + count: selected.count, + chain: chainName(to), + value: money(selected.count * priceOf(to)), + })} + {cash} +

+ {#if after} + + {/if} + {:else} +

{blocked}

+ {/if} selected && store.send(selected)} + >{selected + ? t("swap.confirmExact", { count: selected.count, from: chainName(from), to: chainName(to), cash }) + : t("swap.confirm")} {:else} -

{t("swap.unavailable")}

+

{remaining <= 0 ? t("swap.noneLeft") : t("swap.unavailable")}

{/if} @@ -103,13 +178,18 @@ summary { cursor: pointer; font-weight: 600; + min-height: 32px; } small, - .note { + .note, + .why { color: var(--ink-muted); font-size: 13px; font-weight: 400; } + .why { + font-style: italic; + } p { margin: 8px 0; } @@ -124,8 +204,7 @@ font-size: 13px; min-width: 0; } - select, - input { + select { box-sizing: border-box; width: 100%; min-height: 44px; @@ -136,26 +215,44 @@ padding: 6px; } .swap-controls { - display: flex; - align-items: end; - gap: 12px; - margin: 10px 0; - } - .swap-controls label { - flex: 0 0 72px; - } - .exchange { display: flex; flex-wrap: wrap; align-items: center; - gap: 6px; - min-width: 0; + gap: 4px 12px; + margin: 10px 0 4px; } - .exchange strong { - flex-basis: 100%; + .count-label { + font-size: 13px; + } + .stepper { + display: inline-flex; + align-items: center; + gap: 4px; + } + .stepper button { + width: 44px; + padding: 0; + font-size: 18px; + } + .value { + display: inline-block; + min-width: 24px; + text-align: center; + font-weight: 600; + font-variant-numeric: tabular-nums; + } + .exchange { + display: grid; + gap: 4px; + min-width: 0; font-size: 14px; font-variant-numeric: tabular-nums; } + .leg { + display: flex; + align-items: center; + gap: 6px; + } button { min-height: 44px; padding: 6px 12px; @@ -166,6 +263,10 @@ } button:disabled { color: var(--ink-muted); + background: transparent; + } + .confirm { + text-align: start; } @media (max-width: 400px) { .chains { diff --git a/packages/viewer/src/lib/locales/da.ts b/packages/viewer/src/lib/locales/da.ts index 25c612c..4dfe526 100644 --- a/packages/viewer/src/lib/locales/da.ts +++ b/packages/viewer/src/lib/locales/da.ts @@ -13,6 +13,18 @@ export const da: Catalog = { "swap.receive": "Modtag {amount}", "swap.even": "Ingen prisforskel", "swap.unavailable": "Intet bytte muligt med dette antal, grænsen, aktierne og kontanterne.", + "swap.optionGive": "{chain} · du har {count} · {price}", + "swap.optionTake": "{chain} · banken har {count} · {price}", + "swap.fewer": "Byt én færre", + "swap.more": "Byt én mere", + "swap.max": "op til {count}", + "swap.giveDetail": "afgiv {count} {chain} ({value})", + "swap.takeDetail": "få {count} {chain} ({value})", + "swap.after": "Efter dette bytte", + "swap.confirmExact": "Byt {count} {from} for {count} {to} · {cash}", + "swap.noneLeft": "Ingen bytter tilbage denne tur.", + "swap.bankEmpty": "Banken har ingen {chain}-aktier.", + "swap.cash": "Ikke penge nok til prisforskellen.", "log.swapped": "{name} bytter {count} {from} for {count} {to} · {cash}", loading: "Indlæser spillet…", @@ -99,6 +111,10 @@ export const da: Catalog = { "buy.total": "{count} af {limit} aktier · pris {cost} · tilbage {cash}", "buy.nothing": "Køb intet og afslut turen", "buy.confirm": "Køb for {cost} og afslut turen", + "buy.owned": "Du ejer", + "buy.soldOut": "Ingen tilbage i banken", + "buy.cantAfford": "Ikke penge nok til én mere", + "buy.limitReached": "Grænsen er nået: {limit} aktier pr. tur.", "board.label": "Spilleplade", "board.empty": "{tile} tom", "board.loose": "{tile} enlig brik", diff --git a/packages/viewer/src/lib/locales/de.ts b/packages/viewer/src/lib/locales/de.ts index b5ee6b2..87f1138 100644 --- a/packages/viewer/src/lib/locales/de.ts +++ b/packages/viewer/src/lib/locales/de.ts @@ -13,6 +13,18 @@ export const de: Catalog = { "swap.receive": "{amount} erhalten", "swap.even": "Keine Preisdifferenz", "swap.unavailable": "Mit dieser Menge, dem Limit, Aktienbestand und Bargeld ist kein Tausch möglich.", + "swap.optionGive": "{chain} · du hast {count} · {price}", + "swap.optionTake": "{chain} · Bank hat {count} · {price}", + "swap.fewer": "Eine weniger tauschen", + "swap.more": "Eine mehr tauschen", + "swap.max": "bis zu {count}", + "swap.giveDetail": "{count} {chain} abgeben ({value})", + "swap.takeDetail": "{count} {chain} erhalten ({value})", + "swap.after": "Nach diesem Tausch", + "swap.confirmExact": "{count} {from} gegen {count} {to} tauschen · {cash}", + "swap.noneLeft": "In diesem Zug sind keine Tausche mehr übrig.", + "swap.bankEmpty": "Die Bank hat keine {chain}-Aktien.", + "swap.cash": "Nicht genug Geld für die Preisdifferenz.", "log.swapped": "{name} tauscht {count} {from} gegen {count} {to} · {cash}", loading: "Spiel wird geladen…", @@ -99,6 +111,10 @@ export const de: Catalog = { "buy.total": "{count} von {limit} Aktien · Kosten {cost} · Restgeld {cash}", "buy.nothing": "Nichts kaufen und Zug beenden", "buy.confirm": "Für {cost} kaufen und Zug beenden", + "buy.owned": "Im Besitz", + "buy.soldOut": "Die Bank hat keine mehr", + "buy.cantAfford": "Nicht genug Geld für eine weitere", + "buy.limitReached": "Limit erreicht: {limit} Aktien pro Zug.", "board.label": "Spielplan", "board.empty": "{tile} leer", "board.loose": "{tile} einzelnes Plättchen", diff --git a/packages/viewer/src/lib/locales/el.ts b/packages/viewer/src/lib/locales/el.ts index 069c509..77c26e4 100644 --- a/packages/viewer/src/lib/locales/el.ts +++ b/packages/viewer/src/lib/locales/el.ts @@ -13,6 +13,18 @@ export const el: Catalog = { "swap.receive": "Είσπραξη {amount}", "swap.even": "Χωρίς διαφορά τιμής", "swap.unavailable": "Δεν γίνεται ανταλλαγή με αυτή την ποσότητα, το όριο, τις μετοχές και τα μετρητά.", + "swap.optionGive": "{chain} · έχεις {count} · {price}", + "swap.optionTake": "{chain} · τράπεζα {count} · {price}", + "swap.fewer": "Ανταλλαγή μίας λιγότερης", + "swap.more": "Ανταλλαγή μίας ακόμη", + "swap.max": "έως {count}", + "swap.giveDetail": "δίνεις {count} {chain} ({value})", + "swap.takeDetail": "παίρνεις {count} {chain} ({value})", + "swap.after": "Μετά από αυτή την ανταλλαγή", + "swap.confirmExact": "Ανταλλαγή {count} {from} με {count} {to} · {cash}", + "swap.noneLeft": "Δεν απομένουν ανταλλαγές σε αυτόν τον γύρο.", + "swap.bankEmpty": "Η τράπεζα δεν έχει μετοχές {chain}.", + "swap.cash": "Δεν φτάνουν τα μετρητά για τη διαφορά τιμής.", "log.swapped": "{name}: ανταλλαγή {count} {from} με {count} {to} · {cash}", loading: "Φόρτωση παιχνιδιού…", @@ -99,6 +111,10 @@ export const el: Catalog = { "buy.total": "{count} από {limit} μετοχές · κόστος {cost} · υπόλοιπο {cash}", "buy.nothing": "Καμία αγορά και τέλος γύρου", "buy.confirm": "Αγορά για {cost} και τέλος γύρου", + "buy.owned": "Έχεις", + "buy.soldOut": "Δεν έμειναν στην τράπεζα", + "buy.cantAfford": "Δεν φτάνουν τα μετρητά για άλλη", + "buy.limitReached": "Έφτασες το όριο: {limit} μετοχές ανά γύρο.", "board.label": "Ταμπλό", "board.empty": "{tile} κενό", "board.loose": "{tile} μεμονωμένο πλακίδιο", diff --git a/packages/viewer/src/lib/locales/en.ts b/packages/viewer/src/lib/locales/en.ts index b1878b8..c5ce813 100644 --- a/packages/viewer/src/lib/locales/en.ts +++ b/packages/viewer/src/lib/locales/en.ts @@ -14,6 +14,18 @@ export const en = { "swap.receive": "Receive {amount}", "swap.even": "No cash difference", "swap.unavailable": "No swap available with this quantity, allowance, stock and cash.", + "swap.optionGive": "{chain} · you have {count} · {price}", + "swap.optionTake": "{chain} · bank has {count} · {price}", + "swap.fewer": "Swap one fewer", + "swap.more": "Swap one more", + "swap.max": "up to {count}", + "swap.giveDetail": "give {count} {chain} ({value})", + "swap.takeDetail": "get {count} {chain} ({value})", + "swap.after": "After this swap", + "swap.confirmExact": "Swap {count} {from} for {count} {to} · {cash}", + "swap.noneLeft": "No swaps left this turn.", + "swap.bankEmpty": "The bank has no {chain} shares.", + "swap.cash": "Not enough cash to pay the price difference.", "log.swapped": "{name} swapped {count} {from} for {count} {to} · {cash}", loading: "Loading game…", @@ -104,6 +116,10 @@ export const en = { "buy.total": "{count} of {limit} shares · cost {cost} · cash left {cash}", "buy.nothing": "Buy nothing and end turn", "buy.confirm": "Buy for {cost} and end turn", + "buy.owned": "You own", + "buy.soldOut": "None left in the bank", + "buy.cantAfford": "Not enough cash for another", + "buy.limitReached": "Limit reached: {limit} shares per turn.", // Board and hand "board.label": "Board", diff --git a/packages/viewer/src/lib/locales/fa.ts b/packages/viewer/src/lib/locales/fa.ts index 4a3373a..a9a4f9b 100644 --- a/packages/viewer/src/lib/locales/fa.ts +++ b/packages/viewer/src/lib/locales/fa.ts @@ -13,6 +13,18 @@ export const fa: Catalog = { "swap.receive": "دریافت {amount}", "swap.even": "بدون اختلاف قیمت", "swap.unavailable": "با این تعداد، سقف تعویض، سهام و وجه نقد، تعویض ممکن نیست.", + "swap.optionGive": "{chain} · دارید {count} · {price}", + "swap.optionTake": "{chain} · بانک {count} · {price}", + "swap.fewer": "یکی کمتر تعویض کن", + "swap.more": "یکی بیشتر تعویض کن", + "swap.max": "تا {count}", + "swap.giveDetail": "واگذاری {count} {chain} ({value})", + "swap.takeDetail": "دریافت {count} {chain} ({value})", + "swap.after": "پس از این تعویض", + "swap.confirmExact": "تعویض {count} {from} با {count} {to} · {cash}", + "swap.noneLeft": "در این نوبت تعویضی باقی نمانده است.", + "swap.bankEmpty": "بانک سهم {chain} ندارد.", + "swap.cash": "پول برای پرداخت اختلاف قیمت کافی نیست.", "log.swapped": "{name} تعداد {count} سهم {from} را با {count} سهم {to} تعویض کرد · {cash}", loading: "در حال بارگذاری بازی…", @@ -99,6 +111,10 @@ export const fa: Catalog = { "buy.total": "{count} از {limit} سهم · هزینه {cost} · باقی‌مانده {cash}", "buy.nothing": "چیزی نخر و نوبت را تمام کن", "buy.confirm": "خرید به {cost} و پایان نوبت", + "buy.owned": "دارایی شما", + "buy.soldOut": "در بانک نمانده", + "buy.cantAfford": "پول برای یکی دیگر کافی نیست", + "buy.limitReached": "به سقف رسیدید: {limit} سهم در هر نوبت.", "board.label": "صفحه‌ی بازی", "board.empty": "{tile} خالی", "board.loose": "{tile} کاشی تنها", diff --git a/packages/viewer/src/lib/locales/fr.ts b/packages/viewer/src/lib/locales/fr.ts index 5205204..c0819bd 100644 --- a/packages/viewer/src/lib/locales/fr.ts +++ b/packages/viewer/src/lib/locales/fr.ts @@ -14,6 +14,18 @@ export const fr: Catalog = { "swap.receive": "Recevoir {amount}", "swap.even": "Sans différence de prix", "swap.unavailable": "Échange impossible avec cette quantité, la limite, les actions et les fonds disponibles.", + "swap.optionGive": "{chain} · vous en avez {count} · {price}", + "swap.optionTake": "{chain} · banque : {count} · {price}", + "swap.fewer": "Échanger une de moins", + "swap.more": "Échanger une de plus", + "swap.max": "jusqu’à {count}", + "swap.giveDetail": "donner {count} {chain} ({value})", + "swap.takeDetail": "recevoir {count} {chain} ({value})", + "swap.after": "Après cet échange", + "swap.confirmExact": "Échanger {count} {from} contre {count} {to} · {cash}", + "swap.noneLeft": "Plus aucun échange possible ce tour.", + "swap.bankEmpty": "La banque n’a pas d’actions {chain}.", + "swap.cash": "Pas assez d’argent pour payer la différence de prix.", "log.swapped": "{name} échange {count} {from} contre {count} {to} · {cash}", loading: "Chargement de la partie…", @@ -104,6 +116,10 @@ export const fr: Catalog = { "buy.total": "{count} actions sur {limit} · coût {cost} · argent restant {cash}", "buy.nothing": "Ne rien acheter et finir le tour", "buy.confirm": "Acheter pour {cost} et finir le tour", + "buy.owned": "Vous avez", + "buy.soldOut": "Plus aucune en banque", + "buy.cantAfford": "Pas assez d’argent pour une de plus", + "buy.limitReached": "Limite atteinte : {limit} actions par tour.", "board.label": "Plateau", "board.empty": "{tile} vide", "board.loose": "{tile} tuile isolée", diff --git a/packages/viewer/src/lib/locales/hi.ts b/packages/viewer/src/lib/locales/hi.ts index 699155d..f244e8a 100644 --- a/packages/viewer/src/lib/locales/hi.ts +++ b/packages/viewer/src/lib/locales/hi.ts @@ -13,6 +13,18 @@ export const hi: Catalog = { "swap.receive": "{amount} लें", "swap.even": "कीमत में कोई अंतर नहीं", "swap.unavailable": "इस मात्रा, सीमा, शेयरों और नकद के साथ अदला-बदली उपलब्ध नहीं है।", + "swap.optionGive": "{chain} · आपके पास {count} · {price}", + "swap.optionTake": "{chain} · बैंक में {count} · {price}", + "swap.fewer": "एक कम बदलें", + "swap.more": "एक और बदलें", + "swap.max": "{count} तक", + "swap.giveDetail": "{count} {chain} दें ({value})", + "swap.takeDetail": "{count} {chain} लें ({value})", + "swap.after": "इस अदला-बदली के बाद", + "swap.confirmExact": "{count} {from} के बदले {count} {to} लें · {cash}", + "swap.noneLeft": "इस बारी में कोई अदला-बदली बाकी नहीं।", + "swap.bankEmpty": "बैंक में {chain} के शेयर नहीं हैं।", + "swap.cash": "कीमत का अंतर चुकाने के लिए नकद पर्याप्त नहीं।", "log.swapped": "{name} ने {count} {from} के बदले {count} {to} लिए · {cash}", loading: "खेल लोड हो रहा है…", @@ -98,6 +110,10 @@ export const hi: Catalog = { "buy.total": "{limit} में से {count} शेयर · लागत {cost} · बची नकदी {cash}", "buy.nothing": "कुछ न खरीदें और बारी समाप्त करें", "buy.confirm": "{cost} में खरीदें और बारी समाप्त करें", + "buy.owned": "आपके पास", + "buy.soldOut": "बैंक में नहीं बचे", + "buy.cantAfford": "एक और के लिए नकद पर्याप्त नहीं", + "buy.limitReached": "सीमा पूरी: हर बारी में {limit} शेयर।", "board.label": "बोर्ड", "board.empty": "{tile} खाली", "board.loose": "{tile} अकेली टाइल", diff --git a/packages/viewer/src/lib/locales/it.ts b/packages/viewer/src/lib/locales/it.ts index d485f7c..7ce9a2f 100644 --- a/packages/viewer/src/lib/locales/it.ts +++ b/packages/viewer/src/lib/locales/it.ts @@ -13,6 +13,18 @@ export const it: Catalog = { "swap.receive": "Ricevi {amount}", "swap.even": "Nessuna differenza di prezzo", "swap.unavailable": "Scambio impossibile con questa quantità, il limite, le azioni e il denaro disponibili.", + "swap.optionGive": "{chain} · ne hai {count} · {price}", + "swap.optionTake": "{chain} · banca {count} · {price}", + "swap.fewer": "Scambia un’azione in meno", + "swap.more": "Scambia un’azione in più", + "swap.max": "fino a {count}", + "swap.giveDetail": "cedi {count} {chain} ({value})", + "swap.takeDetail": "ricevi {count} {chain} ({value})", + "swap.after": "Dopo questo scambio", + "swap.confirmExact": "Scambia {count} {from} con {count} {to} · {cash}", + "swap.noneLeft": "Nessuno scambio rimasto in questo turno.", + "swap.bankEmpty": "La banca non ha azioni {chain}.", + "swap.cash": "Denaro insufficiente per la differenza di prezzo.", "log.swapped": "{name} scambia {count} {from} con {count} {to} · {cash}", loading: "Caricamento della partita…", @@ -103,6 +115,10 @@ export const it: Catalog = { "buy.total": "{count} di {limit} azioni · costo {cost} · restano {cash}", "buy.nothing": "Non comprare nulla e termina il turno", "buy.confirm": "Compra per {cost} e termina il turno", + "buy.owned": "Possiedi", + "buy.soldOut": "Nessuna in banca", + "buy.cantAfford": "Denaro insufficiente per un’altra", + "buy.limitReached": "Limite raggiunto: {limit} azioni per turno.", "board.label": "Tabellone", "board.empty": "{tile} vuota", "board.loose": "{tile} tessera isolata", diff --git a/packages/viewer/src/lib/locales/ko.ts b/packages/viewer/src/lib/locales/ko.ts index a35a8c7..d9f07ce 100644 --- a/packages/viewer/src/lib/locales/ko.ts +++ b/packages/viewer/src/lib/locales/ko.ts @@ -13,6 +13,18 @@ export const ko: Catalog = { "swap.receive": "{amount} 수령", "swap.even": "차액 없음", "swap.unavailable": "이 수량, 교환 한도, 주식 및 현금으로는 교환할 수 없습니다.", + "swap.optionGive": "{chain} · 보유 {count} · {price}", + "swap.optionTake": "{chain} · 은행 {count} · {price}", + "swap.fewer": "한 주 덜 교환", + "swap.more": "한 주 더 교환", + "swap.max": "최대 {count}", + "swap.giveDetail": "{chain} {count}주 제공 ({value})", + "swap.takeDetail": "{chain} {count}주 수령 ({value})", + "swap.after": "이 교환 후", + "swap.confirmExact": "{from} {count}주를 {to} {count}주로 교환 · {cash}", + "swap.noneLeft": "이번 턴에 남은 교환이 없습니다.", + "swap.bankEmpty": "은행에 {chain} 주식이 없습니다.", + "swap.cash": "가격 차이를 낼 현금이 부족합니다.", "log.swapped": "{name}: {from} {count}주를 {to} {count}주로 교환 · {cash}", loading: "게임을 불러오는 중…", @@ -99,6 +111,10 @@ export const ko: Catalog = { "buy.total": "{limit}주 중 {count}주 · 비용 {cost} · 남는 돈 {cash}", "buy.nothing": "사지 않고 턴 끝내기", "buy.confirm": "{cost}에 사고 턴 끝내기", + "buy.owned": "보유", + "buy.soldOut": "은행에 남은 주식 없음", + "buy.cantAfford": "한 주 더 살 현금 부족", + "buy.limitReached": "한도 도달: 턴당 {limit}주.", "board.label": "게임판", "board.empty": "{tile} 빈칸", "board.loose": "{tile} 따로 놓인 타일", diff --git a/packages/viewer/src/lib/locales/nl.ts b/packages/viewer/src/lib/locales/nl.ts index 42187f2..069cb05 100644 --- a/packages/viewer/src/lib/locales/nl.ts +++ b/packages/viewer/src/lib/locales/nl.ts @@ -13,6 +13,18 @@ export const nl: Catalog = { "swap.receive": "Ontvang {amount}", "swap.even": "Geen prijsverschil", "swap.unavailable": "Geen ruil mogelijk met dit aantal, de limiet, aandelen en contanten.", + "swap.optionGive": "{chain} · je hebt {count} · {price}", + "swap.optionTake": "{chain} · bank heeft {count} · {price}", + "swap.fewer": "Eén minder ruilen", + "swap.more": "Eén meer ruilen", + "swap.max": "tot {count}", + "swap.giveDetail": "geef {count} {chain} ({value})", + "swap.takeDetail": "krijg {count} {chain} ({value})", + "swap.after": "Na deze ruil", + "swap.confirmExact": "Ruil {count} {from} voor {count} {to} · {cash}", + "swap.noneLeft": "Geen ruilen meer over deze beurt.", + "swap.bankEmpty": "De bank heeft geen {chain}-aandelen.", + "swap.cash": "Niet genoeg geld voor het prijsverschil.", "log.swapped": "{name} ruilt {count} {from} voor {count} {to} · {cash}", loading: "Spel laden…", @@ -99,6 +111,10 @@ export const nl: Catalog = { "buy.total": "{count} van {limit} aandelen · kosten {cost} · over {cash}", "buy.nothing": "Niets kopen en beurt beëindigen", "buy.confirm": "Kopen voor {cost} en beurt beëindigen", + "buy.owned": "Je hebt", + "buy.soldOut": "Geen meer in de bank", + "buy.cantAfford": "Niet genoeg geld voor nog één", + "buy.limitReached": "Limiet bereikt: {limit} aandelen per beurt.", "board.label": "Spelbord", "board.empty": "{tile} leeg", "board.loose": "{tile} losse tegel", diff --git a/packages/viewer/src/lib/locales/pl.ts b/packages/viewer/src/lib/locales/pl.ts index d95befd..a1680e3 100644 --- a/packages/viewer/src/lib/locales/pl.ts +++ b/packages/viewer/src/lib/locales/pl.ts @@ -13,6 +13,18 @@ export const pl: Catalog = { "swap.receive": "Otrzymaj {amount}", "swap.even": "Bez dopłaty", "swap.unavailable": "Wymiana niemożliwa przy tej liczbie, limicie, akcjach i gotówce.", + "swap.optionGive": "{chain} · masz {count} · {price}", + "swap.optionTake": "{chain} · w banku {count} · {price}", + "swap.fewer": "Wymień jedną mniej", + "swap.more": "Wymień jedną więcej", + "swap.max": "maks. {count}", + "swap.giveDetail": "oddaj {count} {chain} ({value})", + "swap.takeDetail": "otrzymaj {count} {chain} ({value})", + "swap.after": "Po tej wymianie", + "swap.confirmExact": "Wymień {count} {from} na {count} {to} · {cash}", + "swap.noneLeft": "W tej turze nie zostały już wymiany.", + "swap.bankEmpty": "Bank nie ma akcji {chain}.", + "swap.cash": "Za mało gotówki na pokrycie różnicy cen.", "log.swapped": "{name} wymienia {count} {from} na {count} {to} · {cash}", loading: "Wczytywanie gry…", @@ -104,6 +116,10 @@ export const pl: Catalog = { "buy.total": "{count} z {limit} akcji · koszt {cost} · zostaje {cash}", "buy.nothing": "Nic nie kupuj i zakończ turę", "buy.confirm": "Kup za {cost} i zakończ turę", + "buy.owned": "Masz", + "buy.soldOut": "Brak w banku", + "buy.cantAfford": "Za mało gotówki na kolejną", + "buy.limitReached": "Osiągnięto limit: {limit} akcji na turę.", "board.label": "Plansza", "board.empty": "{tile} puste", "board.loose": "{tile} pojedyncza płytka", diff --git a/packages/viewer/src/lib/locales/pt-BR.ts b/packages/viewer/src/lib/locales/pt-BR.ts index b2c1704..919ded5 100644 --- a/packages/viewer/src/lib/locales/pt-BR.ts +++ b/packages/viewer/src/lib/locales/pt-BR.ts @@ -13,6 +13,18 @@ export const ptBR: Catalog = { "swap.receive": "Receber {amount}", "swap.even": "Sem diferença de preço", "swap.unavailable": "Troca indisponível com esta quantidade, limite, ações e dinheiro.", + "swap.optionGive": "{chain} · você tem {count} · {price}", + "swap.optionTake": "{chain} · banco tem {count} · {price}", + "swap.fewer": "Trocar uma a menos", + "swap.more": "Trocar uma a mais", + "swap.max": "até {count}", + "swap.giveDetail": "dar {count} {chain} ({value})", + "swap.takeDetail": "receber {count} {chain} ({value})", + "swap.after": "Depois desta troca", + "swap.confirmExact": "Trocar {count} {from} por {count} {to} · {cash}", + "swap.noneLeft": "Não restam trocas neste turno.", + "swap.bankEmpty": "O banco não tem ações de {chain}.", + "swap.cash": "Dinheiro insuficiente para pagar a diferença de preço.", "log.swapped": "{name} trocou {count} {from} por {count} {to} · {cash}", loading: "Carregando o jogo…", @@ -103,6 +115,10 @@ export const ptBR: Catalog = { "buy.total": "{count} de {limit} ações · custo {cost} · sobra {cash}", "buy.nothing": "Não comprar nada e encerrar o turno", "buy.confirm": "Comprar por {cost} e encerrar o turno", + "buy.owned": "Você tem", + "buy.soldOut": "Nenhuma no banco", + "buy.cantAfford": "Dinheiro insuficiente para mais uma", + "buy.limitReached": "Limite atingido: {limit} ações por turno.", "board.label": "Tabuleiro", "board.empty": "{tile} vazia", "board.loose": "{tile} peça isolada", diff --git a/packages/viewer/src/lib/locales/ro.ts b/packages/viewer/src/lib/locales/ro.ts index 4c70dbc..8f5ed5c 100644 --- a/packages/viewer/src/lib/locales/ro.ts +++ b/packages/viewer/src/lib/locales/ro.ts @@ -14,6 +14,18 @@ export const ro: Catalog = { "swap.receive": "Primești {amount}", "swap.even": "Fără diferență de preț", "swap.unavailable": "Schimb imposibil cu această cantitate, limită, stoc și numerar.", + "swap.optionGive": "{chain} · ai {count} · {price}", + "swap.optionTake": "{chain} · banca are {count} · {price}", + "swap.fewer": "Schimbă una mai puțin", + "swap.more": "Schimbă una în plus", + "swap.max": "până la {count}", + "swap.giveDetail": "dai {count} {chain} ({value})", + "swap.takeDetail": "primești {count} {chain} ({value})", + "swap.after": "După acest schimb", + "swap.confirmExact": "Schimbă {count} {from} pe {count} {to} · {cash}", + "swap.noneLeft": "Nu mai ai schimburi în această tură.", + "swap.bankEmpty": "Banca nu are acțiuni {chain}.", + "swap.cash": "Bani insuficienți pentru diferența de preț.", "log.swapped": "{name} schimbă {count} {from} pentru {count} {to} · {cash}", loading: "Se încarcă jocul…", @@ -104,6 +116,10 @@ export const ro: Catalog = { "buy.total": "{count} din {limit} acțiuni · cost {cost} · bani rămași {cash}", "buy.nothing": "Nu cumpăra nimic și încheie tura", "buy.confirm": "Cumpără cu {cost} și încheie tura", + "buy.owned": "Deții", + "buy.soldOut": "Banca nu mai are", + "buy.cantAfford": "Bani insuficienți pentru încă una", + "buy.limitReached": "Limită atinsă: {limit} acțiuni pe tură.", "board.label": "Tablă", "board.empty": "{tile} liber", "board.loose": "{tile} piesă izolată", diff --git a/packages/viewer/src/lib/locales/ru.ts b/packages/viewer/src/lib/locales/ru.ts index 45c91fa..64148eb 100644 --- a/packages/viewer/src/lib/locales/ru.ts +++ b/packages/viewer/src/lib/locales/ru.ts @@ -13,6 +13,18 @@ export const ru: Catalog = { "swap.receive": "Получить {amount}", "swap.even": "Без доплаты", "swap.unavailable": "Обмен невозможен с этим количеством, лимитом, запасом акций и наличными.", + "swap.optionGive": "{chain} · у вас {count} · {price}", + "swap.optionTake": "{chain} · в банке {count} · {price}", + "swap.fewer": "Обменять на одну меньше", + "swap.more": "Обменять на одну больше", + "swap.max": "до {count}", + "swap.giveDetail": "отдать {count} {chain} ({value})", + "swap.takeDetail": "получить {count} {chain} ({value})", + "swap.after": "После этого обмена", + "swap.confirmExact": "Обменять {count} {from} на {count} {to} · {cash}", + "swap.noneLeft": "Обменов в этом ходу больше нет.", + "swap.bankEmpty": "В банке нет акций {chain}.", + "swap.cash": "Не хватает денег на разницу в цене.", "log.swapped": "{name} обменивает {count} {from} на {count} {to} · {cash}", loading: "Загрузка игры…", @@ -104,6 +116,10 @@ export const ru: Catalog = { "buy.total": "{count} из {limit} акций · стоимость {cost} · останется {cash}", "buy.nothing": "Ничего не покупать и закончить ход", "buy.confirm": "Купить за {cost} и закончить ход", + "buy.owned": "У вас", + "buy.soldOut": "В банке не осталось", + "buy.cantAfford": "Не хватает денег на ещё одну", + "buy.limitReached": "Лимит достигнут: {limit} акций за ход.", "board.label": "Поле", "board.empty": "{tile} пусто", "board.loose": "{tile} одиночная фишка", diff --git a/packages/viewer/src/lib/locales/vi.ts b/packages/viewer/src/lib/locales/vi.ts index 2b334e8..d360d77 100644 --- a/packages/viewer/src/lib/locales/vi.ts +++ b/packages/viewer/src/lib/locales/vi.ts @@ -13,6 +13,18 @@ export const vi: Catalog = { "swap.receive": "Nhận {amount}", "swap.even": "Không chênh lệch tiền", "swap.unavailable": "Không thể đổi với số lượng, hạn mức, cổ phiếu và tiền mặt này.", + "swap.optionGive": "{chain} · bạn có {count} · {price}", + "swap.optionTake": "{chain} · ngân hàng có {count} · {price}", + "swap.fewer": "Đổi bớt một", + "swap.more": "Đổi thêm một", + "swap.max": "tối đa {count}", + "swap.giveDetail": "đưa {count} {chain} ({value})", + "swap.takeDetail": "nhận {count} {chain} ({value})", + "swap.after": "Sau lần đổi này", + "swap.confirmExact": "Đổi {count} {from} lấy {count} {to} · {cash}", + "swap.noneLeft": "Lượt này đã hết lần đổi.", + "swap.bankEmpty": "Ngân hàng không có cổ phiếu {chain}.", + "swap.cash": "Không đủ tiền trả phần chênh lệch giá.", "log.swapped": "{name} đổi {count} {from} lấy {count} {to} · {cash}", loading: "Đang tải ván chơi…", @@ -99,6 +111,10 @@ export const vi: Catalog = { "buy.total": "{count}/{limit} cổ phiếu · chi phí {cost} · còn lại {cash}", "buy.nothing": "Không mua và kết thúc lượt", "buy.confirm": "Mua với giá {cost} và kết thúc lượt", + "buy.owned": "Bạn có", + "buy.soldOut": "Ngân hàng đã hết", + "buy.cantAfford": "Không đủ tiền mua thêm", + "buy.limitReached": "Đã đạt giới hạn: {limit} cổ phiếu mỗi lượt.", "board.label": "Bàn chơi", "board.empty": "{tile} trống", "board.loose": "{tile} ô nằm riêng", diff --git a/packages/viewer/src/lib/locales/zh-CN.ts b/packages/viewer/src/lib/locales/zh-CN.ts index 67c978d..f0a235d 100644 --- a/packages/viewer/src/lib/locales/zh-CN.ts +++ b/packages/viewer/src/lib/locales/zh-CN.ts @@ -13,6 +13,18 @@ export const zhCN: Catalog = { "swap.receive": "收取 {amount}", "swap.even": "无价差", "swap.unavailable": "此数量、交换限额、股票与现金不足以完成交换。", + "swap.optionGive": "{chain} · 持有 {count} · {price}", + "swap.optionTake": "{chain} · 银行 {count} · {price}", + "swap.fewer": "少换一股", + "swap.more": "多换一股", + "swap.max": "最多 {count}", + "swap.giveDetail": "交出 {count} 股 {chain}({value})", + "swap.takeDetail": "取得 {count} 股 {chain}({value})", + "swap.after": "此交换后", + "swap.confirmExact": "用 {count} 股 {from} 换 {count} 股 {to} · {cash}", + "swap.noneLeft": "本回合已无交换次数。", + "swap.bankEmpty": "银行没有 {chain} 股票。", + "swap.cash": "现金不足以支付差价。", "log.swapped": "{name} 以 {count} 股 {from} 交换 {count} 股 {to} · {cash}", loading: "正在加载游戏…", @@ -98,6 +110,10 @@ export const zhCN: Catalog = { "buy.total": "{count}/{limit} 股 · 花费 {cost} · 剩余 {cash}", "buy.nothing": "不购买,结束回合", "buy.confirm": "花费 {cost} 购买并结束回合", + "buy.owned": "持有", + "buy.soldOut": "银行已无存股", + "buy.cantAfford": "现金不足以再买一股", + "buy.limitReached": "已达上限:每回合 {limit} 股。", "board.label": "游戏版图", "board.empty": "{tile} 空", "board.loose": "{tile} 单独板块", diff --git a/packages/viewer/src/lib/locales/zh-TW.ts b/packages/viewer/src/lib/locales/zh-TW.ts index deaf1b0..4d5631d 100644 --- a/packages/viewer/src/lib/locales/zh-TW.ts +++ b/packages/viewer/src/lib/locales/zh-TW.ts @@ -13,6 +13,18 @@ export const zhTW: Catalog = { "swap.receive": "收取 {amount}", "swap.even": "無價差", "swap.unavailable": "此數量、交換限額、股票與現金不足以完成交換。", + "swap.optionGive": "{chain} · 持有 {count} · {price}", + "swap.optionTake": "{chain} · 銀行 {count} · {price}", + "swap.fewer": "少換一股", + "swap.more": "多換一股", + "swap.max": "最多 {count}", + "swap.giveDetail": "交出 {count} 股 {chain}({value})", + "swap.takeDetail": "取得 {count} 股 {chain}({value})", + "swap.after": "此交換後", + "swap.confirmExact": "以 {count} 股 {from} 換 {count} 股 {to} · {cash}", + "swap.noneLeft": "本回合已無交換次數。", + "swap.bankEmpty": "銀行沒有 {chain} 股票。", + "swap.cash": "現金不足以支付差價。", "log.swapped": "{name} 以 {count} 股 {from} 交換 {count} 股 {to} · {cash}", loading: "正在載入遊戲…", @@ -98,6 +110,10 @@ export const zhTW: Catalog = { "buy.total": "{count}/{limit} 股 · 花費 {cost} · 剩餘 {cash}", "buy.nothing": "不購買,結束回合", "buy.confirm": "花費 {cost} 購買並結束回合", + "buy.owned": "持有", + "buy.soldOut": "銀行已無存股", + "buy.cantAfford": "現金不足以再買一股", + "buy.limitReached": "已達上限:每回合 {limit} 股。", "board.label": "遊戲圖板", "board.empty": "{tile} 空", "board.loose": "{tile} 單獨板塊", diff --git a/scripts/check-browser.mjs b/scripts/check-browser.mjs index ece3e62..f43fd52 100644 --- a/scripts/check-browser.mjs +++ b/scripts/check-browser.mjs @@ -324,8 +324,9 @@ try { window.acquireDev.load(state); }, preparedPosition("founding")); await page.locator(".stock-swap summary").click(); - await page.getByRole("spinbutton", { name: "Shares", exact: true }).fill("2"); + await page.getByRole("button", { name: "Swap one more", exact: true }).click(); assert.match(await page.locator(".exchange").innerText(), /Pay \$800/); + assert.match(await page.locator(".stock-swap .holding-change").innerText(), /\$6,000\s*→\s*\$5,200/); for (const theme of ["dark", "light"]) { await page.evaluate((theme) => window.acquireDev.emitter.emit("theme", { dark: theme === "dark" }), theme); for (const locale of locales) { @@ -334,17 +335,18 @@ try { await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 1), `stock swap ${locale} ${theme} ${width}px` ); - assert.equal(await page.locator(".stock-swap button").isEnabled(), true); + assert.equal(await page.locator(".stock-swap button.confirm").isEnabled(), true); } await preferences({ locale: "en" }); await page .locator(".panel") .screenshot({ path: fileURLToPath(new URL(`stock-swap-${theme}-${width}.png`, output)) }); } + await page.getByRole("button", { name: "Swap one fewer", exact: true }).click(); const original = await page.evaluate(() => JSON.stringify(window.acquireDev.state)); for (let revision = 0; revision < 3; revision++) { - await page.getByRole("spinbutton", { name: "Shares", exact: true }).fill("2"); - await page.getByRole("button", { name: "Swap shares", exact: true }).click(); + await page.getByRole("button", { name: "Swap one more", exact: true }).click(); + await page.getByRole("button", { name: "Swap 2 Tower for 2 Continental · Pay $800", exact: true }).click(); await page.waitForFunction(() => document.querySelector(".stock-swap summary")?.textContent.includes("1 left")); assert.equal( await page.evaluate(() => JSON.stringify(window.acquireDev.state)), @@ -354,13 +356,13 @@ try { await page.getByRole("button", { name: "Undo", exact: true }).click(); await page.waitForFunction(() => document.querySelector(".stock-swap summary")?.textContent.includes("3 left")); } - await page.getByRole("spinbutton", { name: "Shares", exact: true }).fill("2"); - await page.getByRole("button", { name: "Swap shares", exact: true }).click(); + await page.getByRole("button", { name: "Swap one more", exact: true }).click(); + await page.locator(".stock-swap button.confirm").click(); await page.waitForFunction(() => document.querySelector(".stock-swap summary")?.textContent.includes("1 left")); await page.getByLabel("Give (your stock)", { exact: true }).selectOption("continental"); await settle(); assert.match(await page.locator(".exchange").innerText(), /Receive \$400/); - await page.getByRole("button", { name: "Swap shares", exact: true }).click(); + await page.locator(".stock-swap button.confirm").click(); await page.waitForFunction(() => document.querySelector(".stock-swap summary")?.textContent.includes("0 left")); for (let i = 0; i < 3; i++) { await page.getByRole("button", { name: "Buy one more Tower", exact: true }).click();