2023-02-16 22:39:57 +00:00
|
|
|
import type { NextPageContext } from "next";
|
2021-10-26 13:10:55 +00:00
|
|
|
|
2022-06-28 20:40:58 +00:00
|
|
|
import dayjs from "@calcom/dayjs";
|
2022-07-27 02:24:00 +00:00
|
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
2022-07-28 19:58:26 +00:00
|
|
|
import { detectBrowserTimeFormat } from "@calcom/lib/timeFormat";
|
2022-05-18 21:05:49 +00:00
|
|
|
import prisma, { bookingMinimalSelect } from "@calcom/prisma";
|
|
|
|
import type { inferSSRProps } from "@calcom/types/inferSSRProps";
|
2023-03-14 19:43:45 +00:00
|
|
|
import { Button, HeadSeo, EmptyScreen } from "@calcom/ui";
|
|
|
|
import { FiArrowRight, FiCalendar, FiClock } from "@calcom/ui/components/icon";
|
2021-10-26 13:10:55 +00:00
|
|
|
|
2022-01-07 20:23:37 +00:00
|
|
|
export default function MeetingNotStarted(props: inferSSRProps<typeof getServerSideProps>) {
|
2022-07-27 02:24:00 +00:00
|
|
|
const { t } = useLocale();
|
2022-08-11 00:53:05 +00:00
|
|
|
return (
|
2023-03-14 19:43:45 +00:00
|
|
|
<>
|
|
|
|
<HeadSeo title={t("this_meeting_has_not_started_yet")} description={props.booking.title} />
|
2022-08-11 00:53:05 +00:00
|
|
|
<main className="mx-auto my-24 max-w-3xl">
|
2023-03-14 19:43:45 +00:00
|
|
|
<EmptyScreen
|
|
|
|
Icon={FiClock}
|
|
|
|
headline={t("this_meeting_has_not_started_yet")}
|
|
|
|
description={
|
|
|
|
<>
|
|
|
|
<h2 className="mb-2 text-center font-medium">{props.booking.title}</h2>
|
|
|
|
<p className="text-center text-gray-500">
|
|
|
|
<FiCalendar className="mr-1 -mt-1 inline-block h-4 w-4" />
|
|
|
|
{dayjs(props.booking.startTime).format(detectBrowserTimeFormat + ", dddd DD MMMM YYYY")}
|
|
|
|
</p>
|
|
|
|
</>
|
|
|
|
}
|
|
|
|
buttonRaw={
|
|
|
|
<Button data-testid="return-home" href="/event-types" EndIcon={FiArrowRight}>
|
|
|
|
{t("go_back")}
|
|
|
|
</Button>
|
|
|
|
}
|
|
|
|
/>
|
2022-08-11 00:53:05 +00:00
|
|
|
</main>
|
2023-03-14 19:43:45 +00:00
|
|
|
</>
|
2022-08-11 00:53:05 +00:00
|
|
|
);
|
2021-10-26 13:10:55 +00:00
|
|
|
}
|
|
|
|
|
2022-01-07 20:23:37 +00:00
|
|
|
export async function getServerSideProps(context: NextPageContext) {
|
2021-10-26 13:10:55 +00:00
|
|
|
const booking = await prisma.booking.findUnique({
|
|
|
|
where: {
|
2022-01-07 20:23:37 +00:00
|
|
|
uid: context.query.uid as string,
|
2021-10-26 13:10:55 +00:00
|
|
|
},
|
2022-08-11 00:53:05 +00:00
|
|
|
select: bookingMinimalSelect,
|
2021-10-26 13:10:55 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
if (!booking) {
|
|
|
|
return {
|
2022-08-11 00:53:05 +00:00
|
|
|
redirect: {
|
|
|
|
destination: "/video/no-meeting-found",
|
|
|
|
permanent: false,
|
|
|
|
},
|
2021-10-26 13:10:55 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
const bookingObj = Object.assign({}, booking, {
|
|
|
|
startTime: booking.startTime.toString(),
|
|
|
|
endTime: booking.endTime.toString(),
|
|
|
|
});
|
|
|
|
|
|
|
|
return {
|
|
|
|
props: {
|
|
|
|
booking: bookingObj,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|