Export all non-clue game actions, even after the game is won #3

Merged
max merged 1 commit from timotree/deck-website:export-actions-after-win into main 2025-08-14 22:02:23 +02:00
Collaborator

Prior to this change, there was a special case to avoid exporting any actions if the play stacks are complete. This has the unfortunate side effect that if a user has explicitly input any such play/discard actions, they are not captured in the page URL and therefore disappear upon refresh.

I believe the main motivation of the special case was to avoid exporting clue actions after a win (which are never explicitly input by the user anyway), but this is already accounted for in the exportToJSON function, which omits all clue actions after the last play/discard.

(This PR touches a line next to #2, so I based it on top of #2 and it must be merged afterwards.)

Prior to this change, there was a special case to avoid exporting any actions if the play stacks are complete. This has the unfortunate side effect that if a user has explicitly input any such play/discard actions, they are not captured in the page URL and therefore disappear upon refresh. I believe the main motivation of the special case was to avoid exporting clue actions after a win (which are never explicitly input by the user anyway), but this is already accounted for in the `exportToJSON` function, which omits all clue actions after the last play/discard. (This PR touches a line next to #2, so I based it on top of #2 and it must be merged afterwards.)
Empty slots in the hand are now represented by a `null` card.
I carefully checked every use of `state.hand` to make sure this is accounted for properly.
Fixes bugs where:
- Styles are not removed when a card becomes an empty slot.
- Importing a game crashes when it contains an action on a slot to the right of an empty slot.
- Updating the DOM crashes when a player clues and the next player's leftmost slot is empty.
  - In order to fix this, I changed the default rank clue to be the highest rank,
    rather than the rank of their leftmost slot.
Prior to this change, there was a special case to avoid exporting any actions if the play stacks are complete.
This has the unfortunate side effect that if a user has explicitly input any such play/discard actions,
they are not captured in the page URL and therefore disappear upon refresh.

I believe the main motivation of the special case was to avoid exporting clue actions after a win
(which are never explicitly input by the user anyway),
but this is already accounted for in the `exportToJSON` function,
which omits all clue actions after the last play/discard.
timotree changed title from WIP: Export all non-clue game actions, even after the game is won to Export all non-clue game actions, even after the game is won 2025-08-14 22:01:44 +02:00
max approved these changes 2025-08-14 22:02:19 +02:00
max merged commit ee745e4eb9 into main 2025-08-14 22:02:23 +02:00
Sign in to join this conversation.
No reviewers
max
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Hanabi/deck-website!3
No description provided.