diff --git a/apps/web/app/WithAppDirSsg.tsx b/apps/web/app/WithAppDirSsg.tsx deleted file mode 100644 index ead0adf970..0000000000 --- a/apps/web/app/WithAppDirSsg.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import type { GetStaticProps, GetStaticPropsContext } from "next"; -import { unstable_cache } from "next/cache"; -import { notFound, redirect } from "next/navigation"; - -export const withAppDirSsg = - >(getStaticProps: GetStaticProps, routePath: string) => - async (context: GetStaticPropsContext) => { - const cacheKey = JSON.stringify({ - route: routePath, - params: context.params || {}, - }); - - const getCachedProps = unstable_cache(async () => { - const ssgResponse = await getStaticProps(context); - - if ("redirect" in ssgResponse) { - redirect(ssgResponse.redirect.destination); - } - - if ("notFound" in ssgResponse) { - notFound(); - } - - return { - ...ssgResponse.props, - ...("trpcState" in ssgResponse.props && { dehydratedState: ssgResponse.props.trpcState }), - }; - }, [`ssg-${cacheKey}`]); - - return getCachedProps(); - }; diff --git a/apps/web/app/future/[user]/[type]/embed/page.tsx b/apps/web/app/future/[user]/[type]/embed/page.tsx deleted file mode 100644 index 78fe30896d..0000000000 --- a/apps/web/app/future/[user]/[type]/embed/page.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import withEmbedSsrAppDir from "app/WithEmbedSSR"; -import { WithLayout } from "app/layoutHOC"; - -import { getServerSideProps } from "@server/lib/[user]/[type]/getServerSideProps"; - -import LegacyPage, { type PageProps } from "~/users/views/users-type-public-view"; - -const getEmbedData = withEmbedSsrAppDir(getServerSideProps); - -export default WithLayout({ getLayout: null, getData: getEmbedData, Page: LegacyPage })<"P">; diff --git a/apps/web/app/future/[user]/embed/page.tsx b/apps/web/app/future/[user]/embed/page.tsx deleted file mode 100644 index 09070a22f9..0000000000 --- a/apps/web/app/future/[user]/embed/page.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import withEmbedSsrAppDir from "app/WithEmbedSSR"; -import { WithLayout } from "app/layoutHOC"; - -import { getServerSideProps } from "@server/lib/[user]/getServerSideProps"; - -import type { PageProps as UserPageProps } from "~/users/views/users-public-view"; -import LegacyPage from "~/users/views/users-public-view"; - -const getEmbedData = withEmbedSsrAppDir(getServerSideProps); - -export default WithLayout({ getLayout: null, getData: getEmbedData, Page: LegacyPage })<"P">; diff --git a/apps/web/app/future/org/[orgSlug]/[user]/[type]/embed/page.tsx b/apps/web/app/future/org/[orgSlug]/[user]/[type]/embed/page.tsx deleted file mode 100644 index 081d18a07f..0000000000 --- a/apps/web/app/future/org/[orgSlug]/[user]/[type]/embed/page.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import Page from "@pages/org/[orgSlug]/[user]/[type]/embed"; -import withEmbedSsrAppDir from "app/WithEmbedSSR"; -import { WithLayout } from "app/layoutHOC"; -import type { OrgTypePageProps } from "app/(booking-page-wrapper)/org/[orgSlug]/[user]/[type]/page"; - -import { getServerSideProps } from "@lib/org/[orgSlug]/[user]/[type]/getServerSideProps"; - -const getEmbedData = withEmbedSsrAppDir(getServerSideProps); - -export default WithLayout({ getLayout: null, getData: getEmbedData, isBookingPage: true, Page }); diff --git a/apps/web/app/future/org/[orgSlug]/[user]/embed/page.tsx b/apps/web/app/future/org/[orgSlug]/[user]/embed/page.tsx deleted file mode 100644 index 4f214d72b3..0000000000 --- a/apps/web/app/future/org/[orgSlug]/[user]/embed/page.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import withEmbedSsrAppDir from "app/WithEmbedSSR"; -import { WithLayout } from "app/layoutHOC"; -import type { OrgPageProps } from "app/(booking-page-wrapper)/org/[orgSlug]/[user]/page"; - -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 getEmbedData = withEmbedSsrAppDir(getServerSideProps); - -const Page = async (props: OrgPageProps) => { - if ((props as TeamPageProps)?.team) { - return ; - } - return ; -}; - -export default WithLayout({ getLayout: null, getData: getEmbedData, isBookingPage: true, ServerPage: Page }); diff --git a/apps/web/app/future/org/[orgSlug]/embed/page.tsx b/apps/web/app/future/org/[orgSlug]/embed/page.tsx deleted file mode 100644 index 3a592b9af7..0000000000 --- a/apps/web/app/future/org/[orgSlug]/embed/page.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import withEmbedSsrAppDir from "app/WithEmbedSSR"; -import { WithLayout } from "app/layoutHOC"; - -import { getServerSideProps } from "@lib/team/[slug]/getServerSideProps"; - -import type { PageProps } from "~/team/team-view"; -import TeamPage from "~/team/team-view"; - -const getEmbedData = withEmbedSsrAppDir(getServerSideProps); - -export default WithLayout({ - Page: TeamPage, - getData: getEmbedData, - getLayout: null, - isBookingPage: true, -})<"P">; diff --git a/apps/web/app/layoutHOC.tsx b/apps/web/app/layoutHOC.tsx deleted file mode 100644 index 6e580e3dea..0000000000 --- a/apps/web/app/layoutHOC.tsx +++ /dev/null @@ -1,61 +0,0 @@ -import type { LayoutProps, PageProps } from "app/_types"; -import { type GetServerSidePropsContext } from "next"; -import { cookies, headers } from "next/headers"; - -import { buildLegacyCtx } from "@lib/buildLegacyCtx"; - -import PageWrapper from "@components/PageWrapperAppDir"; - -type WithLayoutParams> = { - getLayout?: ((page: React.ReactElement) => React.ReactNode) | null; - getServerLayout?: (page: React.ReactElement) => Promise; - Page?: (props: T) => React.ReactElement | null; - ServerPage?: (props: T) => Promise | null; - getData?: (arg: GetServerSidePropsContext) => Promise; - isBookingPage?: boolean; - requiresLicense?: boolean; -}; - -export function WithLayout>({ - getLayout, - getServerLayout, - getData, - ServerPage, - Page, - isBookingPage, - requiresLicense, -}: WithLayoutParams) { - // eslint-disable-next-line react/display-name - return async

(p: P extends "P" ? PageProps : LayoutProps) => { - const h = headers(); - const nonce = h.get("x-nonce") ?? undefined; - let props = {} as T; - - if ("searchParams" in p && getData) { - props = (await getData(buildLegacyCtx(h, cookies(), p.params, p.searchParams))) ?? ({} as T); - } - - // `p.children` exists only for layout.tsx files - const childrenFromLayoutFile = "children" in p ? p.children : null; - const page = ServerPage ? ( - await ServerPage({ ...props, ...p }) - ) : Page ? ( - - ) : ( - childrenFromLayoutFile - ); - const pageWithServerLayout = page ? (getServerLayout ? await getServerLayout(page) : page) : null; - - return ( - - {pageWithServerLayout} - - ); - }; -} diff --git a/apps/web/pagesAndRewritePaths.js b/apps/web/pagesAndRewritePaths.js index f64a0d33df..4fb57e7084 100644 --- a/apps/web/pagesAndRewritePaths.js +++ b/apps/web/pagesAndRewritePaths.js @@ -18,13 +18,11 @@ let pages = (exports.pages = glob .replace(/(\.tsx|\.js|\.ts)/, "") .replace(/\/.*/, "") ) - // "/future" is a temporary directory for incremental migration to App Router .filter( (v, i, self) => self.indexOf(v) === i && ![ "[user]", - "future", "_trpc", "layout", "layoutHOC", diff --git a/packages/embeds/embed-core/playground.ts b/packages/embeds/embed-core/playground.ts index f1f71d8584..bfdb565c1c 100644 --- a/packages/embeds/embed-core/playground.ts +++ b/packages/embeds/embed-core/playground.ts @@ -31,9 +31,6 @@ const only = searchParams.get("only"); const colorScheme = searchParams.get("color-scheme"); const prerender = searchParams.get("prerender"); -// @ts-expect-error We haven't defined ENABLE_FUTURE_ROUTES as it is a playground specific variable. -window.ENABLE_FUTURE_ROUTES = searchParams.get("future-routes") === "true"; - if (colorScheme) { document.documentElement.style.colorScheme = colorScheme; } diff --git a/packages/embeds/embed-core/src/embed.ts b/packages/embeds/embed-core/src/embed.ts index 7375fb4c18..2d67a37b1e 100644 --- a/packages/embeds/embed-core/src/embed.ts +++ b/packages/embeds/embed-core/src/embed.ts @@ -297,12 +297,6 @@ export class Cal { urlInstance.pathname = `${urlInstance.pathname}/embed`; } - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - if (window.ENABLE_FUTURE_ROUTES) { - urlInstance.pathname = `/future${urlInstance.pathname}`; - } - urlInstance.searchParams.set("embed", this.namespace); if (embedConfig.debug) {