Decouple admin from public max-w-7xl via (site) route group.

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

+158
View File
@@ -0,0 +1,158 @@
import { redirect } from "next/navigation";
import { getTranslations } from "next-intl/server";
import { applyDj } from "@/actions/radio-apply";
import { ContentCard } from "@/components/public/ui";
import { auth } from "@/lib/auth";
import { prisma } from "@/lib/prisma";
export const dynamic = "force-dynamic";
export default async function RadioApplyPage() {
const session = await auth();
if (!session?.user?.id) redirect("/login");
const t = await getTranslations("pages.radioApply");
const userId = Number(session.user.id);
// Surface the applicant's most recent application (if any) so they aren't
// left guessing. Isolated query: a DB hiccup degrades this to null, not 500.
const existing = await prisma.radioApplications
.findFirst({
where: { userId: BigInt(userId) },
orderBy: { id: "desc" },
select: { id: true, status: true, createdAt: true },
})
.catch(() => null);
const submittedDate = existing?.createdAt
? existing.createdAt.toISOString().slice(0, 10)
: null;
return (
<main style={{ display: "grid", gap: "1.5rem" }}>
<ContentCard icon="🎤" title={t("title")} subtitle={t("subtitle")} />
{existing ? (
<ContentCard icon="📋" title={t("latestTitle")}>
<p style={{ margin: 0 }}>
<strong>{t("statusLabel")}</strong> {existing.status}
{submittedDate ? (
<span className="muted">
{" "}
{t("submittedOn", { date: submittedDate })}
</span>
) : null}
</p>
<p className="muted" style={{ margin: "0.4rem 0 0" }}>
{t("submitAgain")}
</p>
</ContentCard>
) : null}
<ContentCard
icon="📝"
title={t("formTitle")}
subtitle={t("formSubtitle")}
>
<form action={applyDj}>
<div className="card-grid sm-2">
<div>
<label htmlFor="realName" className="muted">
{t("realNameLabel")}
</label>
<input
id="realName"
name="realName"
type="text"
required
maxLength={255}
placeholder={t("realNamePlaceholder")}
style={{ width: "100%", marginTop: "0.3rem" }}
/>
</div>
<div>
<label htmlFor="age" className="muted">
{t("ageLabel")}
</label>
<input
id="age"
name="age"
type="number"
required
min={13}
max={120}
placeholder="18"
style={{ width: "100%", marginTop: "0.3rem" }}
/>
</div>
</div>
<div style={{ marginTop: "1rem" }}>
<label htmlFor="availability" className="muted">
{t("availabilityLabel")}
</label>
<textarea
id="availability"
name="availability"
required
rows={3}
placeholder={t("availabilityPlaceholder")}
style={{ width: "100%", marginTop: "0.3rem", resize: "vertical" }}
/>
</div>
<div style={{ marginTop: "1rem" }}>
<label htmlFor="musicStyle" className="muted">
{t("musicStyleLabel")}
</label>
<input
id="musicStyle"
name="musicStyle"
type="text"
maxLength={255}
placeholder={t("musicStylePlaceholder")}
style={{ width: "100%", marginTop: "0.3rem" }}
/>
</div>
<div style={{ marginTop: "1rem" }}>
<label htmlFor="experience" className="muted">
{t("experienceLabel")}{" "}
<span className="muted">{t("optional")}</span>
</label>
<textarea
id="experience"
name="experience"
rows={3}
placeholder={t("experiencePlaceholder")}
style={{ width: "100%", marginTop: "0.3rem", resize: "vertical" }}
/>
</div>
<div style={{ marginTop: "1rem" }}>
<label htmlFor="motivation" className="muted">
{t("motivationLabel")}
</label>
<textarea
id="motivation"
name="motivation"
required
rows={4}
placeholder={t("motivationPlaceholder")}
style={{ width: "100%", marginTop: "0.3rem", resize: "vertical" }}
/>
</div>
<button
type="submit"
className="btn btn-primary"
style={{ marginTop: "1.25rem" }}
>
{t("submitButton")}
</button>
</form>
</ContentCard>
</main>
);
}