chore: Remove Pages Router / Use App Router - /workflows (#16519)
* /workflows: Remove Pages Router / Render App Router * fix * unneeded changes * disable server side fetching for now * revert unneeded changes
This commit is contained in:
1 parent
fc6e39c78a
commit
ce9df65b5d
11 files changed
+63
-91
No files matched your search
@@ -357,7 +357,6 @@ APP_ROUTER_APPS_CATEGORIES_ENABLED=0
|
|||||||
APP_ROUTER_APPS_CATEGORIES_CATEGORY_ENABLED=0
|
APP_ROUTER_APPS_CATEGORIES_CATEGORY_ENABLED=0
|
||||||
APP_ROUTER_BOOKING_ENABLED=0
|
APP_ROUTER_BOOKING_ENABLED=0
|
||||||
APP_ROUTER_BOOKINGS_STATUS_ENABLED=0
|
APP_ROUTER_BOOKINGS_STATUS_ENABLED=0
|
||||||
APP_ROUTER_WORKFLOWS_ENABLED=0
|
|
||||||
APP_ROUTER_GETTING_STARTED_STEP_ENABLED=0
|
APP_ROUTER_GETTING_STARTED_STEP_ENABLED=0
|
||||||
APP_ROUTER_VIDEO_ENABLED=0
|
APP_ROUTER_VIDEO_ENABLED=0
|
||||||
APP_ROUTER_TEAM_ENABLED=0
|
APP_ROUTER_TEAM_ENABLED=0
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ const ROUTES: [URLPattern, boolean][] = [
|
|||||||
["/auth/error", process.env.APP_ROUTER_AUTH_ERROR_ENABLED === "1"] as const,
|
["/auth/error", process.env.APP_ROUTER_AUTH_ERROR_ENABLED === "1"] as const,
|
||||||
["/auth/platform/:path*", process.env.APP_ROUTER_AUTH_PLATFORM_ENABLED === "1"] as const,
|
["/auth/platform/:path*", process.env.APP_ROUTER_AUTH_PLATFORM_ENABLED === "1"] as const,
|
||||||
["/auth/oauth2/:path*", process.env.APP_ROUTER_AUTH_OAUTH2_ENABLED === "1"] as const,
|
["/auth/oauth2/:path*", process.env.APP_ROUTER_AUTH_OAUTH2_ENABLED === "1"] as const,
|
||||||
["/workflows/:path*", process.env.APP_ROUTER_WORKFLOWS_ENABLED === "1"] as const,
|
|
||||||
["/getting-started/:step", process.env.APP_ROUTER_GETTING_STARTED_STEP_ENABLED === "1"] as const,
|
["/getting-started/:step", process.env.APP_ROUTER_GETTING_STARTED_STEP_ENABLED === "1"] as const,
|
||||||
["/bookings/:status", process.env.APP_ROUTER_BOOKINGS_STATUS_ENABLED === "1"] as const,
|
["/bookings/:status", process.env.APP_ROUTER_BOOKINGS_STATUS_ENABLED === "1"] as const,
|
||||||
["/booking/:path*", process.env.APP_ROUTER_BOOKING_ENABLED === "1"] as const,
|
["/booking/:path*", process.env.APP_ROUTER_BOOKING_ENABLED === "1"] as const,
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
import type { PageProps } from "app/_types";
|
|
||||||
import { _generateMetadata } from "app/_utils";
|
|
||||||
import { WithLayout } from "app/layoutHOC";
|
|
||||||
|
|
||||||
import { getServerSessionForAppDir } from "@calcom/feature-auth/lib/get-server-session-for-app-dir";
|
|
||||||
import LegacyPage from "@calcom/features/ee/workflows/pages/index";
|
|
||||||
import { getTeamsFiltersFromQuery } from "@calcom/features/filters/lib/getTeamsFiltersFromQuery";
|
|
||||||
import { WorkflowRepository } from "@calcom/lib/server/repository/workflow";
|
|
||||||
|
|
||||||
export const generateMetadata = async () =>
|
|
||||||
await _generateMetadata(
|
|
||||||
(t) => t("workflows"),
|
|
||||||
(t) => t("workflows_to_automate_notifications")
|
|
||||||
);
|
|
||||||
|
|
||||||
const Page = async ({ params, searchParams }: PageProps) => {
|
|
||||||
// FIXME: Refactor me once next-auth endpoint is migrated to App Router
|
|
||||||
const session = await getServerSessionForAppDir();
|
|
||||||
const user = session?.user;
|
|
||||||
|
|
||||||
const filters = getTeamsFiltersFromQuery({ ...searchParams, ...params });
|
|
||||||
|
|
||||||
let filteredList;
|
|
||||||
try {
|
|
||||||
filteredList = await WorkflowRepository.getFilteredList({
|
|
||||||
userId: user?.id,
|
|
||||||
input: {
|
|
||||||
filters,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} catch (err) {}
|
|
||||||
|
|
||||||
return <LegacyPage filteredList={filteredList} />;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default WithLayout({ getLayout: null, ServerPage: Page })<"P">;
|
|
||||||
+22
-20
@@ -4,7 +4,7 @@ import { WithLayout } from "app/layoutHOC";
|
|||||||
import { notFound } from "next/navigation";
|
import { notFound } from "next/navigation";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
import { getServerSessionForAppDir } from "@calcom/feature-auth/lib/get-server-session-for-app-dir";
|
// import { getServerSessionForAppDir } from "@calcom/feature-auth/lib/get-server-session-for-app-dir";
|
||||||
import LegacyPage from "@calcom/features/ee/workflows/pages/workflow";
|
import LegacyPage from "@calcom/features/ee/workflows/pages/workflow";
|
||||||
import { WorkflowRepository } from "@calcom/lib/server/repository/workflow";
|
import { WorkflowRepository } from "@calcom/lib/server/repository/workflow";
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ export const generateMetadata = async ({ params, searchParams }: PageProps) => {
|
|||||||
const workflow = await WorkflowRepository.getById({ id: +parsed.data.workflow });
|
const workflow = await WorkflowRepository.getById({ id: +parsed.data.workflow });
|
||||||
|
|
||||||
return await _generateMetadata(
|
return await _generateMetadata(
|
||||||
() => (workflow && workflow.name ? workflow.name : "Untitled"),
|
(t) => (workflow && workflow.name ? workflow.name : t("untitled")),
|
||||||
() => ""
|
() => ""
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -30,31 +30,33 @@ export const generateStaticParams = () => [];
|
|||||||
|
|
||||||
const Page = async ({ params, searchParams }: PageProps) => {
|
const Page = async ({ params, searchParams }: PageProps) => {
|
||||||
// FIXME: Refactor me once next-auth endpoint is migrated to App Router
|
// FIXME: Refactor me once next-auth endpoint is migrated to App Router
|
||||||
const session = await getServerSessionForAppDir();
|
// const session = await getServerSessionForAppDir();
|
||||||
const user = session?.user;
|
// const user = session?.user;
|
||||||
const parsed = querySchema.safeParse({ ...params, ...searchParams });
|
const parsed = querySchema.safeParse({ ...params, ...searchParams });
|
||||||
if (!parsed.success) {
|
if (!parsed.success) {
|
||||||
notFound();
|
notFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
const workflow = await WorkflowRepository.getById({ id: +parsed.data.workflow });
|
// const workflow = await WorkflowRepository.getById({ id: +parsed.data.workflow });
|
||||||
let verifiedEmails, verifiedNumbers;
|
// let verifiedEmails, verifiedNumbers;
|
||||||
try {
|
// try {
|
||||||
verifiedEmails = await WorkflowRepository.getVerifiedEmails({
|
// verifiedEmails = await WorkflowRepository.getVerifiedEmails({
|
||||||
userEmail: user?.email ?? null,
|
// userEmail: user?.email ?? null,
|
||||||
userId: user?.id ?? null,
|
// userId: user?.id ?? null,
|
||||||
teamId: workflow?.team?.id,
|
// teamId: workflow?.team?.id,
|
||||||
});
|
// });
|
||||||
} catch (err) {}
|
// } catch (err) {}
|
||||||
try {
|
// try {
|
||||||
verifiedNumbers = await WorkflowRepository.getVerifiedNumbers({
|
// verifiedNumbers = await WorkflowRepository.getVerifiedNumbers({
|
||||||
userId: user?.id ?? null,
|
// userId: user?.id ?? null,
|
||||||
teamId: workflow?.team?.id,
|
// teamId: workflow?.team?.id,
|
||||||
});
|
// });
|
||||||
} catch (err) {}
|
// } catch (err) {}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LegacyPage workflowData={workflow} verifiedEmails={verifiedEmails} verifiedNumbers={verifiedNumbers} />
|
<LegacyPage
|
||||||
|
// workflowData={workflow} verifiedEmails={verifiedEmails} verifiedNumbers={verifiedNumbers}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
import type { PageProps } from "app/_types";
|
||||||
|
import { _generateMetadata } from "app/_utils";
|
||||||
|
import { WithLayout } from "app/layoutHOC";
|
||||||
|
|
||||||
|
// import { getServerSessionForAppDir } from "@calcom/feature-auth/lib/get-server-session-for-app-dir";
|
||||||
|
// import { getTeamsFiltersFromQuery } from "@calcom/features/filters/lib/getTeamsFiltersFromQuery";
|
||||||
|
// import { WorkflowRepository } from "@calcom/lib/server/repository/workflow";
|
||||||
|
import LegacyPage from "@calcom/features/ee/workflows/pages/index";
|
||||||
|
|
||||||
|
export const generateMetadata = async () =>
|
||||||
|
await _generateMetadata(
|
||||||
|
(t) => t("workflows"),
|
||||||
|
(t) => t("workflows_to_automate_notifications")
|
||||||
|
);
|
||||||
|
|
||||||
|
const Page = async ({ params, searchParams }: PageProps) => {
|
||||||
|
// FIXME: Refactor me once next-auth endpoint is migrated to App Router
|
||||||
|
// const session = await getServerSessionForAppDir();
|
||||||
|
// const user = session?.user;
|
||||||
|
|
||||||
|
// const filters = getTeamsFiltersFromQuery({ ...searchParams, ...params });
|
||||||
|
|
||||||
|
// let filteredList;
|
||||||
|
// try {
|
||||||
|
// filteredList = await WorkflowRepository.getFilteredList({
|
||||||
|
// userId: user?.id,
|
||||||
|
// input: {
|
||||||
|
// filters,
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
// } catch (err) {}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<LegacyPage
|
||||||
|
// filteredList={filteredList}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default WithLayout({ getLayout: null, ServerPage: Page })<"P">;
|
||||||
@@ -177,7 +177,6 @@ export const config = {
|
|||||||
"/apps/categories/:category/",
|
"/apps/categories/:category/",
|
||||||
"/future/apps/categories/:category/",
|
"/future/apps/categories/:category/",
|
||||||
"/workflows/:path*",
|
"/workflows/:path*",
|
||||||
"/future/workflows/:path*",
|
|
||||||
"/getting-started/:step/",
|
"/getting-started/:step/",
|
||||||
"/future/getting-started/:step/",
|
"/future/getting-started/:step/",
|
||||||
"/apps",
|
"/apps",
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
import type { GetStaticPaths } from "next";
|
|
||||||
|
|
||||||
import Workflow from "@calcom/features/ee/workflows/pages/workflow";
|
|
||||||
|
|
||||||
import { getStaticProps } from "@lib/workflows/[workflow]/getStaticProps";
|
|
||||||
|
|
||||||
import PageWrapper from "@components/PageWrapper";
|
|
||||||
import type { CalPageWrapper } from "@components/PageWrapper";
|
|
||||||
|
|
||||||
export const getStaticPaths: GetStaticPaths = () => {
|
|
||||||
return {
|
|
||||||
paths: [],
|
|
||||||
fallback: "blocking",
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const WorkflowsPage = Workflow as CalPageWrapper;
|
|
||||||
WorkflowsPage.PageWrapper = PageWrapper;
|
|
||||||
|
|
||||||
export default WorkflowsPage;
|
|
||||||
export { getStaticProps };
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
import Workflows from "@calcom/features/ee/workflows/pages/index";
|
|
||||||
|
|
||||||
import PageWrapper from "@components/PageWrapper";
|
|
||||||
import type { CalPageWrapper } from "@components/PageWrapper";
|
|
||||||
|
|
||||||
const WorkflowsPage = Workflows as CalPageWrapper;
|
|
||||||
WorkflowsPage.PageWrapper = PageWrapper;
|
|
||||||
|
|
||||||
export default WorkflowsPage;
|
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
"second_one": "{{count}} second",
|
"second_one": "{{count}} second",
|
||||||
"second_other": "{{count}} seconds",
|
"second_other": "{{count}} seconds",
|
||||||
"upgrade_now": "Upgrade now",
|
"upgrade_now": "Upgrade now",
|
||||||
|
"untitled": "Untitled",
|
||||||
"accept_invitation": "Accept Invitation",
|
"accept_invitation": "Accept Invitation",
|
||||||
"max_characters": "Max. Characters",
|
"max_characters": "Max. Characters",
|
||||||
"min_characters": "Min. Characters",
|
"min_characters": "Min. Characters",
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ checkRoute "$APP_ROUTER_AUTH_SAML_ENABLED" app/future/auth/saml-idp
|
|||||||
checkRoute "$APP_ROUTER_AUTH_ERROR_ENABLED" app/future/auth/error
|
checkRoute "$APP_ROUTER_AUTH_ERROR_ENABLED" app/future/auth/error
|
||||||
checkRoute "$APP_ROUTER_AUTH_PLATFORM_ENABLED" app/future/auth/platform
|
checkRoute "$APP_ROUTER_AUTH_PLATFORM_ENABLED" app/future/auth/platform
|
||||||
checkRoute "$APP_ROUTER_AUTH_OAUTH2_ENABLED" app/future/auth/oauth2
|
checkRoute "$APP_ROUTER_AUTH_OAUTH2_ENABLED" app/future/auth/oauth2
|
||||||
checkRoute "$APP_ROUTER_WORKFLOWS_ENABLED" app/future/workflows
|
|
||||||
checkRoute "$APP_ROUTER_GETTING_STARTED_STEP_ENABLED" app/future/getting-started
|
checkRoute "$APP_ROUTER_GETTING_STARTED_STEP_ENABLED" app/future/getting-started
|
||||||
checkRoute "$APP_ROUTER_BOOKINGS_STATUS_ENABLED" app/future/bookings
|
checkRoute "$APP_ROUTER_BOOKINGS_STATUS_ENABLED" app/future/bookings
|
||||||
checkRoute "$APP_ROUTER_BOOKING_ENABLED" app/future/booking
|
checkRoute "$APP_ROUTER_BOOKING_ENABLED" app/future/booking
|
||||||
|
|||||||
@@ -241,7 +241,6 @@
|
|||||||
"APP_ROUTER_BOOKINGS_STATUS_ENABLED",
|
"APP_ROUTER_BOOKINGS_STATUS_ENABLED",
|
||||||
"APP_ROUTER_EVENT_TYPES_ENABLED",
|
"APP_ROUTER_EVENT_TYPES_ENABLED",
|
||||||
"APP_ROUTER_GETTING_STARTED_STEP_ENABLED",
|
"APP_ROUTER_GETTING_STARTED_STEP_ENABLED",
|
||||||
"APP_ROUTER_WORKFLOWS_ENABLED",
|
|
||||||
"APP_ROUTER_VIDEO_ENABLED",
|
"APP_ROUTER_VIDEO_ENABLED",
|
||||||
"APP_ROUTER_AUTH_FORGOT_PASSWORD_ENABLED",
|
"APP_ROUTER_AUTH_FORGOT_PASSWORD_ENABLED",
|
||||||
"APP_ROUTER_AUTH_LOGIN_ENABLED",
|
"APP_ROUTER_AUTH_LOGIN_ENABLED",
|
||||||
|
|||||||
Reference in new issue
Block a user