Skip to content

Scheduling infrastructure for absolutely everyone.

chore: migrate /org and /team embed pages to App Router (#19148)

Benny Jooe3d1e998f2d7
diff --git a/apps/web/app/(booking-page-wrapper)/org/[orgSlug]/[user]/[type]/embed/page.tsx b/apps/web/app/(booking-page-wrapper)/org/[orgSlug]/[user]/[type]/embed/page.tsx
new file mode 100644
index 00000000000..e137cbaf7af
--- /dev/null
+++ b/apps/web/app/(booking-page-wrapper)/org/[orgSlug]/[user]/[type]/embed/page.tsx
@@ -0,0 +1,24 @@
+import withEmbedSsrAppDir from "app/WithEmbedSSR";
+import type { PageProps as ServerPageProps } from "app/_types";
+import { cookies, headers } from "next/headers";
+
+import { buildLegacyCtx } from "@lib/buildLegacyCtx";
+import { getServerSideProps } from "@lib/org/[orgSlug]/[user]/[type]/getServerSideProps";
+
+import type { PageProps as TeamTypePageProps } from "~/team/type-view";
+import TeamTypePage from "~/team/type-view";
+import UserTypePage from "~/users/views/users-type-public-view";
+import type { PageProps as UserTypePageProps } from "~/users/views/users-type-public-view";
+
+const getData = withEmbedSsrAppDir<ClientPageProps>(getServerSideProps);
+
+export type ClientPageProps = UserTypePageProps | TeamTypePageProps;
+
+const ServerPage = async ({ params, searchParams }: ServerPageProps) => {
+ const context = buildLegacyCtx(headers(), cookies(), params, searchParams);
+ const props = await getData(context);
+ if ((props as TeamTypePageProps)?.teamId) return <TeamTypePage {...(props as TeamTypePageProps)} />;
+ return <UserTypePage {...(props as UserTypePageProps)} />;
+};
+
+export default ServerPage;
diff --git a/apps/web/app/(booking-page-wrapper)/org/[orgSlug]/[user]/embed/page.tsx b/apps/web/app/(booking-page-wrapper)/org/[orgSlug]/[user]/embed/page.tsx
new file mode 100644
index 00000000000..0b94bc02ee1
--- /dev/null
+++ b/apps/web/app/(booking-page-wrapper)/org/[orgSlug]/[user]/embed/page.tsx
@@ -0,0 +1,24 @@
+import withEmbedSsrAppDir from "app/WithEmbedSSR";
+import type { PageProps as ServerPageProps } from "app/_types";
+import { cookies, headers } from "next/headers";
+
+import { buildLegacyCtx } from "@lib/buildLegacyCtx";
+import { getServerSideProps } from "@lib/org/[orgSlug]/[user]/getServerSideProps";
+
+import type { PageProps as TeamPageProps } from "~/team/team-view";
+import TeamPage from "~/team/team-view";
+import UserPage from "~/users/views/users-public-view";
+import type { PageProps as UserPageProps } from "~/users/views/users-public-view";
+
+const getData = withEmbedSsrAppDir<ClientPageProps>(getServerSideProps);
+
+export type ClientPageProps = UserPageProps | TeamPageProps;
+
+const ServerPage = async ({ params, searchParams }: ServerPageProps) => {
+ const context = buildLegacyCtx(headers(), cookies(), params, searchParams);
+ const props = await getData(context);
+ if ((props as TeamPageProps)?.team) return <TeamPage {...(props as TeamPageProps)} />;
+ return <UserPage {...(props as UserPageProps)} />;
+};
+
+export default ServerPage;
diff --git a/apps/web/app/(booking-page-wrapper)/org/[orgSlug]/embed/page.tsx b/apps/web/app/(booking-page-wrapper)/org/[orgSlug]/embed/page.tsx
new file mode 100644
index 00000000000..ed971e8f80b
--- /dev/null
+++ b/apps/web/app/(booking-page-wrapper)/org/[orgSlug]/embed/page.tsx
@@ -0,0 +1 @@
+export { default } from "../../../team/[slug]/embed/page";
diff --git a/apps/web/app/(booking-page-wrapper)/team/[slug]/[type]/embed/page.tsx b/apps/web/app/(booking-page-wrapper)/team/[slug]/[type]/embed/page.tsx
new file mode 100644
index 00000000000..307cc85da46
--- /dev/null
+++ b/apps/web/app/(booking-page-wrapper)/team/[slug]/[type]/embed/page.tsx
@@ -0,0 +1,18 @@
+import withEmbedSsrAppDir from "app/WithEmbedSSR";
+import type { PageProps as ServerPageProps } from "app/_types";
+import { cookies, headers } from "next/headers";
+
+import { buildLegacyCtx } from "@lib/buildLegacyCtx";
+import { getServerSideProps } from "@lib/team/[slug]/[type]/getServerSideProps";
+
+import TypePage, { type PageProps as ClientPageProps } from "~/team/type-view";
+
+const getData = withEmbedSsrAppDir<ClientPageProps>(getServerSideProps);
+
+const ServerPage = async ({ params, searchParams }: ServerPageProps) => {
+ const context = buildLegacyCtx(headers(), cookies(), params, searchParams);
+ const props = await getData(context);
+ return <TypePage {...props} />;
+};
+
+export default ServerPage;
diff --git a/apps/web/app/(booking-page-wrapper)/team/[slug]/embed/page.tsx b/apps/web/app/(booking-page-wrapper)/team/[slug]/embed/page.tsx
new file mode 100644
index 00000000000..15d6a21f17f
--- /dev/null
+++ b/apps/web/app/(booking-page-wrapper)/team/[slug]/embed/page.tsx
@@ -0,0 +1,18 @@
+import withEmbedSsrAppDir from "app/WithEmbedSSR";
+import type { PageProps as ServerPageProps } from "app/_types";
+import { cookies, headers } from "next/headers";
+
+import { buildLegacyCtx } from "@lib/buildLegacyCtx";
+import { getServerSideProps } from "@lib/team/[slug]/getServerSideProps";
+
+import TeamPage, { type PageProps as ClientPageProps } from "~/team/team-view";
+
+const getData = withEmbedSsrAppDir<ClientPageProps>(getServerSideProps);
+
+const ServerPage = async ({ params, searchParams }: ServerPageProps) => {
+ const context = buildLegacyCtx(headers(), cookies(), params, searchParams);
+ const props = await getData(context);
+ return <TeamPage {...props} />;
+};
+
+export default ServerPage;
diff --git a/apps/web/pages/org/[orgSlug]/[user]/[type]/embed.tsx b/apps/web/pages/org/[orgSlug]/[user]/[type]/embed.tsx
deleted file mode 100644
index d8eb17df858..00000000000
--- a/apps/web/pages/org/[orgSlug]/[user]/[type]/embed.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import { getServerSideProps as _getServerSideProps } from "@lib/org/[orgSlug]/[user]/[type]/getServerSideProps";
-import withEmbedSsr from "@lib/withEmbedSsr";
-
-import PageWrapper from "@components/PageWrapper";
-
-import type { PageProps as TeamTypePageProps } from "~/team/type-view";
-import TeamTypePage from "~/team/type-view";
-import UserTypePage from "~/users/views/users-type-public-view";
-import type { PageProps as UserTypePageProps } from "~/users/views/users-type-public-view";
-
-export type PageProps = UserTypePageProps | TeamTypePageProps;
-
-export default function Page(props: PageProps) {
- if ((props as TeamTypePageProps)?.teamId) return <TeamTypePage {...(props as TeamTypePageProps)} />;
- return <UserTypePage {...(props as UserTypePageProps)} />;
-}
-
-Page.PageWrapper = PageWrapper;
-
-export const getServerSideProps = withEmbedSsr(_getServerSideProps);
diff --git a/apps/web/pages/org/[orgSlug]/[user]/embed.tsx b/apps/web/pages/org/[orgSlug]/[user]/embed.tsx
deleted file mode 100644
index d47b7aa5918..00000000000
--- a/apps/web/pages/org/[orgSlug]/[user]/embed.tsx
+++ /dev/null
@@ -1,24 +0,0 @@
-"use client";
-
-import { getServerSideProps as _getServerSideProps } from "@lib/org/[orgSlug]/[user]/getServerSideProps";
-import withEmbedSsr from "@lib/withEmbedSsr";
-
-import PageWrapper from "@components/PageWrapper";
-
-import type { PageProps as TeamPageProps } from "~/team/team-view";
-import TeamPage from "~/team/team-view";
-import UserPage from "~/users/views/users-public-view";
-import type { PageProps as UserPageProps } from "~/users/views/users-public-view";
-
-export const getServerSideProps = withEmbedSsr(_getServerSideProps);
-
-export type PageProps = UserPageProps | TeamPageProps;
-
-function Page(props: PageProps) {
- if ((props as TeamPageProps)?.team) return <TeamPage {...(props as TeamPageProps)} />;
- return <UserPage {...(props as UserPageProps)} />;
-}
-
-Page.PageWrapper = PageWrapper;
-
-export default Page;
diff --git a/apps/web/pages/org/[orgSlug]/embed.tsx b/apps/web/pages/org/[orgSlug]/embed.tsx
deleted file mode 100644
index 582eb8f7836..00000000000
--- a/apps/web/pages/org/[orgSlug]/embed.tsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import { getServerSideProps as _getServerSideProps } from "@lib/team/[slug]/getServerSideProps";
-import withEmbedSsr from "@lib/withEmbedSsr";
-
-import PageWrapper from "@components/PageWrapper";
-
-import TeamPage, { type PageProps } from "~/team/team-view";
-
-const Page = (props: PageProps) => <TeamPage {...props} />;
-
-Page.PageWrapper = PageWrapper;
-
-export default Page;
-
-export const getServerSideProps = withEmbedSsr(_getServerSideProps);
diff --git a/apps/web/pages/team/[slug]/[type]/embed.tsx b/apps/web/pages/team/[slug]/[type]/embed.tsx
deleted file mode 100644
index 3f41c896ab7..00000000000
--- a/apps/web/pages/team/[slug]/[type]/embed.tsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import { getServerSideProps as _getServerSideProps } from "@lib/team/[slug]/[type]/getServerSideProps";
-import withEmbedSsr from "@lib/withEmbedSsr";
-
-import PageWrapper from "@components/PageWrapper";
-
-import TypePage, { type PageProps } from "~/team/type-view";
-
-export const getServerSideProps = withEmbedSsr(_getServerSideProps);
-
-const Page = (props: PageProps) => <TypePage {...props} />;
-
-Page.PageWrapper = PageWrapper;
-
-export default Page;
diff --git a/apps/web/pages/team/[slug]/embed.tsx b/apps/web/pages/team/[slug]/embed.tsx
deleted file mode 100644
index 1ef45e647ae..00000000000
--- a/apps/web/pages/team/[slug]/embed.tsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import { getServerSideProps as _getServerSideProps } from "@lib/team/[slug]/getServerSideProps";
-import withEmbedSsr from "@lib/withEmbedSsr";
-
-import PageWrapper from "@components/PageWrapper";
-
-import TeamPage, { type PageProps } from "~/team/team-view";
-
-export const getServerSideProps = withEmbedSsr(_getServerSideProps);
-
-const Page = (props: PageProps) => <TeamPage {...props} />;
-
-Page.PageWrapper = PageWrapper;
-
-export default Page;