From d8a6cdca4400cc78b03f5f2a32a5074433f2a79e Mon Sep 17 00:00:00 2001 From: Benny Joo Date: Tue, 3 Oct 2023 11:54:27 +0100 Subject: [PATCH 1/2] Replace PageWrapper HOC with Layout files --- apps/web/app/event-types-1/layout.tsx | 28 +++++++++++++++++++++++++++ apps/web/app/event-types-1/page.tsx | 23 +++------------------- 2 files changed, 31 insertions(+), 20 deletions(-) create mode 100644 apps/web/app/event-types-1/layout.tsx diff --git a/apps/web/app/event-types-1/layout.tsx b/apps/web/app/event-types-1/layout.tsx new file mode 100644 index 00000000000000..77572faad78764 --- /dev/null +++ b/apps/web/app/event-types-1/layout.tsx @@ -0,0 +1,28 @@ +"use client"; + +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 ( + + {children} + + ); +} diff --git a/apps/web/app/event-types-1/page.tsx b/apps/web/app/event-types-1/page.tsx index eb6661fd65d79f..1a07cad3945211 100644 --- a/apps/web/app/event-types-1/page.tsx +++ b/apps/web/app/event-types-1/page.tsx @@ -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), @@ -19,19 +15,6 @@ export const metadata: Metadata = { }, }; -export default function EventTypesPageWrapped(props: Record) { - const h = headers(); - - const nonce = h.get("x-nonce") ?? undefined; - - return ( - - - - ); +export default function EventTypesPage(props: Record) { + return ; } From a71567998b7e0c534c7d89b9d23f00bac830bf86 Mon Sep 17 00:00:00 2001 From: Greg Pabian <35925521+grzpab@users.noreply.github.com> Date: Tue, 3 Oct 2023 13:52:39 +0200 Subject: [PATCH 2/2] fixes --- apps/web/app/event-types-1/layout.tsx | 2 -- apps/web/app/event-types-1/page.tsx | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/apps/web/app/event-types-1/layout.tsx b/apps/web/app/event-types-1/layout.tsx index 77572faad78764..05abab668a9715 100644 --- a/apps/web/app/event-types-1/layout.tsx +++ b/apps/web/app/event-types-1/layout.tsx @@ -1,5 +1,3 @@ -"use client"; - import { headers } from "next/headers"; import { type ReactElement } from "react"; diff --git a/apps/web/app/event-types-1/page.tsx b/apps/web/app/event-types-1/page.tsx index 1a07cad3945211..78017ecf6488f1 100644 --- a/apps/web/app/event-types-1/page.tsx +++ b/apps/web/app/event-types-1/page.tsx @@ -15,6 +15,4 @@ export const metadata: Metadata = { }, }; -export default function EventTypesPage(props: Record) { - return ; -} +export default EventTypes;