diff --git a/apps/web/app/future/insights/page.tsx b/apps/web/app/future/insights/page.tsx new file mode 100644 index 0000000000..0b82a624c6 --- /dev/null +++ b/apps/web/app/future/insights/page.tsx @@ -0,0 +1,26 @@ +import LegacyPage from "@pages/insights/index"; +import { _generateMetadata } from "app/_utils"; +import { WithLayout } from "app/layoutHOC"; +import { notFound } from "next/navigation"; + +import { getLayout } from "@calcom/features/MainLayoutAppDir"; +import { getFeatureFlagMap } from "@calcom/features/flags/server/utils"; + +export const generateMetadata = async () => + await _generateMetadata( + () => "Insights", + (t) => t("insights_subtitle") + ); + +async function getData() { + const prisma = await import("@calcom/prisma").then((mod) => mod.default); + const flags = await getFeatureFlagMap(prisma); + + if (flags.insights === false) { + return notFound(); + } + + return {}; +} + +export default WithLayout({ getLayout, getData, Page: LegacyPage }); diff --git a/apps/web/pages/insights/index.tsx b/apps/web/pages/insights/index.tsx index 0c0dd0b60b..35a6fa2cca 100644 --- a/apps/web/pages/insights/index.tsx +++ b/apps/web/pages/insights/index.tsx @@ -1,3 +1,5 @@ +"use client"; + import { getLayout } from "@calcom/features/MainLayout"; import { getFeatureFlagMap } from "@calcom/features/flags/server/utils"; import {