import { prisma } from "@repo/db"; import { TriangleAlert } from "lucide-react"; import { getServerSession } from "next-auth"; export const Penalty = async () => { const session = await getServerSession(); const openPenaltys = await prisma.penalty.findMany({ where: { userId: session?.user.id, until: { gte: new Date(), }, type: "TIME_BAN", }, }); if (!openPenaltys[0]) { return null; } return (
Du hast eine aktive Strafe, die dich daran hindert, an Flügen teilzunehmen.
Strafe: {openPenaltys[0].reason}
{openPenaltys[0].until && (Bis: {new Date(openPenaltys[0].until).toLocaleDateString()}
)}