Files
EpicNext-Cms/src/app/(site)/radio/giveaways/page.tsx
T
openhands 17847545dd
Deploy / release (push) Skipped
Deploy / deploy (push) Successful in 1m52s
Improvements: remove dead config, fix ESM, add URL validation, unify types, add missing logging
- Remove .prettierrc (dead config, Biome replaces Prettier)
- Rename lighthouserc.json to lighthouserc.cjs with module.exports for ESM compat
- Add logger.warn to empty catch blocks in auth, register, site-settings, prisma-cache, redis, security, rate-limit
- Unify ActionResult type: action-helper.ts uses 'ok' consistent with safe-action-shared.ts
- Add noUnusedLocals + noUnusedParameters to tsconfig + fix 25 pre-existing unused vars
- Replace barrel export src/types/index.ts with direct @/types/common imports
- Make trustHost conditional (development only) in auth.ts
- Add pre-flight URL validation to update-Nitrov3.sh to catch image.library.url misconfigurations
- Improve NITRO_IMAGE_LIBRARY_URL content validation in pre-flight & post-compute checks
2026-07-26 20:28:11 +02:00

86 lines
2.2 KiB
TypeScript

import Link from "next/link";
import { getTranslations } from "next-intl/server";
import { ContentCard, EmptyState } from "@/components/public/ui";
import { formatDate } from "@/lib/format-date";
import { prisma } from "@/lib/prisma";
export const revalidate = 300;
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, "date", "")} — ${g.endDate ? formatDate(g.endDate, "date", "") : "ongoing"}`
: t("dateUnknown")}
</p>
</Link>
);
})}
</div>
)}
</ContentCard>
</main>
);
}