Decouple admin from public max-w-7xl via (site) route group.
Local Build and Deploy / deploy (push) Successful in 54s

Public chrome and width live only under (site). /admin and /client inherit the root layout alone, so housekeeping width is no longer tied to the public template.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
SimoandCursor committed 2026-07-15 21:12:52 +02:00
1 parent a1dc7ff0a7
commit 367f69a439
60 files changed
+29 -30

No files matched your search

@@ -0,0 +1,97 @@
import Link from "next/link";
import { notFound } from "next/navigation";
import { getTranslations } from "next-intl/server";
import { ContentCard } from "@/components/public/ui";
import { prisma } from "@/lib/prisma";
export const revalidate = 300;
function formatDate(d: Date | null | undefined): string {
return d ? d.toISOString().slice(0, 19).replace("T", " ") : "";
}
export default async function RadioGiveawayDetailPage({
params,
}: {
params: Promise<{ id: string }>;
}) {
const { id } = await params;
await getTranslations("pages.radioGiveaways");
let giveawayId: bigint;
try {
giveawayId = BigInt(id);
} catch {
notFound();
}
const giveaway = await prisma.radioGiveaways
.findUnique({ where: { id: giveawayId } })
.catch(() => null);
if (!giveaway) notFound();
const active = giveaway.isActive ? "Active" : "Ended";
const prizeStr =
giveaway.prize ||
(giveaway.prizeAmount > 0
? `${giveaway.prizeAmount} ${giveaway.prizeCurrency || "credits"}`
: null);
return (
<main style={{ display: "grid", gap: "1.5rem" }}>
<p className="muted" style={{ margin: 0 }}>
<Link href="/radio/giveaways">← Back to giveaways</Link>
</p>
<ContentCard
icon="🎁"
title={giveaway.title || `Giveaway #${giveaway.id}`}
subtitle={active}
>
<table style={{ width: "100%" }}>
<tbody>
{giveaway.description ? (
<tr>
<th style={{ verticalAlign: "top", width: 120 }}>
Description
</th>
<td>{giveaway.description}</td>
</tr>
) : null}
{prizeStr ? (
<tr>
<th>Prize</th>
<td>{prizeStr}</td>
</tr>
) : null}
<tr>
<th>Period</th>
<td>
{giveaway.startDate ? formatDate(giveaway.startDate) : "—"}
{" — "}
{giveaway.endDate ? formatDate(giveaway.endDate) : "ongoing"}
</td>
</tr>
<tr>
<th>Created</th>
<td>
{formatDate(giveaway.createdAt) || (
<span className="muted">—</span>
)}
</td>
</tr>
<tr>
<th>Updated</th>
<td>
{formatDate(giveaway.updatedAt) || (
<span className="muted">—</span>
)}
</td>
</tr>
</tbody>
</table>
</ContentCard>
</main>
);
}
+88
View File
@@ -0,0 +1,88 @@
import Link from "next/link";
import { getTranslations } from "next-intl/server";
import { ContentCard, EmptyState } from "@/components/public/ui";
import { prisma } from "@/lib/prisma";
export const revalidate = 300;
function formatDate(d: Date | null | undefined): string {
return d ? d.toISOString().slice(0, 10) : "";
}
export default async function RadioGiveawaysPage() {
const t = await getTranslations("pages.radioGiveaways");
const giveaways = await prisma.radioGiveaways
.findMany({
where: { isActive: true },
orderBy: { startDate: "desc" },
take: 50,
select: {
id: true,
title: true,
prize: true,
prizeAmount: true,
prizeCurrency: true,
startDate: true,
endDate: true,
},
})
.catch(() => []);
return (
<main style={{ display: "grid", gap: "1.5rem" }}>
<ContentCard icon="🎁" title={t("title")} subtitle={t("subtitle")} />
<ContentCard padded={giveaways.length === 0}>
{giveaways.length === 0 ? (
<EmptyState icon="🎁">{t("empty")}</EmptyState>
) : (
<div className="card-grid sm-2 lg-3" style={{ padding: "1rem" }}>
{giveaways.map((g) => {
const id = g.id.toString();
const prizeStr =
g.prize ||
(g.prizeAmount > 0
? `${g.prizeAmount} ${g.prizeCurrency || "credits"}`
: null);
return (
<Link
key={id}
href={`/radio/giveaways/${id}`}
className="card hover"
style={{
color: "inherit",
textDecoration: "none",
display: "grid",
gap: "0.3rem",
}}
>
<h3 style={{ margin: 0, fontSize: "1rem" }}>
<span aria-hidden>🎁</span>{" "}
{g.title || t("giveawayLabel", { id })}
</h3>
{prizeStr ? (
<p
className="muted"
style={{ margin: 0, fontSize: "0.9rem" }}
>
Prize: {prizeStr}
</p>
) : null}
<p
className="muted"
style={{ margin: 0, fontSize: "0.85rem" }}
>
{g.startDate
? `${formatDate(g.startDate)} — ${g.endDate ? formatDate(g.endDate) : "ongoing"}`
: t("dateUnknown")}
</p>
</Link>
);
})}
</div>
)}
</ContentCard>
</main>
);
}