fix(offline): scope the medal treatment to hotseat only
CI / changes (pull_request) Successful in 1s
CI / unit (pull_request) Has been skipped
CI / integration (pull_request) Has been skipped
CI / ui (pull_request) Successful in 1m7s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m40s

Per owner: a vs_ai game (one human) keeps its 'you won/lost' status text
AND its lobby medal — the hidden-status + per-seat-medal treatment applies
only to hotseat, where 2-4 local players make a single 'you' meaningless.
isLocalGameId -> game.hotseat at the three call sites (statusBlock, seat
plaque, lobby card).
This commit is contained in:
Ilia Denisov
2026-07-07 15:00:59 +02:00
parent 0ed34c7720
commit 84d0385c95
3 changed files with 12 additions and 9 deletions
+5 -4
View File
@@ -1497,7 +1497,7 @@
{#if badge}<span class="unread-dot sbadge-dot" class:nudge={badge === 'nudge'}></span>{/if}
{#each view.game.seats as s (s.seat)}
<div class="seat" class:turn={view.game.toMove === s.seat && !gameOver} class:win={s.isWinner}>
<div class="nm" class:struck={seatBlocked(s)}>{#if gameOver && isLocalGameId(id)}<span class="medal" aria-hidden="true">{seatMedal(view.game, s.seat)}</span>{/if}{seatName(s)}</div>
<div class="nm" class:struck={seatBlocked(s)}>{#if gameOver && view.game.hotseat}<span class="medal" aria-hidden="true">{seatMedal(view.game, s.seat)}</span>{/if}{seatName(s)}</div>
<div class="sc" class:blockprompt={blockConfirm[s.seat]}>
{#if blockConfirm[s.seat]}{t('game.blockShort')}{:else if addConfirm[s.seat]}{t('game.addFriendShort')}{:else}{s.score}{/if}
</div>
@@ -1623,9 +1623,10 @@
<div class="status">
<span>{view.bagLen === 0 ? t('game.bagEmpty') : t('game.bag', { n: view.bagLen })}</span>
{#if gameOver}
<!-- A local (offline) game shows its result as per-seat medals on the plaques (below), not a
viewer-centric "you won/lost" — the outcome is not always about a single "you". -->
{#if !isLocalGameId(id)}<strong class="over">{resultText()}</strong>{/if}
<!-- A hotseat game shows its result as per-seat medals on the plaques (below), not a
viewer-centric "you won/lost" — with 2-4 local players there is no single "you". A vs_ai
game keeps the "you won/lost" text (one human). -->
{#if !view.game.hotseat}<strong class="over">{resultText()}</strong>{/if}
{:else if placement.pending.length === 0}
<span class="turn-ind">{view.game.hotseat ? t('hotseat.turnOf', { name: hotseatName(view.game.toMove) }) : isMyTurn ? t('game.yourTurn') : turnLabel()}</span>
{/if}
+3 -2
View File
@@ -33,8 +33,9 @@ export function resultBadge(game: GameView, myId: string): ResultBadge {
/**
* seatMedal returns a per-SEAT place emoji for a finished game (empty while it is still in progress),
* so a local (offline) game can show each player's medal on their plaque instead of a single
* viewer-centric "you won/lost". The winner takes the trophy; the rest place by score (a draw — no
* so a hotseat game can show each player's medal on their plaque instead of a single viewer-centric
* "you won/lost" (which is meaningless with 2-4 local players). The winner takes the trophy; the
* rest place by score (a draw — no
* winner — gives every seat the medal). Mirrors the ranking in resultBadge, keyed by seat not viewer.
*/
export function seatMedal(game: GameView, seat: number): string {
+4 -3
View File
@@ -354,10 +354,11 @@
>
</span>
<!-- Re-key on the per-card blink nonce so a repeat blink restarts the fade. A
local (offline) game shows no lobby medal — its result lives on the in-game
seat plaques, and resultBadge is viewer-centric (no seat matches the account). -->
hotseat game shows no lobby medal — its result lives on the in-game seat
plaques, and resultBadge is viewer-centric (no seat matches the account). A
vs_ai game keeps its medal (one human, a straightforward win/loss). -->
{#key blinkNonce.get(g.id) ?? 0}
<span class="emoji" class:blink={blinkingIds.has(g.id)}>{isLocalGameId(g.id) ? '' : resultBadge(g, myId).emoji}</span>
<span class="emoji" class:blink={blinkingIds.has(g.id)}>{g.hotseat ? '' : resultBadge(g, myId).emoji}</span>
{/key}
</button>
{#if group.finished || g.hotseat}