diff --git a/apps/web/app/(use-page-wrapper)/routing/layout.tsx b/apps/web/app/(use-page-wrapper)/routing/layout.tsx new file mode 100644 index 0000000000..4b4870529d --- /dev/null +++ b/apps/web/app/(use-page-wrapper)/routing/layout.tsx @@ -0,0 +1,11 @@ +import type { ReactNode } from "react"; +import Shell from "~/shell/Shell"; +import FormProvider from "../apps/routing-forms/[...pages]/FormProvider"; + +export default async function Layout({ children }: { children: ReactNode }) { + return ( + + {children} + + ); +} diff --git a/apps/web/app/(use-page-wrapper)/routing/page.tsx b/apps/web/app/(use-page-wrapper)/routing/page.tsx new file mode 100644 index 0000000000..3f550e62e9 --- /dev/null +++ b/apps/web/app/(use-page-wrapper)/routing/page.tsx @@ -0,0 +1,32 @@ +import { _generateMetadata } from "app/_utils"; +import { cookies, headers } from "next/headers"; +import { redirect } from "next/navigation"; + +import { getServerSession } from "@calcom/features/auth/lib/getServerSession"; + +import { buildLegacyRequest } from "@lib/buildLegacyCtx"; + +import Forms from "../apps/routing-forms/forms/[[...pages]]/Forms"; + +const generateMetadata = async () => { + return await _generateMetadata( + (t) => `${t("routing_forms")} | Cal.com Forms`, + () => "", + undefined, + undefined, + `/routing` + ); +}; + +const ServerPage = async () => { + const session = await getServerSession({ req: buildLegacyRequest(await headers(), await cookies()) }); + + if (!session?.user?.id) { + redirect("/auth/login"); + } + + return ; +}; + +export { generateMetadata }; +export default ServerPage; diff --git a/apps/web/next.config.ts b/apps/web/next.config.ts index e216d116e7..d82e9d99ca 100644 --- a/apps/web/next.config.ts +++ b/apps/web/next.config.ts @@ -273,14 +273,6 @@ const nextConfig = (phase: string): NextConfig => { source: "/forms/:formQuery*", destination: "/apps/routing-forms/routing-link/:formQuery*", }, - { - source: "/routing", - destination: "/routing/forms", - }, - { - source: "/routing/:path*", - destination: "/apps/routing-forms/:path*", - }, { source: "/routing-forms", destination: "/apps/routing-forms/forms", @@ -339,6 +331,10 @@ const nextConfig = (phase: string): NextConfig => { ].filter(isNotNull); const afterFiles = [ + { + source: "/routing/:path*", + destination: "/apps/routing-forms/:path*", + }, { source: "/org/:slug", destination: "/team/:slug",