Simplify the trading prompt with resource icons

This commit is contained in:
coyotte508 2026-10-22 16:30:15 +02:00
commit bf1067fe60
20 changed files with 210 additions and 27 deletions

View file

@ -1,6 +1,6 @@
{
"name": "outpost-viewer",
"version": "0.1.27",
"version": "0.1.28",
"description": "Browser viewer for the Outpost game on boardgamers.space",
"license": "AGPL-3.0",
"files": [

View file

@ -24,6 +24,7 @@
store.submitAutomaticMega();
});
const me = $derived(store.me);
const exchangeOffer = $derived(store.exchangeCard === null ? undefined : me?.hand[store.exchangeCard]);
const pending = $derived(store.pending);
const staged = $derived(
store.turnBuys.map((buy) =>
@ -189,18 +190,59 @@
</button>
</div>
{:else if store.myExchange && me}
<div class="flow">
<span class="hint gold-hint">
Wily Trader / Merchant House: click one of your
{store.exchangeOfferTypes.map((t) => RESOURCE_LABELS[t] ?? t).join("/")}
cards to offer, then a player to trade with. They must hand back a higher-valued card of the same type if they
have one.
</span>
<div class="flow exchange-flow">
<div class="exchange-heading">
{#if exchangeOffer}
<span
class="exchange-offer res-{exchangeOffer.t}"
role="img"
aria-label={`${RESOURCE_LABELS[exchangeOffer.t]}: ${exchangeOffer.v} credits`}
title={`${RESOURCE_LABELS[exchangeOffer.t]}: ${exchangeOffer.v} credits`}
>
<ResourceIcon resource={exchangeOffer.t} size={15} />
<strong>{exchangeOffer.v}</strong>
</span>
<svg width="16" height="16" viewBox="0 0 20 20" aria-hidden="true" class="exchange-arrow">
<path d="M3 10h14m-5-5 5 5-5 5" fill="none" stroke="currentColor" stroke-width="1.5" />
</svg>
{#if store.exchangeTarget === null}
<span class="hint">Choose a player</span>
{:else}
<span class="hint exchange-target" translate="no">{gameState.players[store.exchangeTarget]?.name}</span>
{/if}
{:else}
<span class="hint">Choose a card</span>
<span class="exchange-resources">
{#each store.exchangeOfferTypes as resource (resource)}
<span
class="res-{resource}"
role="img"
aria-label={RESOURCE_LABELS[resource]}
title={RESOURCE_LABELS[resource]}
>
<ResourceIcon {resource} size={15} />
</span>
{/each}
</span>
{/if}
<details class="exchange-help">
<summary aria-label="Trade rules" title="Trade rules">
<svg width="16" height="16" viewBox="0 0 20 20" aria-hidden="true">
<circle cx="10" cy="10" r="7" fill="none" stroke="currentColor" stroke-width="1.4" />
<path d="M10 9v5m0-8v1" fill="none" stroke="currentColor" stroke-width="1.5" />
</svg>
</summary>
<p>The chosen player returns a higher-valued card of the same resource, if they have one.</p>
</details>
</div>
<button
class="confirm"
class="confirm exchange-confirm"
disabled={store.exchangeCard === null || store.exchangeTarget === null}
onclick={() => store.confirmExchange()}
>
<svg width="15" height="15" viewBox="0 0 20 20" aria-hidden="true">
<path d="M3 6h14m-4-4 4 4-4 4M17 14H3m4-4-4 4 4 4" fill="none" stroke="currentColor" stroke-width="1.5" />
</svg>
Trade
</button>
<button class="cancel" onclick={() => store.passExchange()}>Pass</button>
@ -497,6 +539,79 @@
gap: 8px;
flex-wrap: wrap;
}
.exchange-heading {
display: flex;
align-items: center;
gap: 8px;
width: 100%;
min-width: 0;
min-height: 28px;
}
.exchange-resources,
.exchange-offer,
.exchange-confirm {
display: inline-flex;
align-items: center;
gap: 6px;
flex-shrink: 0;
}
.exchange-heading > .hint {
min-width: 0;
overflow-wrap: anywhere;
}
.exchange-resources > span {
display: flex;
color: var(--res);
}
.exchange-offer {
color: var(--res);
font-size: 13px;
font-variant-numeric: tabular-nums;
}
.exchange-arrow {
flex-shrink: 0;
color: var(--text-dim);
}
.exchange-help {
position: relative;
margin-inline-start: auto;
flex-shrink: 0;
}
.exchange-help summary {
display: flex;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
color: var(--text-dim);
cursor: pointer;
list-style: none;
}
.exchange-help summary::-webkit-details-marker {
display: none;
}
.exchange-help summary:hover,
.exchange-help[open] summary {
color: var(--text);
}
.exchange-help summary:focus-visible {
outline: 2px solid var(--gold);
}
.exchange-help p {
position: absolute;
inset-inline-end: 0;
top: 100%;
z-index: 10;
width: min(260px, 70vw);
margin: 4px 0 0;
padding: 10px 12px;
border: 1px solid var(--line);
background: var(--bg-panel);
box-shadow: 0 4px 12px #0006;
color: var(--text-mid);
font-size: 12px;
line-height: 1.5;
}
.hint {
color: var(--text);
font-size: 13px;

View file

@ -564,7 +564,7 @@ export class ViewerStore {
}
/** Resource types I may offer, from the Wily Trader / Merchant House I own. */
get exchangeOfferTypes(): string[] {
get exchangeOfferTypes(): Resource[] {
const me = this.me;
return me ? exchangeResources(me) : [];
}

View file

@ -1214,5 +1214,9 @@
"Buy {p0} anyway · ◈ {p1}": "Køb {p0} alligevel · ◈ {p1}",
"Undo my move": "Fortryd mit træk",
"Maximum Megas (ask if over limit)": "Flest mulige Megaer (spørg ved håndgrænsen)",
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "Automatiske Megaer sat på pause: Produktionen overskrider din håndgrænse. Vælg for denne runde."
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "Automatiske Megaer sat på pause: Produktionen overskrider din håndgrænse. Vælg for denne runde.",
"Choose a card": "Vælg et kort",
"Choose a player": "Vælg en spiller",
"Trade rules": "Bytteregler",
"The chosen player returns a higher-valued card of the same resource, if they have one.": "Den valgte spiller giver et kort af samme ressource med en højere værdi tilbage, hvis de har et."
}

View file

@ -1214,5 +1214,9 @@
"Buy {p0} anyway · ◈ {p1}": "{p0} trotzdem kaufen · ◈ {p1}",
"Undo my move": "Zug zurücknehmen",
"Maximum Megas (ask if over limit)": "Maximale Megas (bei Handlimit nachfragen)",
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "Auto-Megas pausiert: Die Produktion überschreitet dein Handlimit. Wähle für diese Runde."
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "Auto-Megas pausiert: Die Produktion überschreitet dein Handlimit. Wähle für diese Runde.",
"Choose a card": "Wähle eine Karte",
"Choose a player": "Wähle einen Spieler",
"Trade rules": "Tauschregeln",
"The chosen player returns a higher-valued card of the same resource, if they have one.": "Der gewählte Spieler gibt eine höherwertige Karte derselben Ressource zurück, sofern er eine hat."
}

View file

@ -1214,5 +1214,9 @@
"Buy {p0} anyway · ◈ {p1}": "Αγορά {p0} ούτως ή άλλως · ◈ {p1}",
"Undo my move": "Αναίρεση κίνησης",
"Maximum Megas (ask if over limit)": "Μέγιστα Mega (ερώτηση αν ξεπεραστεί το όριο)",
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "Τα αυτόματα Mega τέθηκαν σε παύση: η παραγωγή υπερβαίνει το όριο καρτών σας. Επιλέξτε για αυτόν τον γύρο."
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "Τα αυτόματα Mega τέθηκαν σε παύση: η παραγωγή υπερβαίνει το όριο καρτών σας. Επιλέξτε για αυτόν τον γύρο.",
"Choose a card": "Επιλέξτε κάρτα",
"Choose a player": "Επιλέξτε παίκτη",
"Trade rules": "Κανόνες ανταλλαγής",
"The chosen player returns a higher-valued card of the same resource, if they have one.": "Ο επιλεγμένος παίκτης επιστρέφει μια κάρτα του ίδιου πόρου με μεγαλύτερη αξία, αν έχει."
}

View file

@ -1214,5 +1214,9 @@
"Buy {p0} anyway · ◈ {p1}": "Buy {p0} anyway · ◈ {p1}",
"Undo my move": "Undo my move",
"Maximum Megas (ask if over limit)": "Maximum Megas (ask if over limit)",
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "Auto Megas paused: production exceeds your hand limit. Choose this round."
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "Auto Megas paused: production exceeds your hand limit. Choose this round.",
"Choose a card": "Choose a card",
"Choose a player": "Choose a player",
"Trade rules": "Trade rules",
"The chosen player returns a higher-valued card of the same resource, if they have one.": "The chosen player returns a higher-valued card of the same resource, if they have one."
}

View file

@ -1214,5 +1214,9 @@
"Buy {p0} anyway · ◈ {p1}": "به هر حال {p0} بخرید · ◈ {p1}",
"Undo my move": "بازگرداندن حرکت",
"Maximum Megas (ask if over limit)": "بیشترین مگا (پرسش در صورت عبور از حد دست)",
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "انتخاب خودکار مگا متوقف شد: تولید از حد کارت‌های دست شما بیشتر است. برای این دور انتخاب کنید."
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "انتخاب خودکار مگا متوقف شد: تولید از حد کارت‌های دست شما بیشتر است. برای این دور انتخاب کنید.",
"Choose a card": "یک کارت انتخاب کنید",
"Choose a player": "یک بازیکن انتخاب کنید",
"Trade rules": "قوانین مبادله",
"The chosen player returns a higher-valued card of the same resource, if they have one.": "بازیکن انتخاب‌شده، اگر کارتی از همان منبع با ارزش بالاتر داشته باشد، آن را در مقابل می‌دهد."
}

View file

@ -1214,5 +1214,9 @@
"Buy {p0} anyway · ◈ {p1}": "Acheter {p0} quand même · ◈ {p1}",
"Undo my move": "Annuler mon coup",
"Maximum Megas (ask if over limit)": "Maximum de Megas (demander si limite dépassée)",
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "Megas automatiques en pause : la production dépasse votre limite de main. Choisissez pour ce tour."
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "Megas automatiques en pause : la production dépasse votre limite de main. Choisissez pour ce tour.",
"Choose a card": "Choisissez une carte",
"Choose a player": "Choisissez un joueur",
"Trade rules": "Règles de l’échange",
"The chosen player returns a higher-valued card of the same resource, if they have one.": "Le joueur choisi rend une carte de la même ressource de valeur supérieure, s’il en possède une."
}

