Reports: replace the table with a styled card list

The dense table row (avatar, name, time, reason/evidence, badges,
actions all crammed into one baseline-misaligned line) is now a
stacked list of report cards, matching the panel/avatar-chip language
used elsewhere on the site: a colored left border for quick status
scanning (green = active, muted = archived, gold on hover with a
slight lift), a header row with a 40px avatar and reporter subtitle,
reason/evidence in their own section, and a footer row for the
incident timestamp and the archive/delete actions.

Verified the user-filter dropdown still layers correctly above the new
cards, since each card now also uses backdrop-filter (same stacking-
context concern fixed previously via .panel-filter-bar's z-index).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Maaxxs 2026-09-20 02:56:32 +02:00
parent 6333e0533d
commit c720b0173d
3 changed files with 155 additions and 93 deletions

View file

@ -365,35 +365,97 @@ tr:hover td { background: var(--bg-panel-alt); }
white-space: nowrap;
}
/* --- Reports-Tabelle: eigene Zellen-Bausteine statt Inline-Styles --- */
/* --- Reports: Kartenliste statt Tabelle --- */
.report-reported-cell {
.report-list {
display: flex;
flex-direction: column;
gap: 0.85rem;
}
.report-card {
background: rgba(35, 35, 35, 0.62);
backdrop-filter: blur(8px);
-webkit-backdrop-filter: blur(8px);
border: 1px solid var(--border);
border-left-width: 3px;
border-left-color: var(--success);
border-radius: 10px;
padding: 1.1rem 1.35rem;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.report-card:hover {
border-top-color: var(--gold);
border-right-color: var(--gold);
border-bottom-color: var(--gold);
transform: translateY(-2px);
box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}
.report-card-archived {
border-left-color: var(--text-muted);
opacity: 0.7;
}
.report-card-archived:hover { opacity: 0.95; }
.report-card-main {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
flex-wrap: wrap;
}
.report-card-user {
display: flex;
align-items: center;
gap: 0.75rem;
min-width: 0;
}
.report-card-user-info {
display: flex;
flex-direction: column;
gap: 0.1rem;
min-width: 0;
}
.report-card-user-info strong {
font-size: 1.05rem;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.report-card-user-info .text-muted { font-size: 0.82rem; }
.report-card-badges {
display: flex;
align-items: center;
gap: 0.5rem;
flex-shrink: 0;
}
.report-time-secondary {
display: block;
margin-top: 0.2rem;
font-size: 0.78rem;
}
.report-reason {
max-width: 320px;
.report-card-body {
margin-top: 0.9rem;
padding-top: 0.9rem;
border-top: 1px dashed var(--border);
}
.report-reason-text {
white-space: pre-wrap;
line-height: 1.4;
line-height: 1.45;
}
.report-evidence {
display: flex;
align-items: center;
gap: 0.35rem;
margin-top: 0.5rem;
padding-top: 0.5rem;
gap: 0.4rem;
margin-top: 0.6rem;
padding-top: 0.6rem;
border-top: 1px dashed var(--border);
font-size: 0.82rem;
color: var(--text-muted);
@ -408,6 +470,18 @@ tr:hover td { background: var(--bg-panel-alt); }
overflow-wrap: anywhere;
}
.report-card-footer {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
flex-wrap: wrap;
margin-top: 0.9rem;
padding-top: 0.8rem;
border-top: 1px solid var(--border);
font-size: 0.8rem;
}
.text-button {
background: none;
border: none;

View file

@ -129,7 +129,7 @@
var triggerContent = document.getElementById('report-user-filter-trigger-content');
var panel = document.getElementById('report-user-filter-panel');
var options = panel ? panel.querySelectorAll('.user-filter-option') : [];
var rows = document.querySelectorAll('.report-row');
var rows = document.querySelectorAll('.report-card');
var emptyMessage = document.getElementById('report-filter-empty');
if (!wrapper || !trigger || !panel || !options.length || !rows.length) return;

View file

@ -146,93 +146,81 @@ include __DIR__ . '/includes/header.php';
<p class="text-muted"><?= e($emptyLabels[$status]) ?></p>
</div>
<?php else: ?>
<div class="panel">
<div class="table-scroll">
<table>
<thead>
<tr>
<th>Gemeldet</th>
<th>Melder</th>
<th>Zeitpunkt</th>
<th>Grund</th>
<th>Punkte</th>
<th>Status</th>
<?php if ($canManageReports): ?><th></th><?php endif; ?>
</tr>
</thead>
<tbody>
<?php foreach ($reports as $report): ?>
<?php
$reportId = (int) ($report['report_id'] ?? 0);
$reportedId = (int) ($report['reported_id'] ?? 0);
$reporterId = (int) ($report['reporter_id'] ?? 0);
$reportedUser = premade_avatar_user($reportedId, $linkedUsersByDiscordId, (string) ($report['reported_name'] ?? ''));
$reportedName = premade_name_for($reportedId, $namesByDiscordId, (string) ($report['reported_name'] ?? ''));
$reporterName = premade_name_for($reporterId, $namesByDiscordId, (string) ($report['reporter_name'] ?? ''));
$incidentTime = (string) ($report['incident_time'] ?? '');
$reason = (string) ($report['reason'] ?? '');
$evidence = trim((string) ($report['evidence'] ?? ''));
$points = (int) ($report['points'] ?? 1);
$isArchived = !empty($report['archived']);
$timestamp = (int) ($report['timestamp'] ?? 0);
?>
<?php $evidenceIsLink = $evidence !== '' && preg_match('#^https?://#i', $evidence) === 1; ?>
<tr class="report-row" data-reported-id="<?= $reportedId ?>">
<td>
<div class="report-reported-cell">
<?= avatar_html($reportedUser, 28) ?>
<div class="report-list">
<?php foreach ($reports as $report): ?>
<?php
$reportId = (int) ($report['report_id'] ?? 0);
$reportedId = (int) ($report['reported_id'] ?? 0);
$reporterId = (int) ($report['reporter_id'] ?? 0);
$reportedUser = premade_avatar_user($reportedId, $linkedUsersByDiscordId, (string) ($report['reported_name'] ?? ''));
$reportedName = premade_name_for($reportedId, $namesByDiscordId, (string) ($report['reported_name'] ?? ''));
$reporterName = premade_name_for($reporterId, $namesByDiscordId, (string) ($report['reporter_name'] ?? ''));
$incidentTime = (string) ($report['incident_time'] ?? '');
$reason = (string) ($report['reason'] ?? '');
$evidence = trim((string) ($report['evidence'] ?? ''));
$points = (int) ($report['points'] ?? 1);
$isArchived = !empty($report['archived']);
$timestamp = (int) ($report['timestamp'] ?? 0);
$evidenceIsLink = $evidence !== '' && preg_match('#^https?://#i', $evidence) === 1;
?>
<div class="report-card<?= $isArchived ? ' report-card-archived' : '' ?>" data-reported-id="<?= $reportedId ?>">
<div class="report-card-main">
<div class="report-card-user">
<?= avatar_html($reportedUser, 40) ?>
<div class="report-card-user-info">
<strong><?= e($reportedName) ?></strong>
<span class="text-muted">gemeldet von <?= e($reporterName) ?></span>
</div>
</td>
<td class="text-muted"><?= e($reporterName) ?></td>
<td class="text-muted">
<?= e($incidentTime) ?>
<?php if ($timestamp): ?><span class="report-time-secondary">gemeldet: <?= date('d.m.Y H:i', $timestamp) ?></span><?php endif; ?>
</td>
<td class="report-reason">
<div class="report-reason-text"><?= e($reason) ?></div>
<?php if ($evidence !== ''): ?>
<div class="report-evidence">
<?= icon($evidenceIsLink ? 'link' : 'edit') ?>
<?php if ($evidenceIsLink): ?>
<a href="<?= e($evidence) ?>" target="_blank" rel="noopener noreferrer">Beweis-Link</a>
<?php else: ?>
<span class="report-evidence-text"><?= e($evidence) ?></span>
<?php endif; ?>
</div>
<?php endif; ?>
</td>
<td><span class="badge"><?= $points ?> Pkt.</span></td>
<td>
</div>
<div class="report-card-badges">
<span class="badge"><?= $points ?> Pkt.</span>
<?php if ($isArchived): ?>
<span class="badge badge-disabled">Archiviert</span>
<?php else: ?>
<span class="badge badge-active">Aktiv</span>
<?php endif; ?>
</td>
<?php if ($canManageReports): ?>
<td class="actions">
<form method="post" action="/report_action.php" class="inline-form">
<?= csrf_field() ?>
<input type="hidden" name="report_id" value="<?= $reportId ?>">
<input type="hidden" name="action" value="<?= $isArchived ? 'unarchive' : 'archive' ?>">
<button type="submit" class="icon-button" title="<?= $isArchived ? 'Wiederherstellen' : 'Archivieren' ?>"><?= icon($isArchived ? 'restore' : 'archive') ?></button>
</form>
<form method="post" action="/report_action.php" class="inline-form" onsubmit="return confirm('Diesen Report wirklich endgültig löschen?');">
<?= csrf_field() ?>
<input type="hidden" name="report_id" value="<?= $reportId ?>">
<input type="hidden" name="action" value="delete">
<button type="submit" class="icon-button icon-button-danger" title="Löschen"><?= icon('trash') ?></button>
</form>
</td>
</div>
</div>
<div class="report-card-body">
<div class="report-reason-text"><?= e($reason) ?></div>
<?php if ($evidence !== ''): ?>
<div class="report-evidence">
<?= icon($evidenceIsLink ? 'link' : 'edit') ?>
<?php if ($evidenceIsLink): ?>
<a href="<?= e($evidence) ?>" target="_blank" rel="noopener noreferrer">Beweis-Link</a>
<?php else: ?>
<span class="report-evidence-text"><?= e($evidence) ?></span>
<?php endif; ?>
</div>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<p class="text-muted" id="report-filter-empty" hidden>Keine Reports passen zum Filter.</p>
</div>
</div>
<div class="report-card-footer">
<span class="text-muted">
Vorfall: <?= e($incidentTime) ?><?php if ($timestamp): ?> · gemeldet <?= date('d.m.Y H:i', $timestamp) ?><?php endif; ?>
</span>
<?php if ($canManageReports): ?>
<div class="actions">
<form method="post" action="/report_action.php" class="inline-form">
<?= csrf_field() ?>
<input type="hidden" name="report_id" value="<?= $reportId ?>">
<input type="hidden" name="action" value="<?= $isArchived ? 'unarchive' : 'archive' ?>">
<button type="submit" class="icon-button" title="<?= $isArchived ? 'Wiederherstellen' : 'Archivieren' ?>"><?= icon($isArchived ? 'restore' : 'archive') ?></button>
</form>
<form method="post" action="/report_action.php" class="inline-form" onsubmit="return confirm('Diesen Report wirklich endgültig löschen?');">
<?= csrf_field() ?>
<input type="hidden" name="report_id" value="<?= $reportId ?>">
<input type="hidden" name="action" value="delete">
<button type="submit" class="icon-button icon-button-danger" title="Löschen"><?= icon('trash') ?></button>
</form>
</div>
<?php endif; ?>
</div>
</div>
<?php endforeach; ?>
</div>
<p class="text-muted" id="report-filter-empty" hidden>Keine Reports passen zum Filter.</p>
<?php endif; ?>
<?php if ($canManageReports): ?>