From 0868c9fd0fe29d0d675f5b85dbba133ac472e925 Mon Sep 17 00:00:00 2001 From: datle Date: Wed, 12 Apr 2023 08:55:01 +0800 Subject: [PATCH] feat: add verify Message button to headers --- public/locales/gov/en/translation.json | 3 ++- .../BaseLayout/BaseLayoutHeader.tsx | 25 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/public/locales/gov/en/translation.json b/public/locales/gov/en/translation.json index fdac3373e..501ced066 100644 --- a/public/locales/gov/en/translation.json +++ b/public/locales/gov/en/translation.json @@ -28,7 +28,8 @@ "builtBy": "https://open.gov.sg", "linkedin": "https://sg.linkedin.com/company/open-government-products", "facebook": "https://www.facebook.com/opengovsg", - "apiDoc": "https://guide.go.gov.sg/developer-guide/api-documentation" + "apiDoc": "https://guide.go.gov.sg/developer-guide/api-documentation", + "verifyMessages": "https://check.go.gov.sg" }, "builtBy": "Built by Open Government Products" }, diff --git a/src/client/app/components/BaseLayout/BaseLayoutHeader.tsx b/src/client/app/components/BaseLayout/BaseLayoutHeader.tsx index e7ef044fe..b39c7a9cf 100644 --- a/src/client/app/components/BaseLayout/BaseLayoutHeader.tsx +++ b/src/client/app/components/BaseLayout/BaseLayoutHeader.tsx @@ -27,6 +27,7 @@ import homeIcon from '@assets/components/app/base-layout/home-icon.svg' import Section from '../Section' import loginActions from '../../../login/actions' import { GoGovReduxState } from '../../reducers/types' +import assetVariant from '../../../../shared/util/asset-variant' type StyleProps = { isLoggedIn: boolean @@ -118,6 +119,21 @@ type BaseLayoutHeaderProps = { toStick: boolean } +type HeaderButtonProps = { + text: string + link: string + public: boolean + icon: string + mobileOrder?: number + internalLink?: boolean + displayNotEnabledForVariant?: string[] +} + +function isEnabledForAssetVariant(header: HeaderButtonProps) { + if (header.displayNotEnabledForVariant === undefined) return true + return !header.displayNotEnabledForVariant.includes(assetVariant) +} + const BaseLayoutHeader: FunctionComponent = ({ backgroundType, hideNavButtons = false, @@ -176,6 +192,14 @@ const BaseLayoutHeader: FunctionComponent = ({ public: true, icon: githubIcon, }, + { + text: 'Verify Messages', + link: i18next.t('general.links.verifyMessages'), + public: true, + icon: githubIcon, + mobileOrder: 6, + displayNotEnabledForVariant: ['edu', 'health'], + }, { text: 'Guide', link: i18next.t('general.links.faq'), @@ -273,6 +297,7 @@ const BaseLayoutHeader: FunctionComponent = ({ {!hideNavButtons && headers.map( (header) => + isEnabledForAssetVariant(header) && (header.public ? !isLoggedIn : isLoggedIn) && (