Show friendly session status labels on the player dashboard

Players saw the raw enum value (e.g. "created") in the sessions
table, which doesn't mean anything to them. Adds SessionStatus::label()
mapping each status to a player-facing description like "Waiting for
players".
This commit is contained in:
Frank
2026-08-10 14:58:01 +02:00
parent fc93486367
commit f6df9f7ba6
2 changed files with 12 additions and 1 deletions
+11
View File
@@ -9,4 +9,15 @@ enum SessionStatus: string
case PLAYING = 'playing';
case WON = 'won';
case LOST = 'lost';
public function label(): string
{
return match ($this) {
self::CREATED => 'Waiting for players',
self::READY => 'Waiting for players to be ready',
self::PLAYING => 'In progress',
self::WON => 'Completed - Won',
self::LOST => 'Completed - Lost',
};
}
}
+1 -1
View File
@@ -67,7 +67,7 @@
<tr>
<td>{{ session.id }}</td>
<td>{{ session.game.name }}</td>
<td><span class="badge bg-info text-dark">{{ session.status.value }}</span></td>
<td><span class="badge bg-info text-dark">{{ session.status.label }}</span></td>
<td>{{ session.created|date('Y-m-d H:i') }}</td>
<td>
{% set inviteCode = '' %}