Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: replace outdated esrv id link #7438

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { Text } from '@chakra-ui/react'

import { SINGPASS_PARTNER_SUPPORT_LINK } from '~shared/constants/links'
import { FormAuthType } from '~shared/types/form'

import Link from '~components/Link'

interface EsrvcHelperTextProps {
authType: FormAuthType
}

export const EsrvcHelperText = ({
authType,
}: EsrvcHelperTextProps): JSX.Element => {
switch (authType) {
case FormAuthType.SP:
case FormAuthType.CP:
case FormAuthType.MyInfo:
return (
<Text textStyle="body-2" color="secondary.400">
Contact{' '}
<Link isExternal href={SINGPASS_PARTNER_SUPPORT_LINK}>
Singpass partner support
</Link>{' '}
for your e-Service ID
</Text>
)
default:
return <></>
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
InputGroup,
InputRightElement,
Stack,
Text,
VisuallyHidden,
} from '@chakra-ui/react'

Expand All @@ -19,6 +18,8 @@ import Spinner from '~components/Spinner'

import { useMutateFormSettings } from '../../mutations'

import { EsrvcHelperText } from './EsrvcHelperText'

interface EsrvcIdBoxProps {
settings: FormSettings
isDisabled: boolean
Expand Down Expand Up @@ -60,17 +61,6 @@ export const EsrvcIdBox = ({
return errors.esrvcId ? reset() : onSubmit()
}, [errors, onSubmit, reset])

const renderedHelperText = useMemo(() => {
switch (settings.authType) {
case FormAuthType.SP:
case FormAuthType.CP:
case FormAuthType.MyInfo:
return 'Contact [email protected] for your e-service ID'
default:
return ''
}
}, [settings.authType])

const placeHolder = useMemo(
() =>
`Enter ${
Expand All @@ -81,9 +71,7 @@ export const EsrvcIdBox = ({
return (
<form onSubmit={onSubmit} onBlur={handleBlur}>
<Stack ml="2.75rem" mb="1.25rem">
<Text textStyle="body-2" color="secondary.400">
{renderedHelperText}
</Text>
<EsrvcHelperText authType={settings.authType} />
<VisuallyHidden>
<FormLabel htmlFor="esrvcId">e-service ID:</FormLabel>
</VisuallyHidden>
Expand Down
2 changes: 2 additions & 0 deletions shared/constants/links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ export const SUPPORT_FORM_LINK = 'https://go.gov.sg/formsg-support'
export const PUBLIC_PAYMENTS_GUIDE_LINK =
'https://go.gov.sg/formsg-guide-payments'

export const SINGPASS_PARTNER_SUPPORT_LINK =
'https://go.gov.sg/formsg-singpass-contact'
export const SGID_VALID_ORG_PAGE =
'https://docs.id.gov.sg/faq-users#as-a-government-officer-why-am-i-not-able-to-login-to-my-work-tool-using-sgid'
Loading