View file

@ -1214,5 +1214,9 @@
"Buy {p0} anyway · ◈ {p1}": "फिर भी {p0} खरीदें · ◈ {p1}",
"Undo my move": "अपनी चाल वापस लें",
"Maximum Megas (ask if over limit)": "अधिकतम मेगा (सीमा पार होने पर पूछें)",
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "स्वचालित मेगा चयन रुका है: उत्पादन से हाथ में कार्ड की सीमा पार हो जाएगी। इस दौर के लिए चुनें।"
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "स्वचालित मेगा चयन रुका है: उत्पादन से हाथ में कार्ड की सीमा पार हो जाएगी। इस दौर के लिए चुनें।",
"Choose a card": "एक कार्ड चुनें",
"Choose a player": "एक खिलाड़ी चुनें",
"Trade rules": "विनिमय के नियम",
"The chosen player returns a higher-valued card of the same resource, if they have one.": "चुना गया खिलाड़ी उसी संसाधन का अधिक मूल्य वाला कार्ड लौटाता है, यदि उसके पास ऐसा कार्ड हो।"
}

View file

@ -1214,5 +1214,9 @@
"Buy {p0} anyway · ◈ {p1}": "Compra comunque {p0} · ◈ {p1}",
"Undo my move": "Annulla la mossa",
"Maximum Megas (ask if over limit)": "Massimo di Mega (chiedi oltre il limite)",
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "Mega automatiche in pausa: la produzione supera il limite della mano. Scegli per questo turno."
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "Mega automatiche in pausa: la produzione supera il limite della mano. Scegli per questo turno.",
"Choose a card": "Scegli una carta",
"Choose a player": "Scegli un giocatore",
"Trade rules": "Regole dello scambio",
"The chosen player returns a higher-valued card of the same resource, if they have one.": "Il giocatore scelto restituisce una carta della stessa risorsa di valore superiore, se ne possiede una."
}

