continuel event modal

This commit is contained in:
PxlLoewe
2025-02-28 08:44:47 +01:00
parent 0708e8a4c3
commit 488c50e2e0
5 changed files with 124 additions and 67 deletions

View File

@@ -16,7 +16,13 @@ export default async () => {
const events = await prisma.event.findMany({
include: {
appointments: true,
appointments: {
where: {
appointmentDate: {
gte: new Date(),
},
},
},
participants: {
where: {
userId: user.id,
@@ -24,6 +30,15 @@ export default async () => {
},
},
});
const userAppointments = await prisma.eventAppointment.findMany({
where: {
Participants: {
some: {
userId: user.id,
},
},
},
});
return (
<div className="grid grid-cols-6 gap-4">
@@ -35,9 +50,23 @@ export default async () => {
{events.map((event) => {
if (event.type === "OBLIGATED_COURSE")
return <ObligatedEvent user={user} event={event} key={event.id} />;
return (
<ObligatedEvent
selectedAppointments={userAppointments}
user={user}
event={event}
key={event.id}
/>
);
if (event.type === "COURSE")
return <KursItem user={user} event={event} key={event.id} />;
return (
<KursItem
selectedAppointments={userAppointments}
user={user}
event={event}
key={event.id}
/>
);
})}
</div>
);