diff --git a/components/Shell.tsx b/components/Shell.tsx index e51ff814..57db5acc 100644 --- a/components/Shell.tsx +++ b/components/Shell.tsx @@ -59,9 +59,16 @@ export default function Shell(props) { Dashboard - {/* - Bookings - */} + + + Bookings + + Loading...

; + } + + return ( +
+ + Bookings | Calendso + + + +
+
+
+
+ + + + + + + + + + + + {bookings.map((booking) => ( + + + + + + + + ))} + +
+ Title + + Description + + Name + + Email + + Edit +
+ {booking.title} + + {booking.description} + + {booking.attendees[0].name} + + {booking.attendees[0].email} + + + Reschedule + + + Cancel + +
+
+
+
+
+
+
+ ); +} + +export async function getServerSideProps(context) { + const session = await getSession(context); + + if (!session) { + return { redirect: { permanent: false, destination: "/auth/login" } }; + } + + const user = await prisma.user.findFirst({ + where: { + email: session.user.email, + }, + select: { + id: true, + }, + }); + + const bookings = await prisma.booking.findMany({ + where: { + userId: user.id, + }, + select: { + uid: true, + title: true, + description: true, + attendees: true, + }, + }); + + return { props: { bookings } }; +}