View file

@ -1214,5 +1214,9 @@
"Buy {p0} anyway · ◈ {p1}": "그래도 {p0} 구매 · ◈ {p1}",
"Undo my move": "내 수 되돌리기",
"Maximum Megas (ask if over limit)": "최대 메가 (한도 초과 시 확인)",
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "메가 자동 선택 일시 중지: 생산량이 손패 한도를 초과합니다. 이번 라운드의 생산 방식을 선택하세요."
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "메가 자동 선택 일시 중지: 생산량이 손패 한도를 초과합니다. 이번 라운드의 생산 방식을 선택하세요.",
"Choose a card": "카드를 선택하세요",
"Choose a player": "플레이어를 선택하세요",
"Trade rules": "교환 규칙",
"The chosen player returns a higher-valued card of the same resource, if they have one.": "선택한 플레이어는 같은 자원의 더 높은 가치 카드를 가지고 있다면 그 카드를 돌려줍니다."
}

View file

@ -1214,5 +1214,9 @@
"Buy {p0} anyway · ◈ {p1}": "Koop toch {p0} · ◈ {p1}",
"Undo my move": "Zet ongedaan maken",
"Maximum Megas (ask if over limit)": "Maximale Mega’s (vragen bij overschrijding)",
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "Automatische Mega’s gepauzeerd: de productie overschrijdt je handlimiet. Kies voor deze ronde."
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "Automatische Mega’s gepauzeerd: de productie overschrijdt je handlimiet. Kies voor deze ronde.",
"Choose a card": "Kies een kaart",
"Choose a player": "Kies een speler",
"Trade rules": "Ruilregels",
"The chosen player returns a higher-valued card of the same resource, if they have one.": "De gekozen speler geeft een kaart van dezelfde grondstof met een hogere waarde terug, als die er een heeft."
}

