feat(engine): win-summary action hierarchy — Play Again, Watch, Share #164

Merged
funman300 merged 1 commits from feat/win-flow into master 2026-07-09 05:09:36 +00:00
Owner

Phase G of docs/ui-redesign-2026-07.md (independent of the settings-tabs/you-hub stack — based on master, one file: win_summary_plugin.rs).

What

  • Win modal now leads with a full-row primary Play Again (Enter accelerator kept), then secondary Watch Replay / Share Replay, with the score breakdown, time, XP, and achievements reading quietly below (Time demoted from headline to body/secondary).
  • Watch/Share reuse the global WatchReplayButton / CopyShareLinkButton markers from stats_plugin, so the existing handlers drive them — including the no-replay / no-share-URL toast fallbacks. New close_overlay_on_watch_replay collapses the celebration when Watch is pressed; Share keeps it open so the copy toast lands on the celebration screen.
  • Play Again reuses NewGameRequestEvent::default() (mode None = same mode; deal options come from Settings) — no new plumbing.

Bug fixed in scope

The old handler played history.replays.last() — with newest-first ordering that was the oldest replay, not the just-won game. Both actions now go through SelectedReplayIndex, which refresh_replay_history_on_win already snaps to 0 (newest) on every GameWonEvent.

Verification

  • 4 new headless tests (action presence; Play Again closes + fires new-game; Watch closes overlay; Share keeps it open) on a deterministic manual-clock fixture.
  • 921/921 engine tests green, clippy --all-targets -D warnings clean, fmt (re-verified during review).

Follow-up noted (not in this PR)

Watch from the You-hub Replays tab doesn't close that modal either — same wart, flagged for the menu-redesign dismissal sweep.

🤖 Generated with Claude Code

Phase G of `docs/ui-redesign-2026-07.md` (independent of the settings-tabs/you-hub stack — based on master, one file: `win_summary_plugin.rs`). ## What - Win modal now leads with a full-row primary **Play Again** (Enter accelerator kept), then secondary **Watch Replay** / **Share Replay**, with the score breakdown, time, XP, and achievements reading quietly below (Time demoted from headline to body/secondary). - Watch/Share reuse the global `WatchReplayButton` / `CopyShareLinkButton` markers from `stats_plugin`, so the existing handlers drive them — including the no-replay / no-share-URL toast fallbacks. New `close_overlay_on_watch_replay` collapses the celebration when Watch is pressed; Share keeps it open so the copy toast lands on the celebration screen. - Play Again reuses `NewGameRequestEvent::default()` (mode `None` = same mode; deal options come from Settings) — no new plumbing. ## Bug fixed in scope The old handler played `history.replays.last()` — with newest-first ordering that was the **oldest** replay, not the just-won game. Both actions now go through `SelectedReplayIndex`, which `refresh_replay_history_on_win` already snaps to 0 (newest) on every `GameWonEvent`. ## Verification - 4 new headless tests (action presence; Play Again closes + fires new-game; Watch closes overlay; Share keeps it open) on a deterministic manual-clock fixture. - 921/921 engine tests green, clippy `--all-targets -D warnings` clean, fmt (re-verified during review). ## Follow-up noted (not in this PR) Watch from the You-hub Replays tab doesn't close that modal either — same wart, flagged for the menu-redesign dismissal sweep. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
funman300 added 1 commit 2026-07-09 03:40:50 +00:00
Phase G of docs/ui-redesign-2026-07.md. The win modal now leads with
actions and reads the stats recap quietly below them:

- Play Again: primary, full-row, Enter accelerator unchanged; still
  fires NewGameRequestEvent::default() (same mode; deal options from
  Settings) so the rematch is one tap.
- Watch Replay / Share Replay: secondary pair reusing the global
  stats_plugin markers (WatchReplayButton / CopyShareLinkButton), so
  both act on the just-won replay — SelectedReplayIndex snaps to 0 on
  every win. This also fixes the old win-modal handler picking
  replays.last(), which after the newest-first history refactor was
  the OLDEST replay, not the newest.
- Watch closes the celebration overlay (new close_overlay_on_watch_-
  replay system); Share keeps it open and relies on the existing
  copy-feedback toasts.
- Stats recap (score breakdown reveal, time, XP, achievements) moves
  below the actions; the Time line drops from headline/primary to
  body/secondary styling.

Tests: 4 new (action presence, Play Again close+request, Watch closes,
Share keeps open) on a manual-clock fixture that steps the 0.5 s
celebration delay deterministically. Workspace suite green, workspace
clippy -D warnings clean, fmt applied.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
funman300 merged commit 5b5d587818 into master 2026-07-09 05:09:36 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: funman300/Ferrous-Solitaire#164