Add pregame lobby with live chat

Players used to get bounced back to the dashboard when a session
wasn't full yet. Now they land on a lobby page showing who has
joined, and can chat with each other while waiting - messages are
broadcast live over the existing Mercure hub, and the session
auto-starts (and the lobby notifies everyone) once it fills up.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Frank
2026-08-10 15:32:23 +02:00
co-authored by Claude Sonnet 5
parent 98cf48b29d
commit 444f54b6c6
7 changed files with 301 additions and 4 deletions
+11 -2
View File
@@ -141,12 +141,21 @@ final class GameController extends AbstractController
return $this->redirectToRoute('game', ['session' => $session->getId()]);
}
if ($request->isMethod('POST') && $request->request->has('send_message')) {
$dashboardService->postLobbyMessage($session, $user, (string) $request->request->get('content', ''));
return $this->redirectToRoute('game', ['session' => $session->getId()]);
}
// Lazily pick up readiness changes from other players since our last request
$dashboardService->checkAllPlayersReady($session);
if ($session->getStatus() === SessionStatus::CREATED) {
$this->addFlash('info', 'This session is still waiting for more players to join.');
return $this->redirectToRoute('game_dashboard');
return $this->render('game/lobby.html.twig', [
'session' => $session,
'messages' => $dashboardService->getLobbyMessages($session),
'player' => $player,
'mercure_public_url' => $this->mercurePublicUrl,
]);
}
if ($session->getStatus() === SessionStatus::WON) {