Adapt + improve all admin pages to the new design system
Swept the whole housekeeping panel (34 pages) so it's a consistent, improved adaptation of the old Filament admin rather than bare tables: - Live status tiles (StatusCard) summarising each page's data — counts and stateful metrics (users online, active/permanent bans, pending applications, settings, radio shouts, etc.). - Status pills (admin-badge ok/danger) replacing ad-hoc text: online/ offline, account/ip ban types, permanent vs timed, command OK/FAIL, alert severity & read/new, enabled/disabled, open/closed. - Sections wrapped in .admin-section with h2 headers; redundant inline table styling removed (the global .admin layer handles it). - alerts/logs/emulator hand-built as the reference pattern; the rest via parallel agents that read the schema and preserved every server action, query and field name. Behaviour unchanged (same actions, queries, field names). Verified in a real authed admin session (prod, amx_test): pages render with live data (Users tiles show 7 real accounts + online/offline pills), no errors. tsc 0, vitest 49/49, next build 0.
This commit is contained in:
1 parent
d419731566
commit
0de0ac6a3c
34 files changed
+2357
-1396
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import Link from "next/link";
|
||||
import { StatusCard } from "@/components/admin/dashboard";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
@@ -60,9 +61,23 @@ export default async function AdminRooms({
|
||||
const qs = (p: number) =>
|
||||
`/admin/rooms?q=${encodeURIComponent(q)}&page=${p}`;
|
||||
|
||||
// Page-local tallies (the full counts aren't fetched to keep the query cheap).
|
||||
const openOnPage = rooms.filter((r) => r.state === "open").length;
|
||||
const usersOnPage = rooms.reduce((sum, r) => sum + r.users, 0);
|
||||
|
||||
return (
|
||||
<main>
|
||||
<h1>Rooms</h1>
|
||||
<p className="muted" style={{ marginTop: "-0.4rem" }}>
|
||||
{q ? `Matching "${q}" · ` : ""}
|
||||
{total} room{total === 1 ? "" : "s"} total.
|
||||
</p>
|
||||
|
||||
<div className="admin-stats">
|
||||
<StatusCard label={q ? "Matching rooms" : "Total rooms"} value={total} icon="🏠" />
|
||||
<StatusCard label="Open (this page)" value={openOnPage} state="ok" icon="🔓" />
|
||||
<StatusCard label="Users in-room (this page)" value={usersOnPage} icon="👥" />
|
||||
</div>
|
||||
|
||||
<form style={{ display: "flex", gap: "0.5rem", marginBottom: "1rem" }}>
|
||||
<input name="q" defaultValue={q} placeholder="Search room or owner" />
|
||||
@@ -86,7 +101,7 @@ export default async function AdminRooms({
|
||||
<tbody>
|
||||
{rooms.map((r) => (
|
||||
<tr key={r.id}>
|
||||
<td>{r.id}</td>
|
||||
<td className="muted">{r.id}</td>
|
||||
<td>
|
||||
<Link href={`/admin/rooms/${r.id}`}>{r.name || "(unnamed)"}</Link>
|
||||
</td>
|
||||
@@ -94,7 +109,11 @@ export default async function AdminRooms({
|
||||
<td>
|
||||
{r.users} / {r.usersMax}
|
||||
</td>
|
||||
<td>{r.state}</td>
|
||||
<td>
|
||||
<span className={`admin-badge ${r.state === "open" ? "ok" : "danger"}`}>
|
||||
{r.state}
|
||||
</span>
|
||||
</td>
|
||||
<td>{r.category}</td>
|
||||
</tr>
|
||||
))}
|
||||
|
||||
Reference in new issue
Block a user