Add niche admin + public expansions + self-host Nunito font (batches 3-4)

Built via two more parallel agent workflows (read schema -> return files),
integrated + verified.

Admin: /admin/emulator (emulator_settings + emulator_texts key/value editor),
/admin/badges (give-badge via RCON), /admin/rare-values (CRUD), /admin/housekeeping
(CRUD), /admin/email-templates (CRUD), /admin/photos (moderation).
Public: /rares (+[category]), /leaderboard (credits/diamonds/duckets),
/guilds (+[id] members), /redeem (voucher -> sendCurrency).
Expanded: /u/[username] now shows badges + photos + guestbook (post form);
/news/[slug] now shows reactions + comments (comment form). Reactions tallied
in JS (Prisma groupBy typing avoided).
Self-hosted Nunito via next/font/google wired to --font-nunito (the atom theme
font, no runtime external fetch). Header + admin nav extended.

Verified: tsc exit 0, vitest 48/48, next build exit 0.
This commit is contained in:
Simo committed 2026-06-28 13:44:23 +02:00
1 parent e96b606e1e
commit e8be0461d8
28 files changed
+2347 -5

No files matched your search

+83
View File
@@ -0,0 +1,83 @@
import { giveBadge } from "@/actions/admin-badges";
import { prisma } from "@/lib/prisma";
export const dynamic = "force-dynamic";
export default async function AdminBadges() {
let badges: Awaited<ReturnType<typeof prisma.websiteBadges.findMany>> = [];
try {
badges = await prisma.websiteBadges.findMany({
orderBy: { badgeName: "asc" },
take: 500,
});
} catch {
badges = [];
}
return (
<main>
<h1>Badges</h1>
<p className="muted">
Website badge catalogue (<code>website_badges</code>). Granting fires the emulator
<code> givebadge</code> RCON command and records the badge in <code>users_badges</code>.
</p>
<form action={giveBadge} className="card" style={{ marginBottom: "1.5rem" }}>
<h3 style={{ marginTop: 0 }}>Give badge to user</h3>
<div style={{ display: "flex", gap: "0.5rem", flexWrap: "wrap", alignItems: "center" }}>
<input name="userId" type="number" min={1} placeholder="User ID" required />
<input
name="code"
placeholder="Badge code (e.g. ADM)"
required
maxLength={32}
style={{ flex: 1, minWidth: 160 }}
list="badge-codes"
/>
<datalist id="badge-codes">
{badges.map((b) => (
<option key={String(b.id)} value={b.badgeKey}>
{b.badgeName}
</option>
))}
</datalist>
<button type="submit" className="btn btn-primary">
Give badge
</button>
</div>
</form>
<table>
<thead>
<tr>
<th>Code</th>
<th>Name</th>
<th>Description</th>
<th />
</tr>
</thead>
<tbody>
{badges.map((b) => (
<tr key={String(b.id)}>
<td>
<code>{b.badgeKey}</code>
</td>
<td>{b.badgeName}</td>
<td className="muted">{b.badgeDescription}</td>
<td>
<form action={giveBadge} style={{ display: "flex", gap: "0.4rem", alignItems: "center" }}>
<input type="hidden" name="code" value={b.badgeKey} />
<input name="userId" type="number" min={1} placeholder="User ID" required style={{ width: 90 }} />
<button type="submit" className="btn btn-outline">
Give
</button>
</form>
</td>
</tr>
))}
</tbody>
</table>
{badges.length === 0 ? <p className="muted">No badges in the catalogue.</p> : null}
</main>
);
}