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";
|
2023-01-23 23:08:01 +00:00
|
|
|
import { Button, HeadSeo } from "@calcom/ui";
|
2023-04-12 15:26:31 +00:00
|
|
|
import { ArrowRight, Calendar, X } from "@calcom/ui/components/icon";
|
2022-03-16 23:36:43 +00:00
|
|
|
|
2023-02-16 22:39:57 +00:00
|
|
|
import type { inferSSRProps } from "@lib/types/inferSSRProps";
|
2021-10-26 13:10:55 +00:00
|
|
|
|
2023-04-18 18:45:32 +00:00
|
|
|
import PageWrapper from "@components/PageWrapper";
|
|
|
|
|
2022-01-07 20:23:37 +00:00
|
|
|
export default function MeetingUnavailable(props: inferSSRProps<typeof getServerSideProps>) {
|
2022-07-27 02:24:00 +00:00
|
|
|
const { t } = useLocale();
|
2022-08-11 00:53:05 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<HeadSeo title="Meeting Unavailable" description="Meeting Unavailable" />
|
|
|
|
<main className="mx-auto my-24 max-w-3xl">
|
|
|
|
<div className="fixed inset-0 z-50 overflow-y-auto">
|
2023-06-22 22:25:37 +00:00
|
|
|
<div className="flex min-h-screen items-end justify-center px-4 pb-20 pt-4 text-center sm:block sm:p-0">
|
2022-08-11 00:53:05 +00:00
|
|
|
<div className="fixed inset-0 my-4 transition-opacity sm:my-0" aria-hidden="true">
|
|
|
|
<span className="hidden sm:inline-block sm:h-screen sm:align-middle" aria-hidden="true">
|
|
|
|
​
|
|
|
|
</span>
|
|
|
|
<div
|
2023-06-22 22:25:37 +00:00
|
|
|
className="bg-default inline-block transform overflow-hidden rounded-lg px-4 pb-4 pt-5 text-left align-bottom shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-sm sm:p-6 sm:align-middle"
|
2022-08-11 00:53:05 +00:00
|
|
|
role="dialog"
|
|
|
|
aria-modal="true"
|
|
|
|
aria-labelledby="modal-headline">
|
|
|
|
<div>
|
2023-04-05 18:14:46 +00:00
|
|
|
<div className="bg-error mx-auto flex h-12 w-12 items-center justify-center rounded-full">
|
2023-04-12 15:26:31 +00:00
|
|
|
<X className="h-6 w-6 text-red-600" />
|
2022-08-11 00:53:05 +00:00
|
|
|
</div>
|
|
|
|
<div className="mt-3 text-center sm:mt-5">
|
2023-04-05 18:14:46 +00:00
|
|
|
<h3 className="text-emphasis text-lg font-medium leading-6" id="modal-headline">
|
2022-08-11 00:53:05 +00:00
|
|
|
This meeting is in the past.
|
|
|
|
</h3>
|
2022-03-18 09:55:02 +00:00
|
|
|
</div>
|
2023-06-22 22:25:37 +00:00
|
|
|
<div className="mt-4 border-b border-t py-4">
|
2023-04-05 18:14:46 +00:00
|
|
|
<h2 className="font-cal text-default mb-2 text-center text-lg font-medium">
|
2022-08-11 00:53:05 +00:00
|
|
|
{props.booking.title}
|
|
|
|
</h2>
|
2023-04-05 18:14:46 +00:00
|
|
|
<p className="text-subtle text-center">
|
2023-06-22 22:25:37 +00:00
|
|
|
<Calendar className="-mt-1 mr-1 inline-block h-4 w-4" />
|
2022-08-11 00:53:05 +00:00
|
|
|
{dayjs(props.booking.startTime).format(detectBrowserTimeFormat + ", dddd DD MMMM YYYY")}
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="mt-5 text-center sm:mt-6">
|
|
|
|
<div className="mt-5">
|
2023-04-12 15:26:31 +00:00
|
|
|
<Button data-testid="return-home" href="/event-types" EndIcon={ArrowRight}>
|
2022-08-11 00:53:05 +00:00
|
|
|
{t("go_back")}
|
|
|
|
</Button>
|
2022-03-18 09:55:02 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-10-26 13:10:55 +00:00
|
|
|
</div>
|
2022-03-18 09:55:02 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-08-11 00:53:05 +00:00
|
|
|
</div>
|
|
|
|
</main>
|
|
|
|
</div>
|
|
|
|
);
|
2021-10-26 13:10:55 +00:00
|
|
|
}
|
|
|
|
|
2023-04-18 18:45:32 +00:00
|
|
|
MeetingUnavailable.PageWrapper = PageWrapper;
|
|
|
|
|
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
|
|
|
},
|
|
|
|
select: {
|
2022-05-18 21:05:49 +00:00
|
|
|
...bookingMinimalSelect,
|
2021-10-26 13:10:55 +00:00
|
|
|
uid: true,
|
|
|
|
user: {
|
|
|
|
select: {
|
|
|
|
credentials: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
references: {
|
|
|
|
select: {
|
|
|
|
uid: true,
|
|
|
|
type: true,
|
2022-08-11 00:53:05 +00:00
|
|
|
meetingUrl: true,
|
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,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|