* Embed SSG and consistently pass embedType query param across pages * Embed fixes * Code cleanup * Add main class which tells embed which helps in identifying which area is outside the main content * remove any special optimization handling for routing forms * Add comments * Small fixes * Fix broken team booking page in embed * Fix Fallback message dark theme * TS Fixes * Fixes * Fix tests * Remove not required code Co-authored-by: Peer Richelsen <peeroke@gmail.com>
22 lines
586 B
TypeScript
22 lines
586 B
TypeScript
import { GetServerSideProps, GetServerSidePropsContext, GetServerSidePropsResult } from "next";
|
|
|
|
export type EmbedProps = {
|
|
isEmbed?: boolean;
|
|
};
|
|
|
|
export default function withEmbedSsr(getServerSideProps: GetServerSideProps) {
|
|
return async (context: GetServerSidePropsContext): Promise<GetServerSidePropsResult<EmbedProps>> => {
|
|
const ssrResponse = await getServerSideProps(context);
|
|
if (!("props" in ssrResponse)) {
|
|
return ssrResponse;
|
|
}
|
|
return {
|
|
...ssrResponse,
|
|
props: {
|
|
...ssrResponse.props,
|
|
isEmbed: true,
|
|
},
|
|
};
|
|
};
|
|
}
|