chore: migrate /apps/[slug]/setup (#19039)

* chore: remove unused files in /future dir

* chore: migrate /apps/[slug]/setup
This commit is contained in:
Benny Joo
2025-01-31 21:13:56 +01:00
committed by GitHub
parent 8dd05dda70
commit 3ca44cff0c
6 changed files with 36 additions and 67 deletions
@@ -0,0 +1,35 @@
import { withAppDirSsr } from "app/WithAppDirSsr";
import type { PageProps as ServerPageProps } from "app/_types";
import { _generateMetadata } from "app/_utils";
import { cookies, headers } from "next/headers";
import { getServerSideProps } from "@calcom/app-store/_pages/setup/_getServerSideProps";
import { buildLegacyCtx } from "@lib/buildLegacyCtx";
import SetupView, { type PageProps as ClientPageProps } from "~/apps/[slug]/setup/setup-view";
export const generateMetadata = async ({ params }: ServerPageProps) => {
const metadata = await _generateMetadata(
() => `${params.slug}`,
() => ""
);
return {
...metadata,
robots: {
index: false,
follow: false,
},
};
};
const getData = withAppDirSsr<ClientPageProps>(getServerSideProps);
const ServerPage = async ({ params, searchParams }: ServerPageProps) => {
const context = buildLegacyCtx(headers(), cookies(), params, searchParams);
const { dehydratedState, ...props } = await getData(context);
return <SetupView {...props} />;
};
export default ServerPage;
@@ -1,19 +0,0 @@
import { withAppDirSsr } from "app/WithAppDirSsr";
import type { PageProps as _PageProps } from "app/_types";
import { _generateMetadata } from "app/_utils";
import { WithLayout } from "app/layoutHOC";
import { getServerSideProps } from "@calcom/app-store/_pages/setup/_getServerSideProps";
import Page, { type PageProps } from "~/apps/[slug]/setup/setup-view";
export const generateMetadata = async ({ params }: _PageProps) => {
return await _generateMetadata(
() => `${params.slug}`,
() => ""
);
};
const getData = withAppDirSsr<PageProps>(getServerSideProps);
export default WithLayout({ getLayout: null, Page, getData });
@@ -1,19 +0,0 @@
import type { PageProps } from "app/_types";
import { redirect } from "next/navigation";
import z from "zod";
const paramsSchema = z
.object({
pages: z.array(z.string()),
})
.catch({
pages: [],
});
const Page = ({ params, searchParams }: PageProps) => {
const { pages } = paramsSchema.parse({ ...params, ...searchParams });
redirect(`/apps/routing-forms/${pages.length ? pages.join("/") : ""}`);
};
export default Page;
@@ -1,7 +0,0 @@
import { redirect } from "next/navigation";
const Page = () => {
redirect("/apps/routing-forms/forms");
};
export default Page;
@@ -7,7 +7,6 @@ import { AppSetupPage } from "@calcom/app-store/_pages/setup";
import type { getServerSideProps } from "@calcom/app-store/_pages/setup/_getServerSideProps";
import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";
import type { inferSSRProps } from "@calcom/types/inferSSRProps";
import { HeadSeo } from "@calcom/ui";
export type PageProps = inferSSRProps<typeof getServerSideProps>;
@@ -28,11 +27,5 @@ export default function SetupInformation(props: PageProps) {
router.replace(`/auth/login?${urlSearchParams.toString()}`);
}
return (
<>
{/* So that the set up page does not get indexed by search engines */}
<HeadSeo nextSeoProps={{ noindex: true, nofollow: true }} title={`${slug} | Cal.com`} description="" />
<AppSetupPage slug={slug} {...props} />
</>
);
return <AppSetupPage slug={slug} {...props} />;
}
-14
View File
@@ -1,14 +0,0 @@
import { getServerSideProps } from "@calcom/app-store/_pages/setup/_getServerSideProps";
import PageWrapper from "@components/PageWrapper";
import type { PageProps } from "~/apps/[slug]/setup/setup-view";
import SetupView from "~/apps/[slug]/setup/setup-view";
const Page = (props: PageProps) => <SetupView {...props} />;
Page.PageWrapper = PageWrapper;
export { getServerSideProps };
export default Page;