Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INT-1968 Replace PageWrapper HOC with Layout files #26

Merged
merged 2 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions apps/web/app/event-types-1/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { headers } from "next/headers";
import { type ReactElement } from "react";

import { getLayout } from "@calcom/features/MainLayout";

import PageWrapper from "@components/PageWrapperAppDir";

type EventTypesLayoutProps = {
children: ReactElement;
};

export default function EventTypesLayout({ children }: EventTypesLayoutProps) {
const h = headers();
const nonce = h.get("x-nonce") ?? undefined;

return (
<PageWrapper
getLayout={getLayout}
requiresLicense={false}
pageProps={children?.props}
nonce={nonce}
themeBasis={null}>
{children}
</PageWrapper>
);
}
23 changes: 2 additions & 21 deletions apps/web/app/event-types-1/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import EventTypesPage from "@pages/event-types";
import EventTypes from "@pages/event-types";
import type { Metadata } from "next";
import { headers } from "next/headers";

import { getLayout } from "@calcom/features/MainLayout";
import { IS_CALCOM, WEBAPP_URL } from "@calcom/lib/constants";

import PageWrapper from "@components/PageWrapperAppDir";

export const metadata: Metadata = {
viewport: "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0",
metadataBase: new URL(IS_CALCOM ? "https://cal.com" : WEBAPP_URL),
Expand All @@ -19,19 +15,4 @@ export const metadata: Metadata = {
},
};

export default function EventTypesPageWrapped(props: Record<string, unknown>) {
const h = headers();

const nonce = h.get("x-nonce") ?? undefined;

return (
<PageWrapper
getLayout={getLayout}
requiresLicense={false}
pageProps={props}
nonce={nonce}
themeBasis={null}>
<EventTypesPage />
</PageWrapper>
);
}
export default EventTypes;
Loading