import { CalendarIcon, XIcon } from "@heroicons/react/outline"; import { ArrowRightIcon } from "@heroicons/react/solid"; import dayjs from "dayjs"; import { NextPageContext } from "next"; import { getSession } from "next-auth/react"; import { useRouter } from "next/router"; import { useEffect } from "react"; import Button from "@calcom/ui/Button"; import prisma from "@lib/prisma"; import { detectBrowserTimeFormat } from "@lib/timeFormat"; import { inferSSRProps } from "@lib/types/inferSSRProps"; import { HeadSeo } from "@components/seo/head-seo"; export default function MeetingNotStarted(props: inferSSRProps) { const router = useRouter(); //if no booking redirectis to the 404 page const emptyBooking = props.booking === null; useEffect(() => { if (emptyBooking) { router.push("/video/no-meeting-found"); } }); if (!emptyBooking) { return (
); } return null; } export async function getServerSideProps(context: NextPageContext) { const booking = await prisma.booking.findUnique({ where: { uid: context.query.uid as string, }, select: { uid: true, id: true, title: true, description: true, startTime: true, endTime: true, user: { select: { credentials: true, }, }, attendees: true, dailyRef: { select: { dailyurl: true, dailytoken: true, }, }, references: { select: { uid: true, type: true, }, }, }, }); if (!booking) { // TODO: Booking is already cancelled return { props: { booking: null }, }; } const bookingObj = Object.assign({}, booking, { startTime: booking.startTime.toString(), endTime: booking.endTime.toString(), }); const session = await getSession(); return { props: { booking: bookingObj, session: session, }, }; }