Adapt + improve all public pages to the atom design system
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.
This commit is contained in:
1 parent
0de0ac6a3c
commit
e9ea19795a
47 files changed
+2264
-1714
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { ContentCard, EmptyState, StatBlock } from "@/components/public/ui";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
@@ -58,76 +59,62 @@ export default async function MarketplacePage() {
|
||||
const total = offers.reduce((sum, o) => sum + o.price, 0);
|
||||
|
||||
return (
|
||||
<main>
|
||||
<section className="hero">
|
||||
<h1 style={{ marginTop: 0 }}>Marketplace</h1>
|
||||
<p className="muted" style={{ marginBottom: 0 }}>
|
||||
Browse furniture and rares listed by players. Listings are placed in-game
|
||||
and update live — head into the hotel to make an offer.
|
||||
</p>
|
||||
</section>
|
||||
<main style={{ display: "grid", gap: "1.5rem" }}>
|
||||
<ContentCard
|
||||
icon="🛍️"
|
||||
title="Marketplace"
|
||||
subtitle="Browse furniture and rares listed by players. Listings are placed in-game and update live — head into the hotel to make an offer."
|
||||
>
|
||||
<div className="stat-grid">
|
||||
<StatBlock value={offers.length.toLocaleString()} label="Active offers" icon="🏷️" />
|
||||
<StatBlock
|
||||
value={new Set(offers.map((o) => o.userId)).size.toLocaleString()}
|
||||
label="Sellers"
|
||||
icon="👥"
|
||||
/>
|
||||
<StatBlock value={`${total.toLocaleString()} cr`} label="Total value" icon="🪙" />
|
||||
</div>
|
||||
</ContentCard>
|
||||
|
||||
<div className="grid cols-3" style={{ marginBottom: "1.5rem" }}>
|
||||
<div className="card">
|
||||
<p className="muted" style={{ margin: 0 }}>
|
||||
Active offers
|
||||
</p>
|
||||
<p style={{ fontSize: "1.6rem", fontWeight: 800, margin: "0.15rem 0 0" }}>
|
||||
{offers.length}
|
||||
</p>
|
||||
</div>
|
||||
<div className="card">
|
||||
<p className="muted" style={{ margin: 0 }}>
|
||||
Sellers
|
||||
</p>
|
||||
<p style={{ fontSize: "1.6rem", fontWeight: 800, margin: "0.15rem 0 0" }}>
|
||||
{new Set(offers.map((o) => o.userId)).size}
|
||||
</p>
|
||||
</div>
|
||||
<div className="card">
|
||||
<p className="muted" style={{ margin: 0 }}>
|
||||
Total value
|
||||
</p>
|
||||
<p style={{ fontSize: "1.6rem", fontWeight: 800, margin: "0.15rem 0 0" }}>
|
||||
{total.toLocaleString()} cr
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{offers.length === 0 ? (
|
||||
<div className="card">
|
||||
<p className="muted" style={{ margin: 0 }}>
|
||||
<ContentCard
|
||||
icon="📋"
|
||||
title="Active listings"
|
||||
subtitle={offers.length > 0 ? "Most recently listed first" : undefined}
|
||||
padded={offers.length === 0}
|
||||
>
|
||||
{offers.length === 0 ? (
|
||||
<EmptyState icon="🛍️">
|
||||
There are no active marketplace offers right now. Check back later.
|
||||
</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className="card" style={{ padding: "0.5rem 1.25rem 0.75rem" }}>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Offer</th>
|
||||
<th>Item</th>
|
||||
<th>Seller</th>
|
||||
<th>Price</th>
|
||||
<th>Listed</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{offers.map((o) => (
|
||||
<tr key={o.id}>
|
||||
<td className="muted">#{o.id}</td>
|
||||
<td>Item #{o.itemId}</td>
|
||||
<td>{sellers.get(o.userId) ?? `User #${o.userId}`}</td>
|
||||
<td style={{ fontWeight: 700 }}>{o.price.toLocaleString()} cr</td>
|
||||
<td className="muted" title={listedAt(o.timestamp)}>
|
||||
{listedAgo(o.timestamp)}
|
||||
</td>
|
||||
</EmptyState>
|
||||
) : (
|
||||
<div style={{ padding: "0.25rem 1rem 0.75rem", overflowX: "auto" }}>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Offer</th>
|
||||
<th>Item</th>
|
||||
<th>Seller</th>
|
||||
<th>Price</th>
|
||||
<th>Listed</th>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)}
|
||||
</thead>
|
||||
<tbody>
|
||||
{offers.map((o) => (
|
||||
<tr key={o.id}>
|
||||
<td className="muted">#{o.id}</td>
|
||||
<td>Item #{o.itemId}</td>
|
||||
<td>{sellers.get(o.userId) ?? `User #${o.userId}`}</td>
|
||||
<td style={{ fontWeight: 700 }}>{o.price.toLocaleString()} cr</td>
|
||||
<td className="muted" title={listedAt(o.timestamp)}>
|
||||
{listedAgo(o.timestamp)}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)}
|
||||
</ContentCard>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user