Scheduling infrastructure for absolutely everyone.
refactor: check insights feature flag in higher stack (#21341)
Benny Joo0802ebb17bd0
diff --git a/apps/web/app/(use-page-wrapper)/insights/layout.tsx b/apps/web/app/(use-page-wrapper)/insights/layout.tsxindex 6af02c3dcf5..7e987011ad2 100644--- a/apps/web/app/(use-page-wrapper)/insights/layout.tsx+++ b/apps/web/app/(use-page-wrapper)/insights/layout.tsx@@ -1,12 +1,22 @@import { getTranslate } from "app/_utils";+import { notFound } from "next/navigation";import { CTA_CONTAINER_CLASS_NAME } from "@calcom/features/data-table/lib/utils";+import { FeaturesRepository } from "@calcom/features/flags/features.repository";import Shell from "@calcom/features/shell/Shell";import UpgradeTipWrapper from "./UpgradeTipWrapper";export default async function InsightsLayout({ children }: { children: React.ReactNode }) {+ const featuresRepository = new FeaturesRepository();+ const insightsEnabled = await featuresRepository.checkIfFeatureIsEnabledGlobally("insights");++ if (!insightsEnabled) {+ return notFound();+ }+const t = await getTranslate();+return (<><div>diff --git a/apps/web/app/(use-page-wrapper)/insights/page.tsx b/apps/web/app/(use-page-wrapper)/insights/page.tsxindex 1ce981f4b01..f5180928dc2 100644--- a/apps/web/app/(use-page-wrapper)/insights/page.tsx+++ b/apps/web/app/(use-page-wrapper)/insights/page.tsx@@ -1,7 +1,4 @@import { _generateMetadata } from "app/_utils";-import { notFound } from "next/navigation";--import { FeaturesRepository } from "@calcom/features/flags/features.repository";import InsightsPage from "~/insights/insights-view";@@ -15,12 +12,5 @@ export const generateMetadata = async () =>);export default async function Page() {- const featuresRepository = new FeaturesRepository();- const insightsEnabled = await featuresRepository.checkIfFeatureIsEnabledGlobally("insights");-- if (!insightsEnabled) {- return notFound();- }-return <InsightsPage />;}diff --git a/apps/web/app/(use-page-wrapper)/insights/router-position/page.tsx b/apps/web/app/(use-page-wrapper)/insights/router-position/page.tsxindex b7a216fe1eb..dd85b74bd71 100644--- a/apps/web/app/(use-page-wrapper)/insights/router-position/page.tsx+++ b/apps/web/app/(use-page-wrapper)/insights/router-position/page.tsx@@ -1,7 +1,4 @@import { _generateMetadata } from "app/_utils";-import { notFound } from "next/navigation";--import { FeaturesRepository } from "@calcom/features/flags/features.repository";import InsightsVirtualQueuesPage from "~/insights/insights-virtual-queues-view";@@ -15,12 +12,5 @@ export const generateMetadata = async () =>);export default async function Page() {- const featuresRepository = new FeaturesRepository();- const insightsEnabled = await featuresRepository.checkIfFeatureIsEnabledGlobally("insights");-- if (!insightsEnabled) {- return notFound();- }-return <InsightsVirtualQueuesPage />;}diff --git a/apps/web/app/(use-page-wrapper)/insights/routing/page.tsx b/apps/web/app/(use-page-wrapper)/insights/routing/page.tsxindex 17585030514..72e91224a9e 100644--- a/apps/web/app/(use-page-wrapper)/insights/routing/page.tsx+++ b/apps/web/app/(use-page-wrapper)/insights/routing/page.tsx@@ -1,7 +1,4 @@import { _generateMetadata } from "app/_utils";-import { notFound } from "next/navigation";--import { FeaturesRepository } from "@calcom/features/flags/features.repository";import InsightsRoutingPage from "~/insights/insights-routing-view";@@ -15,12 +12,5 @@ export const generateMetadata = async () =>);export default async function Page() {- const featuresRepository = new FeaturesRepository();- const insightsEnabled = await featuresRepository.checkIfFeatureIsEnabledGlobally("insights");-- if (!insightsEnabled) {- return notFound();- }-return <InsightsRoutingPage />;}