import { Calendar } from "lucide-react"; import { getServerSession } from "../../api/auth/[...nextauth]/auth"; import { Badge } from "@repo/shared-components"; import { JSX } from "react"; import { getPublicUser, prisma } from "@repo/db"; import { formatTimeRange } from "../../../helper/timerange"; export const Bookings: () => Promise = async () => { const session = await getServerSession(); const futureBookings = await prisma.booking.findMany({ where: { userId: session?.user.id, startTime: { gte: new Date(), }, }, orderBy: { startTime: "asc", }, include: { User: true, Station: true, }, }); if (!session) return
; return (

Zukünftige Buchungen

{futureBookings.length === 0 && ( Keine zukünftigen Buchungen. Du kannst dir welche im Buchungssystem erstellen. )} {futureBookings.map((booking) => { return (
{booking.type.startsWith("LST_") ? "LST" : booking.Station?.bosCallsignShort || booking.Station?.bosCallsign} {getPublicUser(booking.User).fullName}

{formatTimeRange(booking, { includeDate: true })}

); })}
); };