diff --git a/apps/web/app/(use-page-wrapper)/insights/layout.tsx b/apps/web/app/(use-page-wrapper)/insights/layout.tsx index 6af02c3dcf..7e987011ad 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 ( <>
diff --git a/apps/web/app/(use-page-wrapper)/insights/page.tsx b/apps/web/app/(use-page-wrapper)/insights/page.tsx index 1ce981f4b0..f5180928dc 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 ; } 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.tsx index b7a216fe1e..dd85b74bd7 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 ; } diff --git a/apps/web/app/(use-page-wrapper)/insights/routing/page.tsx b/apps/web/app/(use-page-wrapper)/insights/routing/page.tsx index 1758503051..72e91224a9 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 ; }