Scheduling infrastructure for absolutely everyone.
fix: add routing page to enable client-side navigation from sidebar (#27862)
Rajiv Sahal3e874917ec36
diff --git a/apps/web/app/(use-page-wrapper)/routing/layout.tsx b/apps/web/app/(use-page-wrapper)/routing/layout.tsxnew file mode 100644index 00000000000..4b4870529da--- /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 (+ <Shell withoutMain={true}>+ <FormProvider>{children}</FormProvider>+ </Shell>+ );+}diff --git a/apps/web/app/(use-page-wrapper)/routing/page.tsx b/apps/web/app/(use-page-wrapper)/routing/page.tsxnew file mode 100644index 00000000000..3f550e62e96--- /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 <Forms appUrl="/routing" />;+};++export { generateMetadata };+export default ServerPage;diff --git a/apps/web/next.config.ts b/apps/web/next.config.tsindex e216d116e76..d82e9d99ca1 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",