Skip to content

Commit

Permalink
Indicator level can be hidden in indicator list based on backend setting
Browse files Browse the repository at this point in the history
  • Loading branch information
Bhavatu committed Oct 23, 2024
1 parent acb091f commit 9faba90
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default async function ActionsPage({ params }: Props) {
<IndicatorList
leadContent={data.planPage.leadContent}
displayInsights={data.planPage.displayInsights}
displayLevel={data.planPage.displayLevel}
/>
);
}
3 changes: 2 additions & 1 deletion common/__generated__/graphql.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion components/indicators/IndicatorList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,14 @@ const getFirstUsableCategoryType = (categoryTypes, indicators) =>
interface Props {
leadContent: IndicatorListPage['leadContent'];
displayInsights: IndicatorListPage['displayInsights'];
displayLevel: IndicatorListPage['displayLevel'];
}

const IndicatorList = ({ leadContent, displayInsights }: Props) => {
const IndicatorList = ({
leadContent,
displayInsights,
displayLevel,
}: Props) => {
const plan = usePlan();
const t = useTranslations();
const searchParams = useSearchParams();
Expand Down Expand Up @@ -327,6 +332,7 @@ const IndicatorList = ({ leadContent, displayInsights }: Props) => {
shouldDisplayCategory={(category: Category) =>
category.type.id === categoryType?.id
}
displayLevel={displayLevel}
/>
</Container>
</>
Expand Down
6 changes: 4 additions & 2 deletions components/indicators/IndicatorListFiltered.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ const IndicatorListFiltered = (props) => {
hierarchy,
displayNormalizedValues,
shouldDisplayCategory,
displayLevel,
} = props;

const locale = useLocale();
Expand Down Expand Up @@ -539,7 +540,7 @@ const IndicatorListFiltered = (props) => {
</IndentableTableHeader>
);
}
if (!allIndicatorsHaveSameLevel) {
if (!allIndicatorsHaveSameLevel && displayLevel) {
headers.push(
<IndentableTableHeader key="hr-type">
{t('type')}
Expand Down Expand Up @@ -674,7 +675,7 @@ const IndicatorListFiltered = (props) => {
)}
</IndentableTableCell>
)}
{!allIndicatorsHaveSameLevel && (
{!allIndicatorsHaveSameLevel && displayLevel && (
<IndentableTableCell>
<IndicatorType $level={item.level}>
{indicatorType || <span>-</span>}
Expand Down Expand Up @@ -754,6 +755,7 @@ IndicatorListFiltered.propTypes = {
categoryColumnLabel: PropTypes.string,
indicators: PropTypes.arrayOf(PropTypes.object).isRequired,
shouldDisplayCategory: PropTypes.func,
displayLevel: PropTypes.bool,
};

export default IndicatorListFiltered;
1 change: 1 addition & 0 deletions queries/get-indicator-list-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const GET_INDICATOR_LIST_PAGE = gql`
... on IndicatorListPage {
leadContent
displayInsights
displayLevel
}
lastPublishedAt
}
Expand Down

0 comments on commit 9faba90

Please sign in to comment.