View file

@ -1214,5 +1214,9 @@
"Buy {p0} anyway · ◈ {p1}": "Kup {p0} mimo to · ◈ {p1}",
"Undo my move": "Cofnij ruch",
"Maximum Megas (ask if over limit)": "Maksimum Mega (zapytaj po przekroczeniu limitu)",
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "Automatyczny wybór Mega wstrzymany: produkcja przekracza limit kart w ręce. Wybierz w tej rundzie."
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "Automatyczny wybór Mega wstrzymany: produkcja przekracza limit kart w ręce. Wybierz w tej rundzie.",
"Choose a card": "Wybierz kartę",
"Choose a player": "Wybierz gracza",
"Trade rules": "Zasady wymiany",
"The chosen player returns a higher-valued card of the same resource, if they have one.": "Wybrany gracz oddaje kartę tego samego surowca o wyższej wartości, jeśli taką posiada."
}

View file

@ -1214,5 +1214,9 @@
"Buy {p0} anyway · ◈ {p1}": "Comprar {p0} mesmo assim · ◈ {p1}",
"Undo my move": "Desfazer jogada",
"Maximum Megas (ask if over limit)": "Máximo de Megas (perguntar se exceder o limite)",
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "Megas automáticas pausadas: a produção excede seu limite de mão. Escolha nesta rodada."
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "Megas automáticas pausadas: a produção excede seu limite de mão. Escolha nesta rodada.",
"Choose a card": "Escolha uma carta",
"Choose a player": "Escolha um jogador",
"Trade rules": "Regras de troca",
"The chosen player returns a higher-valued card of the same resource, if they have one.": "O jogador escolhido devolve uma carta do mesmo recurso de valor maior, se tiver uma."
}

View file

