Keep sealed bid revisions cancellable and show the submitted choice
This commit is contained in:
parent
0e5c173d9b
commit
a74c57e466
3 changed files with 56 additions and 5 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "outpost-viewer",
|
||||
"version": "0.1.19",
|
||||
"version": "0.1.20",
|
||||
"description": "Browser viewer for the Outpost game on boardgamers.space",
|
||||
"license": "AGPL-3.0",
|
||||
"files": [
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<script lang="ts">
|
||||
import { KICKER_SPECS, UPGRADE_SPECS, type GameState } from "outpost-engine";
|
||||
import CardEffect from "./CardEffect.svelte";
|
||||
import ChoiceButton from "./ChoiceButton.svelte";
|
||||
import { KICKER_EFFECTS, UPGRADE_EFFECTS, type ViewerStore } from "./store.svelte";
|
||||
|
||||
interface Props {
|
||||
|
|
@ -76,6 +77,11 @@
|
|||
<div class="unaffordable">
|
||||
<span class="cantbid">Minimum bid is ◈ {minBid}; your maximum is ◈ {maxBid}.</span>
|
||||
<button class="confirm" onclick={() => store.passBid()}>Pass</button>
|
||||
{#if store.changingChoice}<ChoiceButton
|
||||
label="Cancel"
|
||||
kind="cancel"
|
||||
onclick={() => store.cancel()}
|
||||
/>{/if}
|
||||
</div>
|
||||
{:else}
|
||||
<div class="bid-heading">
|
||||
|
|
@ -108,7 +114,11 @@
|
|||
>
|
||||
</div>
|
||||
<div class="actions">
|
||||
{#if store.changingChoice}<button class="pass" onclick={() => store.cancel()}>Cancel</button>{/if}
|
||||
{#if store.changingChoice}<ChoiceButton
|
||||
label="Cancel"
|
||||
kind="cancel"
|
||||
onclick={() => store.cancel()}
|
||||
/>{/if}
|
||||
{#if !fast || auction.auctioneer !== meIndex}<button class="pass" onclick={() => store.passBid()}
|
||||
>Pass</button
|
||||
>{/if}
|
||||
|
|
@ -129,9 +139,14 @@
|
|||
{/if}
|
||||
{:else if fast}
|
||||
{#if meIndex !== undefined && auction.bids?.[meIndex] !== undefined}
|
||||
<div class="turn">Bid submitted</div>
|
||||
{#if store.revisableChoice}<button class="confirm" onclick={() => store.changeChoice()}>Change bid</button
|
||||
>{/if}
|
||||
<div class="turn">
|
||||
Bid submitted · <strong>{auction.bids[meIndex] === 0 ? "Pass" : `◈ ${auction.bids[meIndex]}`}</strong>
|
||||
</div>
|
||||
{#if store.revisableChoice}<ChoiceButton
|
||||
label="Change bid"
|
||||
kind="edit"
|
||||
onclick={() => store.changeChoice()}
|
||||
/>{/if}
|
||||
{/if}
|
||||
<div class="waiting">Waiting for {pendingNames} to bid…</div>
|
||||
{:else}
|
||||
|
|
|
|||
36
packages/viewer/src/lib/ChoiceButton.svelte
Normal file
36
packages/viewer/src/lib/ChoiceButton.svelte
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<script lang="ts">
|
||||
let {
|
||||
label,
|
||||
kind,
|
||||
onclick,
|
||||
disabled = false,
|
||||
}: { label: string; kind: "edit" | "cancel"; onclick: () => void; disabled?: boolean } = $props();
|
||||
</script>
|
||||
|
||||
<button class="choice-button" aria-label={label} title={label} {onclick} {disabled}>
|
||||
<svg
|
||||
width="20"
|
||||
height="20"
|
||||
viewBox="0 0 20 20"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="1.8"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path d={kind === "edit" ? "M3 12L13 2L17 6L7 16L2 17Z M11 4L15 8" : "M4 4L16 16 M16 4L4 16"} />
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<style>
|
||||
.choice-button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 44px;
|
||||
min-height: 44px;
|
||||
padding: 6px;
|
||||
color: var(--text-mid);
|
||||
}
|
||||
</style>
|
||||
Loading…
Add table
Add a link
Reference in a new issue