From 7dfa38ec7f08bef9a8bbd6dbe155ea30f47ddabd Mon Sep 17 00:00:00 2001 From: Chris Short <13677134+devcshort@users.noreply.github.com> Date: Mon, 28 Aug 2023 16:50:34 -0700 Subject: [PATCH] Add ability to hide categories and last assured date --- packages/client/app.defaults.json | 4 ++ .../organisms/ResourceOverviewSection.tsx | 68 +++++++++++-------- 2 files changed, 43 insertions(+), 29 deletions(-) diff --git a/packages/client/app.defaults.json b/packages/client/app.defaults.json index 2ce74aba..c07d69e3 100644 --- a/packages/client/app.defaults.json +++ b/packages/client/app.defaults.json @@ -42,6 +42,10 @@ "description": "211 connects callers, at no cost, to critical health and human services in their community. If you're unable to find a service, please dial 211 for assistance." }, "showLocationInput": false + }, + "resource": { + "hideCategories": false, + "hideLastAssured": false } }, "menus": { diff --git a/packages/client/components/organisms/ResourceOverviewSection.tsx b/packages/client/components/organisms/ResourceOverviewSection.tsx index 83a7f355..cb64b504 100644 --- a/packages/client/components/organisms/ResourceOverviewSection.tsx +++ b/packages/client/components/organisms/ResourceOverviewSection.tsx @@ -20,6 +20,7 @@ import { USER_PREF_COORDS, USER_PREF_LOCATION, } from '../../lib/constants/cookies'; +import { useAppConfig } from '../../lib/hooks/useAppConfig'; type Props = { id: string; @@ -45,6 +46,7 @@ export function ResourceOverviewSection(props: Props) { const theme = useMantineTheme(); const [cookies] = useCookies(); const [coords, setCoords] = useState(null); + const config = useAppConfig(); useEffect(() => { if (cookies[USER_PREF_COORDS] && cookies[USER_PREF_LOCATION]) { @@ -76,36 +78,44 @@ export function ResourceOverviewSection(props: Props) { - - {t('categories')} - - - {props.categories?.map((el: any) => { - return ( - - {el.name} - - ); - })} - + {config?.pages?.resource?.hideCategories ? null : ( + <> + + {t('categories')} + + + {props.categories?.map((el: any) => { + return ( + + {el.name} + + ); + })} + + + )} - - {t('last_assured')} - - {props.lastAssuredOn || t('unknown')} + {config?.pages?.resource?.hideLastAssured ? null : ( + <> + + {t('last_assured')} + + {props.lastAssuredOn || t('unknown')} + + )}