Extended the same design-system treatment to the public site, faithful to AtomCMS's "atom" theme. New src/components/public/ui.tsx provides the signature atom building blocks + a scoped CSS layer: - ContentCard: surface card with a primary-tinted header (icon circle + title + subtitle) and padded body — the atom content-card, used as every page's header and section wrapper. - StatBlock / stat-grid, EmptyState, OnlineBadge (online/offline pill), RankBadge (medals for the top 3), and responsive .card-grid helpers. Swept ~45 public pages (home/community/rankings hand-built as the reference; the rest via parallel agents that read the schema and preserved every query, server action, auth gate and field name): heroes → ContentCard headers, lists → card-grids in ContentCards, "no X" → EmptyState, status → OnlineBadge/RankBadge. The leaderboard gained Credits/Diamonds/Duckets tabs (usersCurrency). Behaviour unchanged. Verified on the prod server against amx_test: 15+ public pages render the content-cards/grids with real data, no errors; computed styles confirm the tinted header, icon circle, medal + online pills. Fixed an undefined --color-golden ref. tsc 0, vitest 49/49, next build 0.
57 lines
1.8 KiB
TypeScript
57 lines
1.8 KiB
TypeScript
import Link from "next/link";
|
|
import { ContentCard, EmptyState } from "@/components/public/ui";
|
|
import { prisma } from "@/lib/prisma";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
function formatDate(d: Date | null | undefined): string {
|
|
return d ? d.toISOString().slice(0, 10) : "";
|
|
}
|
|
|
|
export default async function RadioContestsPage() {
|
|
// RadioContests.id is a BigInt — stringify before use in keys/routes.
|
|
const contests = await prisma.radioContests
|
|
.findMany({
|
|
orderBy: { createdAt: "desc" },
|
|
take: 50,
|
|
})
|
|
.catch(() => []);
|
|
|
|
return (
|
|
<main style={{ display: "grid", gap: "1.5rem" }}>
|
|
<ContentCard
|
|
icon="🎉"
|
|
title="Radio Contests"
|
|
subtitle="Tune in and take part in our latest on-air contests"
|
|
/>
|
|
|
|
<ContentCard padded={contests.length === 0}>
|
|
{contests.length === 0 ? (
|
|
<EmptyState icon="🎉">No contests yet.</EmptyState>
|
|
) : (
|
|
<div className="card-grid sm-2 lg-3" style={{ padding: "1rem" }}>
|
|
{contests.map((c) => {
|
|
const id = c.id.toString();
|
|
return (
|
|
<Link
|
|
key={id}
|
|
href={`/radio/contests/${id}`}
|
|
className="card hover"
|
|
style={{ color: "inherit", textDecoration: "none", display: "grid", gap: "0.3rem" }}
|
|
>
|
|
<h3 style={{ margin: 0, fontSize: "1rem" }}>
|
|
<span aria-hidden>🎉</span> Contest #{id}
|
|
</h3>
|
|
<p className="muted" style={{ margin: 0 }}>
|
|
{formatDate(c.createdAt) || "Date unknown"}
|
|
</p>
|
|
</Link>
|
|
);
|
|
})}
|
|
</div>
|
|
)}
|
|
</ContentCard>
|
|
</main>
|
|
);
|
|
}
|