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,5 +1,6 @@
|
||||
import Link from "next/link";
|
||||
import { notFound, redirect } from "next/navigation";
|
||||
import { ContentCard } from "@/components/public/ui";
|
||||
import { auth } from "@/lib/auth";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import { postThread } from "@/actions/social";
|
||||
@@ -33,54 +34,55 @@ export default async function NewThreadPage({
|
||||
if (!guild) notFound();
|
||||
|
||||
return (
|
||||
<main>
|
||||
<p style={{ marginTop: 0 }}>
|
||||
<main style={{ display: "grid", gap: "1.5rem" }}>
|
||||
<p style={{ margin: 0 }}>
|
||||
<Link href={`/guilds/${guild.id}/forum`}>← Back to forum</Link>
|
||||
</p>
|
||||
|
||||
<h1 style={{ marginBottom: "0.25rem" }}>New thread</h1>
|
||||
<p className="muted" style={{ marginTop: 0 }}>
|
||||
in {guild.name || "Unnamed guild"} forum
|
||||
</p>
|
||||
<ContentCard
|
||||
icon="✍️"
|
||||
title="New thread"
|
||||
subtitle={`in ${guild.name || "Unnamed guild"} forum`}
|
||||
>
|
||||
<form action={postThread}>
|
||||
{/* Guild target drives the write; the author is taken from the session
|
||||
inside the action, never from this form. */}
|
||||
<input type="hidden" name="guildId" value={String(guild.id)} />
|
||||
|
||||
<form action={postThread} className="card" style={{ marginTop: "1rem" }}>
|
||||
{/* Guild target drives the write; the author is taken from the session
|
||||
inside the action, never from this form. */}
|
||||
<input type="hidden" name="guildId" value={String(guild.id)} />
|
||||
<label htmlFor="thread-subject" className="muted">
|
||||
Subject
|
||||
</label>
|
||||
<input
|
||||
id="thread-subject"
|
||||
name="subject"
|
||||
required
|
||||
maxLength={255}
|
||||
placeholder="Thread subject"
|
||||
style={{ width: "100%", margin: "0.4rem 0 0.9rem" }}
|
||||
/>
|
||||
|
||||
<label htmlFor="thread-subject" className="muted">
|
||||
Subject
|
||||
</label>
|
||||
<input
|
||||
id="thread-subject"
|
||||
name="subject"
|
||||
required
|
||||
maxLength={255}
|
||||
placeholder="Thread subject"
|
||||
style={{ width: "100%", margin: "0.4rem 0 0.9rem" }}
|
||||
/>
|
||||
<label htmlFor="thread-message" className="muted">
|
||||
Message
|
||||
</label>
|
||||
<textarea
|
||||
id="thread-message"
|
||||
name="message"
|
||||
required
|
||||
rows={8}
|
||||
placeholder="Write your opening post…"
|
||||
style={{ width: "100%", margin: "0.4rem 0 1rem", resize: "vertical" }}
|
||||
/>
|
||||
|
||||
<label htmlFor="thread-message" className="muted">
|
||||
Message
|
||||
</label>
|
||||
<textarea
|
||||
id="thread-message"
|
||||
name="message"
|
||||
required
|
||||
rows={8}
|
||||
placeholder="Write your opening post…"
|
||||
style={{ width: "100%", margin: "0.4rem 0 1rem", resize: "vertical" }}
|
||||
/>
|
||||
|
||||
<div style={{ display: "flex", gap: "0.5rem", alignItems: "center" }}>
|
||||
<button type="submit" className="btn btn-primary">
|
||||
Post thread
|
||||
</button>
|
||||
<Link href={`/guilds/${guild.id}/forum`} className="btn btn-outline">
|
||||
Cancel
|
||||
</Link>
|
||||
</div>
|
||||
</form>
|
||||
<div style={{ display: "flex", gap: "0.5rem", alignItems: "center" }}>
|
||||
<button type="submit" className="btn btn-primary">
|
||||
Post thread
|
||||
</button>
|
||||
<Link href={`/guilds/${guild.id}/forum`} className="btn btn-outline">
|
||||
Cancel
|
||||
</Link>
|
||||
</div>
|
||||
</form>
|
||||
</ContentCard>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import Link from "next/link";
|
||||
import { notFound } from "next/navigation";
|
||||
import { ContentCard, EmptyState } from "@/components/public/ui";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
@@ -89,22 +90,26 @@ export default async function GuildForumPage({
|
||||
const usernameById = new Map(users.map((u) => [u.id, u.username]));
|
||||
|
||||
return (
|
||||
<main>
|
||||
<p style={{ marginTop: 0 }}>
|
||||
<main style={{ display: "grid", gap: "1.5rem" }}>
|
||||
<p style={{ margin: 0 }}>
|
||||
<Link href={`/guilds/${guild.id}`}>← Back to guild</Link>
|
||||
</p>
|
||||
|
||||
<h1 style={{ marginBottom: "0.25rem" }}>
|
||||
{guild.name || "Unnamed guild"} — Forum
|
||||
</h1>
|
||||
<p className="muted" style={{ marginTop: 0 }}>
|
||||
{threads.length} {threads.length === 1 ? "thread" : "threads"}
|
||||
</p>
|
||||
<ContentCard
|
||||
icon="🗣️"
|
||||
title={`${guild.name || "Unnamed guild"} — Forum`}
|
||||
subtitle={`${threads.length} ${threads.length === 1 ? "thread" : "threads"}`}
|
||||
action={
|
||||
<Link href={`/guilds/${guild.id}/forum/new`} className="btn btn-primary">
|
||||
+ New thread
|
||||
</Link>
|
||||
}
|
||||
/>
|
||||
|
||||
{threads.length === 0 ? (
|
||||
<p className="muted">No threads in this forum yet.</p>
|
||||
) : (
|
||||
<div className="card" style={{ padding: 0 }}>
|
||||
<ContentCard padded={threads.length === 0}>
|
||||
{threads.length === 0 ? (
|
||||
<EmptyState icon="🗣️">No threads in this forum yet.</EmptyState>
|
||||
) : (
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -125,13 +130,13 @@ export default async function GuildForumPage({
|
||||
{t.subject?.trim() || "(no subject)"}
|
||||
</span>
|
||||
{t.pinned ? (
|
||||
<span className="muted" style={{ marginLeft: "0.5rem" }}>
|
||||
· Pinned
|
||||
<span className="online-badge online" style={{ marginLeft: "0.5rem" }}>
|
||||
📌 Pinned
|
||||
</span>
|
||||
) : null}
|
||||
{t.locked ? (
|
||||
<span className="muted" style={{ marginLeft: "0.5rem" }}>
|
||||
· Locked
|
||||
<span className="online-badge" style={{ marginLeft: "0.5rem" }}>
|
||||
🔒 Locked
|
||||
</span>
|
||||
) : null}
|
||||
</td>
|
||||
@@ -155,8 +160,8 @@ export default async function GuildForumPage({
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)}
|
||||
)}
|
||||
</ContentCard>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import Link from "next/link";
|
||||
import { notFound } from "next/navigation";
|
||||
import { ContentCard, EmptyState, StatBlock } from "@/components/public/ui";
|
||||
import { avatarImageUrl } from "@/lib/format";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import { siteSettings } from "@/lib/services/site-settings";
|
||||
@@ -118,74 +119,96 @@ export default async function GuildPage({
|
||||
const created = formatTimestamp(guild.dateCreated);
|
||||
|
||||
return (
|
||||
<main>
|
||||
<p style={{ marginTop: 0 }}>
|
||||
<main style={{ display: "grid", gap: "1.5rem" }}>
|
||||
<p style={{ margin: 0 }}>
|
||||
<Link href="/guilds">← All guilds</Link>
|
||||
</p>
|
||||
|
||||
<div
|
||||
className="card"
|
||||
style={{ display: "flex", gap: "1.25rem", alignItems: "flex-start" }}
|
||||
>
|
||||
{guild.badge ? (
|
||||
// eslint-disable-next-line @next/next/no-img-element
|
||||
<img
|
||||
src={`https://habbo-stories-content.s3.amazonaws.com/badge-part-images/${guild.badge}.gif`}
|
||||
alt={`${guild.name} badge`}
|
||||
width={48}
|
||||
height={48}
|
||||
style={{ flex: "0 0 auto" }}
|
||||
/>
|
||||
) : null}
|
||||
<div style={{ minWidth: 0 }}>
|
||||
<h1 style={{ margin: "0 0 0.25rem" }}>{guild.name || "Unnamed guild"}</h1>
|
||||
<p style={{ margin: "0 0 0.5rem" }}>
|
||||
{guild.description || <span className="muted">No description</span>}
|
||||
</p>
|
||||
<p className="muted" style={{ margin: 0 }}>
|
||||
{members.length} {members.length === 1 ? "member" : "members"}
|
||||
{created ? ` · Founded ${created}` : ""}
|
||||
</p>
|
||||
<ContentCard>
|
||||
<div style={{ display: "flex", gap: "1.25rem", alignItems: "flex-start" }}>
|
||||
{guild.badge ? (
|
||||
// eslint-disable-next-line @next/next/no-img-element
|
||||
<img
|
||||
src={`https://habbo-stories-content.s3.amazonaws.com/badge-part-images/${guild.badge}.gif`}
|
||||
alt={`${guild.name} badge`}
|
||||
width={48}
|
||||
height={48}
|
||||
style={{ flex: "0 0 auto" }}
|
||||
/>
|
||||
) : null}
|
||||
<div style={{ minWidth: 0, flex: 1 }}>
|
||||
<h1 style={{ margin: "0 0 0.35rem" }}>{guild.name || "Unnamed guild"}</h1>
|
||||
<p style={{ margin: 0 }}>
|
||||
{guild.description || <span className="muted">No description</span>}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2 style={{ marginTop: "1.5rem" }}>Members</h2>
|
||||
{members.length === 0 ? (
|
||||
<p className="muted">No members.</p>
|
||||
) : (
|
||||
<div className="grid cols-3">
|
||||
{members.map((m) => (
|
||||
<div
|
||||
key={m.userId}
|
||||
className="card"
|
||||
style={{ display: "flex", gap: "0.85rem", alignItems: "center" }}
|
||||
>
|
||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||
<img
|
||||
className="avatar"
|
||||
src={avatarImageUrl(imagerBase ?? "", m.look, { size: "l" })}
|
||||
alt={`${m.username} avatar`}
|
||||
width={50}
|
||||
height={75}
|
||||
style={{ flex: "0 0 auto" }}
|
||||
/>
|
||||
<div style={{ minWidth: 0 }}>
|
||||
<h3 style={{ margin: "0 0 0.15rem" }}>
|
||||
<Link href={`/u/${m.username}`}>{m.username}</Link>
|
||||
</h3>
|
||||
{m.isOwner ? (
|
||||
<p className="muted" style={{ margin: "0 0 0.15rem" }}>
|
||||
Owner
|
||||
</p>
|
||||
) : null}
|
||||
<p className="muted" style={{ margin: 0 }}>
|
||||
{m.motto || "No motto"}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
<div className="stat-grid" style={{ marginTop: "1.1rem" }}>
|
||||
<StatBlock
|
||||
icon="👥"
|
||||
value={members.length}
|
||||
label={members.length === 1 ? "Member" : "Members"}
|
||||
/>
|
||||
{created ? <StatBlock icon="📅" value={created} label="Founded" /> : null}
|
||||
<StatBlock
|
||||
icon="🚪"
|
||||
value={
|
||||
<Link href={`/guilds/${guild.id}/forum`} style={{ textDecoration: "none" }}>
|
||||
Forum →
|
||||
</Link>
|
||||
}
|
||||
label="Discussion"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</ContentCard>
|
||||
|
||||
<ContentCard
|
||||
icon="👥"
|
||||
title="Members"
|
||||
subtitle={`${members.length} ${members.length === 1 ? "member" : "members"}`}
|
||||
padded={members.length === 0}
|
||||
>
|
||||
{members.length === 0 ? (
|
||||
<EmptyState icon="👥">No members.</EmptyState>
|
||||
) : (
|
||||
<div className="card-grid sm-2 lg-3" style={{ padding: "1rem" }}>
|
||||
{members.map((m) => (
|
||||
<div
|
||||
key={m.userId}
|
||||
className="card hover"
|
||||
style={{ display: "flex", gap: "0.85rem", alignItems: "center" }}
|
||||
>
|
||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||
<img
|
||||
className="avatar"
|
||||
src={avatarImageUrl(imagerBase ?? "", m.look, { size: "l" })}
|
||||
alt={`${m.username} avatar`}
|
||||
width={50}
|
||||
height={75}
|
||||
style={{ flex: "0 0 auto" }}
|
||||
/>
|
||||
<div style={{ minWidth: 0 }}>
|
||||
<h3 style={{ margin: "0 0 0.2rem", fontSize: "1rem" }}>
|
||||
<Link href={`/u/${m.username}`}>{m.username}</Link>
|
||||
</h3>
|
||||
{m.isOwner ? (
|
||||
<span
|
||||
className="online-badge online"
|
||||
style={{ marginBottom: "0.25rem" }}
|
||||
>
|
||||
👑 Owner
|
||||
</span>
|
||||
) : null}
|
||||
<p className="muted" style={{ margin: m.isOwner ? "0.25rem 0 0" : 0 }}>
|
||||
{m.motto || "No motto"}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</ContentCard>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
+49
-39
@@ -1,4 +1,5 @@
|
||||
import Link from "next/link";
|
||||
import { ContentCard, EmptyState } from "@/components/public/ui";
|
||||
import { excerpt } from "@/lib/format";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
|
||||
@@ -28,45 +29,54 @@ export default async function GuildsPage() {
|
||||
const guilds = await getGuilds();
|
||||
|
||||
return (
|
||||
<main>
|
||||
<h1>Guilds</h1>
|
||||
{guilds.length === 0 ? (
|
||||
<p className="muted">No guilds yet.</p>
|
||||
) : (
|
||||
<div className="grid cols-3">
|
||||
{guilds.map((g) => (
|
||||
<Link
|
||||
key={g.id}
|
||||
href={`/guilds/${g.id}`}
|
||||
className="card hover"
|
||||
style={{
|
||||
display: "flex",
|
||||
gap: "0.85rem",
|
||||
alignItems: "flex-start",
|
||||
color: "inherit",
|
||||
textDecoration: "none",
|
||||
}}
|
||||
>
|
||||
{g.badge ? (
|
||||
// eslint-disable-next-line @next/next/no-img-element
|
||||
<img
|
||||
src={`https://habbo-stories-content.s3.amazonaws.com/badge-part-images/${g.badge}.gif`}
|
||||
alt={`${g.name} badge`}
|
||||
width={40}
|
||||
height={40}
|
||||
style={{ flex: "0 0 auto" }}
|
||||
/>
|
||||
) : null}
|
||||
<div style={{ minWidth: 0 }}>
|
||||
<h3 style={{ margin: "0 0 0.25rem" }}>{g.name || "Unnamed guild"}</h3>
|
||||
<p className="muted" style={{ margin: 0 }}>
|
||||
{g.description ? excerpt(g.description, 120) : "No description"}
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
<main style={{ display: "grid", gap: "1.5rem" }}>
|
||||
<ContentCard
|
||||
icon="🚪"
|
||||
title="Guilds"
|
||||
subtitle="Browse the groups players have created and joined"
|
||||
/>
|
||||
|
||||
<ContentCard padded={guilds.length === 0}>
|
||||
{guilds.length === 0 ? (
|
||||
<EmptyState icon="🚪">No guilds yet.</EmptyState>
|
||||
) : (
|
||||
<div className="card-grid sm-2 lg-3" style={{ padding: "1rem" }}>
|
||||
{guilds.map((g) => (
|
||||
<Link
|
||||
key={g.id}
|
||||
href={`/guilds/${g.id}`}
|
||||
className="card hover"
|
||||
style={{
|
||||
display: "flex",
|
||||
gap: "0.85rem",
|
||||
alignItems: "flex-start",
|
||||
color: "inherit",
|
||||
textDecoration: "none",
|
||||
}}
|
||||
>
|
||||
{g.badge ? (
|
||||
// eslint-disable-next-line @next/next/no-img-element
|
||||
<img
|
||||
src={`https://habbo-stories-content.s3.amazonaws.com/badge-part-images/${g.badge}.gif`}
|
||||
alt={`${g.name} badge`}
|
||||
width={40}
|
||||
height={40}
|
||||
style={{ flex: "0 0 auto" }}
|
||||
/>
|
||||
) : null}
|
||||
<div style={{ minWidth: 0 }}>
|
||||
<h3 style={{ margin: "0 0 0.25rem", fontSize: "1rem" }}>
|
||||
{g.name || "Unnamed guild"}
|
||||
</h3>
|
||||
<p className="muted" style={{ margin: 0 }}>
|
||||
{g.description ? excerpt(g.description, 120) : "No description"}
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</ContentCard>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user