Admin panels
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
{% extends 'game/admin/base.html.twig' %}
|
||||
|
||||
{% block title %}Sessions — 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;">Sessions</h1>
|
||||
<span style="color: #64748b; font-size: 0.9rem;">{{ sessions|length }} total</span>
|
||||
</div>
|
||||
|
||||
<div style="background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.07); overflow: hidden;">
|
||||
<table style="width: 100%; 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;">Game</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;">Players</th>
|
||||
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Created</th>
|
||||
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for session in sessions %}
|
||||
{% set statusColors = {
|
||||
'created': '#ede9fe:#5b21b6',
|
||||
'ready': '#fef3c7:#92400e',
|
||||
'playing': '#dbeafe:#1e40af',
|
||||
'won': '#dcfce7:#166534',
|
||||
'lost': '#fee2e2:#991b1b',
|
||||
} %}
|
||||
{% set colors = (statusColors[session.status.value] ?? '#f1f5f9:#475569')|split(':') %}
|
||||
|
||||
<tr style="border-bottom: 1px solid #f1f5f9;">
|
||||
<td style="padding: 0.75rem 1rem; color: #94a3b8;">{{ session.id }}</td>
|
||||
<td style="padding: 0.75rem 1rem; font-weight: 500; color: #0f172a;">{{ session.game.name }}</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] }};
|
||||
">{{ session.status.value }}</span>
|
||||
</td>
|
||||
<td style="padding: 0.75rem 1rem; color: #475569;">
|
||||
{{ session.players|map(p => p.user.username)|join(', ') ?: '—' }}
|
||||
<span style="color: #94a3b8;">({{ session.players|length }}/{{ session.game.numberOfPlayers }})</span>
|
||||
</td>
|
||||
<td style="padding: 0.75rem 1rem; color: #475569;">{{ session.created|date('Y-m-d H:i') }}</td>
|
||||
<td style="padding: 0.75rem 1rem; white-space: nowrap;">
|
||||
<a href="{{ path('game_admin_view_session', {session: session.id}) }}" style="color: #3b82f6; text-decoration: none; font-size: 0.85rem; margin-right: 0.75rem;">View logs</a>
|
||||
|
||||
{% if session.status.value not in ['won', 'lost'] %}
|
||||
<form method="post" action="{{ path('game_admin_session_close', {id: session.id}) }}" style="display: inline;" onsubmit="return confirm('Force-close session #{{ session.id }}?')">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('close_session_' ~ session.id) }}">
|
||||
<button type="submit" style="
|
||||
background: none;
|
||||
border: none;
|
||||
color: #ef4444;
|
||||
cursor: pointer;
|
||||
font-size: 0.85rem;
|
||||
padding: 0;
|
||||
">Close</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="6" style="padding: 2rem; text-align: center; color: #94a3b8;">No sessions found.</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user