From 2667d03e429f6f70967abac228a0b08b435a2958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mir=C3=B3=20Sorja?= Date: Fri, 29 Nov 2024 15:00:01 +0100 Subject: [PATCH] 4155 - Dashboard: Show only for published cycles --- .../CountryHome/FraHome/hooks/useSections.tsx | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/client/pages/CountryHome/FraHome/hooks/useSections.tsx b/src/client/pages/CountryHome/FraHome/hooks/useSections.tsx index 945294083c..38fe9f9d93 100644 --- a/src/client/pages/CountryHome/FraHome/hooks/useSections.tsx +++ b/src/client/pages/CountryHome/FraHome/hooks/useSections.tsx @@ -1,11 +1,11 @@ import React, { useMemo } from 'react' import { Areas } from 'meta/area' -import { AssessmentNames } from 'meta/assessment' +import { Cycles } from 'meta/assessment' import { SectionNames } from 'meta/routes' import { Users } from 'meta/user' -import { useAssessment, useCycle } from 'client/store/assessment' +import { useCycle } from 'client/store/assessment' import { useUser } from 'client/store/user' import { useCountryRouteParams } from 'client/hooks/useRouteParams' import Collaborators from 'client/pages/CountryHome/FraHome/Collaborators' @@ -22,7 +22,6 @@ type Section = { export const useSections = (): Array
=> { const user = useUser() const { countryIso } = useCountryRouteParams() - const assessment = useAssessment() const cycle = useCycle() return useMemo(() => { @@ -30,8 +29,7 @@ export const useSections = (): Array
=> { if (!cycle) return null - const isFra2020 = assessment.props.name === AssessmentNames.fra && cycle.name === '2020' - const showOverview = isFra2020 || Areas.isISOCountry(countryIso) + const showOverview = Cycles.isPublished(cycle) || Areas.isISOCountry(countryIso) if (showOverview) { sections.push({ name: SectionNames.Country.Home.overview, component: Overview }) @@ -47,10 +45,6 @@ export const useSections = (): Array
=> { sections.splice(2, 0, { name: SectionNames.Country.Home.userManagement, component: Collaborators }) } - // if (Users.isAdministrator(user) || Users.isReviewer(user, countryIso, cycle)) { - // sections.splice(2, 0, { name: SectionNames.contentCheck, component: Placeholder }) - // } - return sections - }, [assessment.props.name, cycle, user, countryIso]) + }, [cycle, user, countryIso]) }