diff --git a/common/__generated__/graphql.ts b/common/__generated__/graphql.ts index 18e6be65..da3b6370 100644 --- a/common/__generated__/graphql.ts +++ b/common/__generated__/graphql.ts @@ -2166,6 +2166,7 @@ export type IndicatorListPage = PageInterface & { contentType: Scalars['String']; depth?: Maybe; descendants: Array; + displayInsights?: Maybe; draftTitle: Scalars['String']; expireAt?: Maybe; expired: Scalars['Boolean']; @@ -10560,7 +10561,7 @@ export type GetPlanPageIndicatorListQuery = ( { id?: string | null, slug: string, title: string, lastPublishedAt?: any | null } & { __typename: 'AccessibilityStatementPage' | 'ActionListPage' | 'CategoryPage' | 'CategoryTypePage' | 'EmptyPage' | 'ImpactGroupPage' | 'Page' | 'PlanRootPage' | 'PrivacyPolicyPage' | 'StaticPage' } ) | ( - { leadContent?: string | null, id?: string | null, slug: string, title: string, lastPublishedAt?: any | null } + { leadContent?: string | null, displayInsights?: boolean | null, id?: string | null, slug: string, title: string, lastPublishedAt?: any | null } & { __typename: 'IndicatorListPage' } ) | null } & { __typename?: 'Query' } diff --git a/components/indicators/IndicatorList.tsx b/components/indicators/IndicatorList.tsx index 12b39ac0..ee24ebd7 100644 --- a/components/indicators/IndicatorList.tsx +++ b/components/indicators/IndicatorList.tsx @@ -210,9 +210,10 @@ const getFirstUsableCategoryType = (categoryTypes, indicators) => interface Props { title: string; leadContent: IndicatorListPage['leadContent']; + displayInsights: IndicatorListPage['displayInsights']; } -const IndicatorList = ({ title, leadContent }: Props) => { +const IndicatorList = ({ title, leadContent, displayInsights }: Props) => { const plan = usePlan(); const { t } = useTranslation('common'); const router = useRouter(); @@ -332,7 +333,7 @@ const IndicatorList = ({ title, leadContent }: Props) => { const indicatorListProps = getIndicatorListProps(data); const hierarchy = processCommonIndicatorHierarchy(data?.planIndicators); - const showInsights = hasInsights(data); + const showInsights = (displayInsights ?? true) && hasInsights(data); const categoryType = getFirstUsableCategoryType( data?.plan?.categoryTypes, diff --git a/pages/indicators/index.js b/pages/indicators/index.js index bd7d22f8..c68affed 100644 --- a/pages/indicators/index.js +++ b/pages/indicators/index.js @@ -15,6 +15,7 @@ const GET_PLAN_PAGE = gql` title ... on IndicatorListPage { leadContent + displayInsights } lastPublishedAt } @@ -39,6 +40,7 @@ function IndicatorsPage() { );