fix: add routing page to enable client-side navigation from sidebar (#27862)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent
3277205404
commit
3e874917ec
@@ -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>
|
||||
);
|
||||
}
|
||||
@@ -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;
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user