38 lines
1.4 KiB
TypeScript
38 lines
1.4 KiB
TypeScript
import { withAppDirSsr } from "app/WithAppDirSsr";
|
|
import type { Params, SearchParams } from "app/_types";
|
|
import { _generateMetadata } from "app/_utils";
|
|
import { WithLayout } from "app/layoutHOC";
|
|
import { type GetServerSidePropsContext } from "next";
|
|
import { cookies, headers } from "next/headers";
|
|
|
|
import { BookingStatus } from "@calcom/prisma/enums";
|
|
|
|
import { buildLegacyCtx } from "@lib/buildLegacyCtx";
|
|
|
|
import OldPage from "~/bookings/views/bookings-single-view";
|
|
import { getServerSideProps, type PageProps } from "~/bookings/views/bookings-single-view.getServerSideProps";
|
|
|
|
export const generateMetadata = async ({
|
|
params,
|
|
searchParams,
|
|
}: {
|
|
params: Params;
|
|
searchParams: SearchParams;
|
|
}) => {
|
|
const { bookingInfo, eventType, recurringBookings } = await getData(
|
|
buildLegacyCtx(headers(), cookies(), params, searchParams) as unknown as GetServerSidePropsContext
|
|
);
|
|
const needsConfirmation = bookingInfo.status === BookingStatus.PENDING && eventType.requiresConfirmation;
|
|
|
|
return await _generateMetadata(
|
|
(t) =>
|
|
t(`booking_${needsConfirmation ? "submitted" : "confirmed"}${recurringBookings ? "_recurring" : ""}`),
|
|
(t) =>
|
|
t(`booking_${needsConfirmation ? "submitted" : "confirmed"}${recurringBookings ? "_recurring" : ""}`)
|
|
);
|
|
};
|
|
|
|
const getData = withAppDirSsr<PageProps>(getServerSideProps);
|
|
|
|
export default WithLayout({ getLayout: null, getData, Page: OldPage });
|