From 2f5ba701b6d09e6bf538d203ea775ad41ec68ca2 Mon Sep 17 00:00:00 2001 From: thibaud-leclere Date: Mon, 30 Mar 2026 19:55:32 +0200 Subject: [PATCH] feat: wrap game in centered card, style abandon button, abandon anonymous game on login Co-Authored-By: Claude Opus 4.6 (1M context) --- assets/styles/app.css | 23 +++++++++-- .../AbandonAnonymousGameOnLoginListener.php | 39 +++++++++++++++++++ templates/homepage/index.html.twig | 24 ++++++------ 3 files changed, 71 insertions(+), 15 deletions(-) create mode 100644 src/EventListener/AbandonAnonymousGameOnLoginListener.php diff --git a/assets/styles/app.css b/assets/styles/app.css index e870a69..52e4de9 100644 --- a/assets/styles/app.css +++ b/assets/styles/app.css @@ -487,19 +487,34 @@ body { color: #16a34a; } +/* ── Game card ── */ + +.game-container { + max-width: fit-content; + margin: 56px auto; + padding: 24px 32px 32px; + background: var(--surface); + border: 1px solid var(--border); + border-radius: var(--radius-lg); + box-shadow: 0 4px 32px var(--shadow-warm); +} + +.game-container #actors { + margin: 16px auto 0; +} + /* ── Game actions ── */ .game-actions { display: flex; - justify-content: flex-end; - padding: 12px 40px 0; + justify-content: flex-start; } .btn-abandon { padding: 7px 16px; background: none; - color: var(--text-muted); - border: 1.5px solid var(--border); + color: #dc2626; + border: 1.5px solid #dc2626; border-radius: 100px; font-family: 'Inter', sans-serif; font-size: 13px; diff --git a/src/EventListener/AbandonAnonymousGameOnLoginListener.php b/src/EventListener/AbandonAnonymousGameOnLoginListener.php new file mode 100644 index 0000000..267fa92 --- /dev/null +++ b/src/EventListener/AbandonAnonymousGameOnLoginListener.php @@ -0,0 +1,39 @@ +getRequest()->getSession(); + $gameId = $session->get('current_game_id'); + + if (!$gameId) { + return; + } + + $game = $this->gameRepository->find($gameId); + + if ($game && $game->getStatus() === Game::STATUS_IN_PROGRESS) { + $game->abandon(); + $this->em->flush(); + } + + $session->remove('current_game_id'); + } +} diff --git a/templates/homepage/index.html.twig b/templates/homepage/index.html.twig index 6cb0df7..ee0e2b1 100644 --- a/templates/homepage/index.html.twig +++ b/templates/homepage/index.html.twig @@ -2,18 +2,20 @@ {% block body %} {% if game %} -
-
- - -
-
+
+
+
+ + +
+
-
+
+
{% else %}