Skip to content

Commit 3e87491

Browse files
fix: add routing page to enable client-side navigation from sidebar (calcom#27862)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 3277205 commit 3e87491

3 files changed

Lines changed: 47 additions & 8 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import type { ReactNode } from "react";
2+
import Shell from "~/shell/Shell";
3+
import FormProvider from "../apps/routing-forms/[...pages]/FormProvider";
4+
5+
export default async function Layout({ children }: { children: ReactNode }) {
6+
return (
7+
<Shell withoutMain={true}>
8+
<FormProvider>{children}</FormProvider>
9+
</Shell>
10+
);
11+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { _generateMetadata } from "app/_utils";
2+
import { cookies, headers } from "next/headers";
3+
import { redirect } from "next/navigation";
4+
5+
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
6+
7+
import { buildLegacyRequest } from "@lib/buildLegacyCtx";
8+
9+
import Forms from "../apps/routing-forms/forms/[[...pages]]/Forms";
10+
11+
const generateMetadata = async () => {
12+
return await _generateMetadata(
13+
(t) => `${t("routing_forms")} | Cal.com Forms`,
14+
() => "",
15+
undefined,
16+
undefined,
17+
`/routing`
18+
);
19+
};
20+
21+
const ServerPage = async () => {
22+
const session = await getServerSession({ req: buildLegacyRequest(await headers(), await cookies()) });
23+
24+
if (!session?.user?.id) {
25+
redirect("/auth/login");
26+
}
27+
28+
return <Forms appUrl="/routing" />;
29+
};
30+
31+
export { generateMetadata };
32+
export default ServerPage;

apps/web/next.config.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -273,14 +273,6 @@ const nextConfig = (phase: string): NextConfig => {
273273
source: "/forms/:formQuery*",
274274
destination: "/apps/routing-forms/routing-link/:formQuery*",
275275
},
276-
{
277-
source: "/routing",
278-
destination: "/routing/forms",
279-
},
280-
{
281-
source: "/routing/:path*",
282-
destination: "/apps/routing-forms/:path*",
283-
},
284276
{
285277
source: "/routing-forms",
286278
destination: "/apps/routing-forms/forms",
@@ -339,6 +331,10 @@ const nextConfig = (phase: string): NextConfig => {
339331
].filter(isNotNull);
340332

341333
const afterFiles = [
334+
{
335+
source: "/routing/:path*",
336+
destination: "/apps/routing-forms/:path*",
337+
},
342338
{
343339
source: "/org/:slug",
344340
destination: "/team/:slug",

0 commit comments

Comments
 (0)