@ -1214,5 +1214,9 @@
"Buy {p0} anyway · ◈ {p1}": "Cumpără totuși {p0} · ◈ {p1}",
"Undo my move": "Anulează mutarea",
"Maximum Megas (ask if over limit)": "Maximum de Mega (întreabă dacă depășești limita)",
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "Alegerea automată a cărților Mega este oprită: producția depășește limita mâinii. Alege pentru această rundă."
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "Alegerea automată a cărților Mega este oprită: producția depășește limita mâinii. Alege pentru această rundă.",
"Choose a card": "Alege o carte",
"Choose a player": "Alege un jucător",
"Trade rules": "Reguli de schimb",
"The chosen player returns a higher-valued card of the same resource, if they have one.": "Jucătorul ales oferă în schimb o carte din aceeași resursă, cu o valoare mai mare, dacă are una."
}

View file

@ -1214,5 +1214,9 @@
"Buy {p0} anyway · ◈ {p1}": "Всё равно купить {p0} · ◈ {p1}",
"Undo my move": "Отменить ход",
"Maximum Megas (ask if over limit)": "Максимум Мега (спросить при превышении лимита)",
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "Автовыбор Мега приостановлен: производство превышает лимит карт в руке. Сделайте выбор на этот раунд."
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "Автовыбор Мега приостановлен: производство превышает лимит карт в руке. Сделайте выбор на этот раунд.",
"Choose a card": "Выберите карту",
"Choose a player": "Выберите игрока",
"Trade rules": "Правила обмена",
"The chosen player returns a higher-valued card of the same resource, if they have one.": "Выбранный игрок возвращает карту того же ресурса с большей ценностью, если она у него есть."
}

View file

@ -1214,5 +1214,9 @@
"Buy {p0} anyway · ◈ {p1}": "Vẫn mua {p0} · ◈ {p1}",
"Undo my move": "Hoàn tác nước đi",
"Maximum Megas (ask if over limit)": "Tối đa Mega (hỏi nếu vượt giới hạn)",
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "Tạm dừng tự chọn Mega: sản xuất vượt giới hạn bài trên tay. Hãy chọn cho vòng này."
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "Tạm dừng tự chọn Mega: sản xuất vượt giới hạn bài trên tay. Hãy chọn cho vòng này.",
"Choose a card": "Chọn một lá bài",
"Choose a player": "Chọn một người chơi",
"Trade rules": "Quy tắc trao đổi",
"The chosen player returns a higher-valued card of the same resource, if they have one.": "Người chơi được chọn trả lại một lá cùng loại tài nguyên có giá trị cao hơn, nếu họ có."
}

View file

@ -1214,5 +1214,9 @@
"Buy {p0} anyway · ◈ {p1}": "仍购买 {p0} · ◈ {p1}",
"Undo my move": "撤销我的行动",
"Maximum Megas (ask if over limit)": "最多巨型牌(超限时询问)",
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "自动巨型牌已暂停:产出超过手牌上限。请为本轮手动选择。"
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "自动巨型牌已暂停:产出超过手牌上限。请为本轮手动选择。",
"Choose a card": "选择一张卡牌",
"Choose a player": "选择一名玩家",
"Trade rules": "交换规则",
"The chosen player returns a higher-valued card of the same resource, if they have one.": "所选玩家若持有同种资源且价值更高的卡牌,就必须用该卡牌交换。"
}

View file

@ -1214,5 +1214,9 @@
"Buy {p0} anyway · ◈ {p1}": "仍然購買 {p0} · ◈ {p1}",
"Undo my move": "撤回我的行動",
"Maximum Megas (ask if over limit)": "最多 Mega(超過手牌上限時詢問)",
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "已暫停自動選擇 Mega:本輪產出將超過手牌上限。請選擇本輪的生產方式。"
"Auto Megas paused: production exceeds your hand limit. Choose this round.": "已暫停自動選擇 Mega:本輪產出將超過手牌上限。請選擇本輪的生產方式。",
"Choose a card": "選擇一張卡牌",
"Choose a player": "選擇一名玩家",
"Trade rules": "交換規則",
"The chosen player returns a higher-valued card of the same resource, if they have one.": "所選玩家若持有同種資源且價值更高的卡牌,就必須用該卡牌交換。"
}