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 { useLocale } from "@calcom/lib/hooks/useLocale"; import Button from "@calcom/ui/Button"; import { Dialog, DialogContent, DialogFooter, DialogHeader } from "@calcom/ui/Dialog"; 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 MeetingUnavailable(props: inferSSRProps) { const router = useRouter(); const { t } = useLocale(); // 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 (
{ e.preventDefault(); }}>

{dayjs(props.booking.startTime).format(detectBrowserTimeFormat + ", dddd DD MMMM YYYY")}

This meeting will be accessible 60 minutes in advance.

); } 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, }, }; }