2022-05-16 04:03:42 -04:00
|
|
|
import { Alert } from 'react-bootstrap'
|
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
import usePersistedState from '../../../shared/hooks/use-persisted-state'
|
2022-05-24 03:47:08 -04:00
|
|
|
import { useUserEmailsContext } from '../context/user-email-context'
|
2022-05-16 04:03:42 -04:00
|
|
|
|
|
|
|
export function LeaversSurveyAlert() {
|
|
|
|
const { t } = useTranslation()
|
|
|
|
|
2022-05-24 03:47:08 -04:00
|
|
|
const {
|
|
|
|
showInstitutionalLeaversSurveyUntil,
|
|
|
|
setShowInstitutionalLeaversSurveyUntil,
|
|
|
|
} = useUserEmailsContext()
|
2022-05-18 09:45:31 -04:00
|
|
|
|
|
|
|
const [hide, setHide] = usePersistedState(
|
|
|
|
'hideInstitutionalLeaversSurvey',
|
|
|
|
false,
|
|
|
|
true
|
|
|
|
)
|
|
|
|
|
2022-05-16 04:03:42 -04:00
|
|
|
function handleDismiss() {
|
2022-05-24 03:47:08 -04:00
|
|
|
setShowInstitutionalLeaversSurveyUntil(0)
|
2022-05-18 09:45:31 -04:00
|
|
|
setHide(true)
|
2022-05-16 04:03:42 -04:00
|
|
|
}
|
|
|
|
|
2022-05-24 03:47:08 -04:00
|
|
|
if (Date.now() > showInstitutionalLeaversSurveyUntil) {
|
2022-05-16 04:03:42 -04:00
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
2022-05-18 09:45:31 -04:00
|
|
|
if (hide) {
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
2022-05-16 04:03:42 -04:00
|
|
|
return (
|
|
|
|
<Alert className="mb-0" bsStyle="info" onDismiss={handleDismiss}>
|
|
|
|
<p>
|
|
|
|
<strong>{t('limited_offer')}</strong>
|
|
|
|
{`: ${t('institutional_leavers_survey_notification')} `}
|
|
|
|
<a
|
|
|
|
href="https://docs.google.com/forms/d/e/1FAIpQLSfYdeeoY5p1d31r5iUx1jw0O-Gd66vcsBi_Ntu3lJRMjV2EJA/viewform"
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
>
|
|
|
|
{t('take_short_survey')}
|
|
|
|
</a>
|
|
|
|
</p>
|
|
|
|
</Alert>
|
|
|
|
)
|
|
|
|
}
|