From e3d1e998f2d749917179700b869dd1425962cdd7 Mon Sep 17 00:00:00 2001 From: Benny Joo Date: Fri, 28 Feb 2025 05:04:19 -0500 Subject: [PATCH] chore: migrate /org and /team embed pages to App Router (#19148) * migrate all /org embed pages to app router * migrate all /team embed pages to app router * remove /future routes * move to (booking-page-wrapper) route group --------- Co-authored-by: Hariom Balhara --- .../[orgSlug]/[user]/[type]/embed/page.tsx | 24 +++++++++++++++++++ .../org/[orgSlug]/[user]/embed/page.tsx | 24 +++++++++++++++++++ .../org/[orgSlug]/embed/page.tsx | 1 + .../team/[slug]/[type]/embed/page.tsx | 18 ++++++++++++++ .../team/[slug]/embed/page.tsx | 18 ++++++++++++++ .../org/[orgSlug]/[user]/[type]/embed.tsx | 20 ---------------- apps/web/pages/org/[orgSlug]/[user]/embed.tsx | 24 ------------------- apps/web/pages/org/[orgSlug]/embed.tsx | 14 ----------- apps/web/pages/team/[slug]/[type]/embed.tsx | 14 ----------- apps/web/pages/team/[slug]/embed.tsx | 14 ----------- 10 files changed, 85 insertions(+), 86 deletions(-) create mode 100644 apps/web/app/(booking-page-wrapper)/org/[orgSlug]/[user]/[type]/embed/page.tsx create mode 100644 apps/web/app/(booking-page-wrapper)/org/[orgSlug]/[user]/embed/page.tsx create mode 100644 apps/web/app/(booking-page-wrapper)/org/[orgSlug]/embed/page.tsx create mode 100644 apps/web/app/(booking-page-wrapper)/team/[slug]/[type]/embed/page.tsx create mode 100644 apps/web/app/(booking-page-wrapper)/team/[slug]/embed/page.tsx delete mode 100644 apps/web/pages/org/[orgSlug]/[user]/[type]/embed.tsx delete mode 100644 apps/web/pages/org/[orgSlug]/[user]/embed.tsx delete mode 100644 apps/web/pages/org/[orgSlug]/embed.tsx delete mode 100644 apps/web/pages/team/[slug]/[type]/embed.tsx delete mode 100644 apps/web/pages/team/[slug]/embed.tsx 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 0000000000..e137cbaf7a --- /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(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 ; + return ; +}; + +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 0000000000..0b94bc02ee --- /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(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 ; + return ; +}; + +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 0000000000..ed971e8f80 --- /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 0000000000..307cc85da4 --- /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(getServerSideProps); + +const ServerPage = async ({ params, searchParams }: ServerPageProps) => { + const context = buildLegacyCtx(headers(), cookies(), params, searchParams); + const props = await getData(context); + return ; +}; + +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 0000000000..15d6a21f17 --- /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(getServerSideProps); + +const ServerPage = async ({ params, searchParams }: ServerPageProps) => { + const context = buildLegacyCtx(headers(), cookies(), params, searchParams); + const props = await getData(context); + return ; +}; + +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 d8eb17df85..0000000000 --- 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 ; - return ; -} - -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 d47b7aa591..0000000000 --- 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 ; - return ; -} - -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 582eb8f783..0000000000 --- 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) => ; - -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 3f41c896ab..0000000000 --- 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) => ; - -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 1ef45e647a..0000000000 --- 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) => ; - -Page.PageWrapper = PageWrapper; - -export default Page;