Upgrade badges, credit icon on amounts, robust header alignment

- UpgradeBadges component on market cards and the auction banner: produced
  card (icon + value range), unlocked/free factories (icon chips), hand
  capacity / population bonuses, robots and ecoplants effects at a glance.
- Prefix credit amounts with the currency glyph everywhere (prices, bids,
  payments, buy buttons).
- Fix the header strip width for real: size the main column to fill the
  board instead of sizing the page to its content (unwrapped log lines made
  fit-content drift wider than the visible content row, e.g. 2-player games).
This commit is contained in:
coyotte508 2026-08-26 09:13:03 +00:00
commit 2a82bd4bbc
5 changed files with 113 additions and 27 deletions

View file

@ -99,21 +99,19 @@
align-items: start;
}
/* Wide screens: two columns — players/market on the left, action bar + event
feed in a fixed right sidebar. */
feed in a fixed right sidebar. The main column grows to fill the board, so
the header strip and the content row always share the same width (sizing
the page to its content instead would track unwrapped log lines and drift
wider than what's visible). */
@media (min-width: 1100px) {
.page {
width: fit-content;
margin: 0 auto;
align-items: stretch;
}
.columns {
flex-direction: row;
align-items: flex-start;
justify-content: center;
gap: 24px;
}
.main {
flex: 0 1 auto;
flex: 1 1 auto;
min-width: 0;
align-items: stretch;
}
.side {

View file

@ -93,10 +93,10 @@
<div class="flow">
<span class="hint gold-hint">
You won <strong>{UPGRADE_SPECS[state.auction?.upgrade ?? "dataLibrary"].name}</strong>: select hand cards
worth at least {store.myPaymentDue} credits (selected <strong>{total}</strong>).
worth at least ◈ {store.myPaymentDue} (selected <strong>◈ {total}</strong>).
</span>
<button class="confirm" disabled={!store.paymentValid()} onclick={() => store.confirmPayment()}>
Pay {store.myPaymentDue}
Pay ◈ {store.myPaymentDue}
</button>
</div>
{:else if store.myActionTurn && me}
@ -127,7 +127,7 @@
{:else}
Buying <strong>{pending.count}</strong> robot{pending.count === 1 ? "" : "s"}:
{/if}
selected <strong>{total}</strong> / {pending.cost} credits.
selected <strong>◈ {total}</strong> / ◈ {pending.cost}.
{#if needsResearch && !hasResearch}
<span class="warn">Payment must include a research card.</span>
{/if}
@ -137,7 +137,7 @@
<button onclick={() => store.bumpPendingCount(1)}>+1</button>
{/if}
<button class="confirm" disabled={!store.pendingValid()} onclick={() => store.confirmPending()}>
Confirm ({pending.cost})
Confirm (◈ {pending.cost})
</button>
<button class="cancel" onclick={() => store.cancel()}>Cancel</button>
</div>
@ -155,7 +155,7 @@
onclick={() => store.startFactoryPayment(type)}
>
<ResourceIcon resource={type} size={13} />
{RESOURCE_LABELS[type]} · {spec.cost}
{RESOURCE_LABELS[type]} · ◈ {spec.cost}
</button>
{/each}
<span class="group-label">Operators:</span>
@ -167,7 +167,7 @@
: ''}"
onclick={() => store.startPopulationPayment()}
>
Colonist · {store.popCost}
Colonist · ◈ {store.popCost}
</button>
{#if me.upgrades.robots > 0}
<button
@ -176,7 +176,7 @@
title="Buy a robot: 10 credits"
onclick={() => store.startRobotsPayment()}
>
Robot · 10
Robot · ◈ 10
</button>
{/if}
<button class="end" onclick={() => store.startManning()}>Assign operators…</button>

View file

@ -1,5 +1,6 @@
<script lang="ts">
import { UPGRADE_SPECS, type GameState } from "outpost-engine";
import UpgradeBadges from "./UpgradeBadges.svelte";
import { UPGRADE_EFFECTS, type ViewerStore } from "./store.svelte";
interface Props {
@ -30,17 +31,18 @@
<div class="block">
<span class="label">On the block</span>
<span class="uname">{spec.name}</span>
<span class="uvp">{spec.vp} VP · list {spec.price}</span>
<span class="uvp">{spec.vp} VP · list ◈ {spec.price}</span>
<UpgradeBadges upgrade={auction.upgrade} />
<span class="ueffect">{UPGRADE_EFFECTS[auction.upgrade]}</span>
</div>
<div class="status">
<div class="bid">
High bid <strong>{auction.highBid}</strong> by <strong>{nameOf(auction.highBidder)}</strong>
High bid <strong>◈ {auction.highBid}</strong> by <strong>{nameOf(auction.highBidder)}</strong>
</div>
{#if state.phase === "auction"}
<div class="turn">
{#if store.myBidTurn}
Your bid: raise to at least {minBid} or pass.
Your bid: raise to at least ◈ {minBid} or pass.
{:else}
Waiting for {nameOf(auction.activeBidder)} to bid…
{/if}
@ -48,7 +50,7 @@
{#if store.myBidTurn}
{#if maxBid < minBid}
<div class="controls">
<span class="cantbid">You can't beat the high bid (your max is {maxBid}).</span>
<span class="cantbid">You can't beat the high bid (your max is ◈ {maxBid}).</span>
<button class="confirm" onclick={() => store.passBid()}>Pass</button>
</div>
{:else}
@ -69,15 +71,15 @@
<button
class="confirm"
disabled={store.bidAmount < minBid || store.bidAmount > maxBid}
onclick={() => store.confirmBid()}>Bid {store.bidAmount}</button
onclick={() => store.confirmBid()}>Bid ◈ {store.bidAmount}</button
>
<button class="pass" onclick={() => store.passBid()}>Pass</button>
</div>
<div class="hint">
You hold {store.myHandValue} credits{#if discount > 0}
and get a −{discount} discount on this upgrade{/if}. Max bid {maxBid}.
You hold ◈ {store.myHandValue}{#if discount > 0}
and get a −{discount} discount on this upgrade{/if}. Max bid ◈ {maxBid}.
{#if store.bidAmount >= minBid && store.bidAmount <= maxBid}
Winning at {store.bidAmount} would cost you {Math.max(0, store.bidAmount - discount)} in cards.
Winning at {store.bidAmount} would cost you ◈ {Math.max(0, store.bidAmount - discount)} in cards.
{/if}
</div>
{/if}
@ -85,7 +87,7 @@
{:else}
<div class="turn">
{#if store.myPayment}
You won: select hand cards worth at least {due} credits and confirm below (bid {auction.highBid}{#if discount > 0}
You won: select hand cards worth at least ◈ {due} and confirm below (bid {auction.highBid}{#if discount > 0}
− {discount} discount{/if}).
{:else}
Waiting for {nameOf(auction.highBidder)} to pay…

View file

@ -1,5 +1,6 @@
<script lang="ts">
import { UPGRADE_SPECS, UPGRADES, type GameState } from "outpost-engine";
import UpgradeBadges from "./UpgradeBadges.svelte";
import { UPGRADE_EFFECTS, type ViewerStore } from "./store.svelte";
interface Props {
@ -48,9 +49,10 @@
<span class="uname">{spec.name}</span>
<span class="uvp">{spec.vp} VP</span>
<span class="uprice">
min {spec.price}{#if due < spec.price}
· you pay {due}{/if}
min ◈ {spec.price}{#if due < spec.price}
· you pay ◈ {due}{/if}
</span>
<UpgradeBadges {upgrade} />
<span class="ueffect">{UPGRADE_EFFECTS[upgrade]}</span>
</button>
{#if open && pick}
@ -67,7 +69,7 @@
<button onclick={() => store.bumpAuctionBid(5)}>+5</button>
</div>
<div class="bidrow">
<button class="confirm" onclick={() => store.confirmAuction()}>Auction at {pick.bid}</button>
<button class="confirm" onclick={() => store.confirmAuction()}>Auction at ◈ {pick.bid}</button>
<button class="cancel" onclick={() => store.cancel()}>Cancel</button>
</div>
</div>

View file

@ -0,0 +1,84 @@
<script lang="ts">
import {
FACTORIES,
FACTORY_TYPES,
MAX_CARD_VALUE,
MIN_CARD_VALUE,
UPGRADE_SPECS,
type Upgrade,
} from "outpost-engine";
import ResourceIcon from "./ResourceIcon.svelte";
import { RESOURCE_LABELS } from "./store.svelte";
interface Props {
upgrade: Upgrade;
}
let { upgrade }: Props = $props();
const spec = $derived(UPGRADE_SPECS[upgrade]);
const unlocks = $derived(FACTORY_TYPES.filter((t) => FACTORIES[t].requires === upgrade));
</script>
<div class="badges">
{#if spec.produces}
<span
class="badge res-{spec.produces}"
title="Produces a {RESOURCE_LABELS[spec.produces]} card each round (per copy)"
>
<ResourceIcon resource={spec.produces} size={11} />
+1 card/round ({MIN_CARD_VALUE[spec.produces]}–{MAX_CARD_VALUE[spec.produces]})
</span>
{/if}
{#each unlocks as type (type)}
<span
class="badge res-{type}"
title="Unlocks {RESOURCE_LABELS[type]} factories (◈ {FACTORIES[type].cost} each, {FACTORIES[type].vp} VP manned)"
>
<ResourceIcon resource={type} size={11} />
unlocks factory
</span>
{/each}
{#if spec.freeFactory}
<span class="badge res-{spec.freeFactory}" title="Comes with a free {RESOURCE_LABELS[spec.freeFactory]} factory">
<ResourceIcon resource={spec.freeFactory} size={11} />
free factory
</span>
{/if}
{#if spec.handCapacityBonus}
<span class="badge" title="+{spec.handCapacityBonus} hand capacity (per copy)">🂠 +{spec.handCapacityBonus}</span>
{/if}
{#if spec.populationBonus}
<span class="badge" title="+{spec.populationBonus} population limit (per copy)">👤 +{spec.populationBonus}</span>
{/if}
{#if upgrade === "robots"}
<span class="badge" title="Allows buying robots (◈ 10 each)">🤖 buy robots</span>
{/if}
{#if upgrade === "ecoplants"}
<span class="badge" title="Colonists cost 5 instead of 10">👤 cost ◈ 5</span>
{/if}
</div>
<style>
.badges {
display: flex;
flex-wrap: wrap;
gap: 4px;
}
.badge {
display: inline-flex;
align-items: center;
gap: 4px;
font-size: 10.5px;
font-weight: 700;
color: var(--text);
background: color-mix(in srgb, var(--res, var(--text-dim)) 14%, transparent);
border: 1px solid color-mix(in srgb, var(--res, var(--text-dim)) 45%, transparent);
border-radius: 5px;
padding: 1.5px 6px;
line-height: 1.4;
}
.badge :global(.res-icon) {
color: var(--res, var(--text));
}
</style>