New game_admin_game_new route/form (reuses AdminGameType, same pattern as editing a game's total time) so games - including the 3 upcoming Easy/Medium/Hard difficulty options - can be created through the admin panel instead of needing a direct DB insert. Also show each game's total time (in minutes) next to the player count in the "Create New Session" dropdown, since that's the actual difficulty signal players are choosing between - number of players alone didn't convey it. Difficulty itself needs no new session-level concept: each difficulty is just a separate Game row with its own TOTAL_TIME setting, which checkAllPlayersReady() already reads when starting the session's timer. Hint timing depending on difficulty is separate, upcoming work.
72 lines
3.9 KiB
Twig
72 lines
3.9 KiB
Twig
{% extends 'game/admin/base.html.twig' %}
|
|
|
|
{% block title %}Games — Admin{% endblock %}
|
|
|
|
{% block admin_body %}
|
|
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem;">
|
|
<h1 style="margin: 0; font-size: 1.5rem; color: #0f172a;">Games</h1>
|
|
<div style="display: flex; align-items: center; gap: 1rem;">
|
|
<span style="color: #64748b; font-size: 0.9rem;">{{ games|length }} total</span>
|
|
<a href="{{ path('game_admin_game_new') }}" style="
|
|
padding: 0.5rem 1rem;
|
|
background: #3b82f6;
|
|
color: #fff;
|
|
border-radius: 6px;
|
|
font-size: 0.85rem;
|
|
font-weight: 600;
|
|
text-decoration: none;
|
|
">+ New Game</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div style="background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.07); overflow: hidden;">
|
|
<table style="width: 100%; min-width: 620px; border-collapse: collapse; font-size: 0.9rem;">
|
|
<thead>
|
|
<tr style="background: #f1f5f9; border-bottom: 1px solid #e2e8f0;">
|
|
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">ID</th>
|
|
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Name</th>
|
|
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Players</th>
|
|
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Status</th>
|
|
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Sessions</th>
|
|
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for game in games %}
|
|
{% set statusColor = {
|
|
'inDevelopment': '#fef3c7:#92400e',
|
|
'locked': '#fee2e2:#991b1b',
|
|
'open': '#dcfce7:#166534',
|
|
} %}
|
|
{% set colors = (statusColor[game.status.value] ?? '#f1f5f9:#475569')|split(':') %}
|
|
|
|
<tr style="border-bottom: 1px solid #f1f5f9;">
|
|
<td style="padding: 0.75rem 1rem; color: #94a3b8;">{{ game.id }}</td>
|
|
<td style="padding: 0.75rem 1rem; font-weight: 500; color: #0f172a;">{{ game.name }}</td>
|
|
<td style="padding: 0.75rem 1rem; color: #475569;">{{ game.numberOfPlayers }}</td>
|
|
<td style="padding: 0.75rem 1rem;">
|
|
<span style="
|
|
display: inline-block;
|
|
padding: 0.2rem 0.6rem;
|
|
border-radius: 4px;
|
|
font-size: 0.75rem;
|
|
font-weight: 600;
|
|
background: {{ colors[0] }};
|
|
color: {{ colors[1] }};
|
|
">{{ game.status.value }}</span>
|
|
</td>
|
|
<td style="padding: 0.75rem 1rem; color: #475569;">{{ game.sessions|length }}</td>
|
|
<td style="padding: 0.75rem 1rem;">
|
|
<a href="{{ path('game_admin_game_edit', {id: game.id}) }}" style="color: #3b82f6; text-decoration: none; font-size: 0.85rem;">Edit</a>
|
|
</td>
|
|
</tr>
|
|
{% else %}
|
|
<tr>
|
|
<td colspan="6" style="padding: 2rem; text-align: center; color: #94a3b8;">No games found.</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% endblock %}
|