From e7db19f27e57ebc7f29ad2d706ebcd47075e19d1 Mon Sep 17 00:00:00 2001 From: Tim McCarthy Date: Fri, 12 Jun 2026 21:58:07 -0700 Subject: [PATCH] Let players voluntarily leave a game MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a "🚪 Leave Game" option to the corner menu for every player, so someone who's done can remove themselves instead of waiting for an admin to kick them. leave_game reuses the kick mechanics (cards to discard, reference cleanup, phase re-check) via a shared _remove_player helper; it logs a friendlier "left the crew" event and, like kick, refuses the last Admin so the table isn't orphaned. The self-service route POST /game/{gid}/player/{pid}/leave lives next to join and authenticates on the player's own id (no admin key). The handler confirms, forgets the saved session, and routes home. Co-Authored-By: Claude Opus 4.8 --- frontend/src/pages/Dashboard.svelte | 22 ++++++++- src/pirats/crud_upkeep.py | 59 +++++++++++++++--------- src/pirats/main.py | 14 +++++- tests/test_game.py | 70 +++++++++++++++++++++++++++++ 4 files changed, 141 insertions(+), 24 deletions(-) diff --git a/frontend/src/pages/Dashboard.svelte b/frontend/src/pages/Dashboard.svelte index 98d8556..946d705 100644 --- a/frontend/src/pages/Dashboard.svelte +++ b/frontend/src/pages/Dashboard.svelte @@ -1,11 +1,12 @@