chore: [app-router-migration-11] Migrate workflow page group (#12777)
* add a/b test flags for apps, workflows, getting-started, settings/teams * Finalize * Discard changes to apps/web/app/layoutHOC.tsx * fix: types * manual: address Keith's comments --------- Co-authored-by: Benny Joo <sldisek783@gmail.com> Co-authored-by: Omar López <zomars@me.com>
This commit is contained in:
parent
a2e70f9aad
commit
4ca79af13f
|
@ -0,0 +1,43 @@
|
||||||
|
import { _generateMetadata } from "app/_utils";
|
||||||
|
import { WithLayout } from "app/layoutHOC";
|
||||||
|
import { type GetServerSidePropsContext } from "next";
|
||||||
|
import { headers, cookies } from "next/headers";
|
||||||
|
import { notFound } from "next/navigation";
|
||||||
|
import { z } from "zod";
|
||||||
|
|
||||||
|
import LegacyPage from "@calcom/features/ee/workflows/pages/workflow";
|
||||||
|
|
||||||
|
import { buildLegacyCtx } from "@lib/buildLegacyCtx";
|
||||||
|
|
||||||
|
const querySchema = z.object({
|
||||||
|
workflow: z.string(),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const generateMetadata = async ({ params }: { params: Record<string, string | string[]> }) => {
|
||||||
|
const { workflow } = await getProps(
|
||||||
|
buildLegacyCtx(headers(), cookies(), params) as unknown as GetServerSidePropsContext
|
||||||
|
);
|
||||||
|
return await _generateMetadata(
|
||||||
|
() => workflow ?? "Untitled",
|
||||||
|
() => ""
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
async function getProps(context: GetServerSidePropsContext) {
|
||||||
|
const safeParams = querySchema.safeParse(context.params);
|
||||||
|
|
||||||
|
console.log("Built workflow page:", safeParams);
|
||||||
|
if (!safeParams.success) {
|
||||||
|
return notFound();
|
||||||
|
}
|
||||||
|
return { workflow: safeParams.data.workflow };
|
||||||
|
}
|
||||||
|
|
||||||
|
export const generateStaticParams = () => [];
|
||||||
|
|
||||||
|
// @ts-expect-error getData arg
|
||||||
|
export default WithLayout({ getLayout: null, getData: getProps, Page: LegacyPage })<"P">;
|
||||||
|
export const dynamic = "force-static";
|
||||||
|
// generate segments on demand
|
||||||
|
export const dynamicParams = true;
|
||||||
|
export const revalidate = 10;
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { _generateMetadata } from "app/_utils";
|
||||||
|
import { WithLayout } from "app/layoutHOC";
|
||||||
|
|
||||||
|
import { getLayout } from "@calcom/features/MainLayoutAppDir";
|
||||||
|
import LegacyPage from "@calcom/features/ee/workflows/pages/index";
|
||||||
|
|
||||||
|
export const generateMetadata = async () =>
|
||||||
|
await _generateMetadata(
|
||||||
|
(t) => t("workflows"),
|
||||||
|
(t) => t("workflows_to_automate_notifications")
|
||||||
|
);
|
||||||
|
|
||||||
|
export default WithLayout({ getLayout, Page: LegacyPage })<"P">;
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
import { useSession } from "next-auth/react";
|
import { useSession } from "next-auth/react";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import type { Dispatch, SetStateAction } from "react";
|
import type { Dispatch, SetStateAction } from "react";
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import type { WorkflowStep } from "@prisma/client";
|
import type { WorkflowStep } from "@prisma/client";
|
||||||
import { isValidPhoneNumber } from "libphonenumber-js";
|
import { isValidPhoneNumber } from "libphonenumber-js";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user