All files / src/pages expectations.tsx

55.55% Statements 5/9
0% Branches 0/2
33.33% Functions 1/3
62.5% Lines 5/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137                                1x 3x   3x                 2x                                                                                                                                                                                                   1x                    
import { MouseEventHandler, useCallback } from 'react'
 
import { setCookie } from 'cookies-next'
import { GetServerSideProps } from 'next'
import { Trans, useTranslation } from 'next-i18next'
import { NextSeo } from 'next-seo'
import Router from 'next/router'
 
import ActionButton from '../components/ActionButton'
import AlertBlock from '../components/AlertBlock'
import AlertSection from '../components/AlertSection'
import ExternalLink from '../components/ExternalLink'
import Layout from '../components/Layout'
import { pageWithServerSideTranslations } from '../lib/utils/next-i18next-utils'
import { getDCTermsTitle } from '../lib/utils/seo-utils'
 
const Expectations = () => {
  const { t } = useTranslation(['expectations', 'common'])
 
  const handleOnAgreeClick: MouseEventHandler<HTMLButtonElement> = useCallback(
    (e) => {
      e.preventDefault()
      setCookie('agreed-to-email-esrf-terms', 'true', { sameSite: true })
      Router.push('/landing')
    },
    [],
  )
 
  return (
    <>
      <NextSeo
        description={t('meta.description')}
        additionalMetaTags={[getDCTermsTitle(t('header'))]}
      />
      <Layout>
        <h1 className="h1">{t('header')}</h1>
        <AlertBlock page="expectations" />
        <h2 className="h2">{t('header-avoid-waiting')}</h2>
        <p>{t('available-after.description')}</p>
        <ul className="mb-5 list-disc space-y-2 pl-10">
          <li>{t('available-after.list.item-1')}</li>
          <li>{t('available-after.list.item-2')}</li>
        </ul>
        <p>
          <strong>{t('available-after.updated-status')}</strong>
        </p>
        <h2 className="h2">{t('header-who-can-check')}</h2>
        <p>
          <Trans i18nKey={'can-check.description'} ns="expectations" />
        </p>
        <ul className="mb-5 list-disc space-y-2 pl-10">
          <li>{t('can-check.list.item-1')}</li>
          <li>{t('can-check.list.item-2')}</li>
        </ul>
        <p>
          <Trans i18nKey={'cannot-check.description'} ns="expectations" />
        </p>
        <ul className="mb-5 list-disc space-y-2 pl-10">
          <li>
            <Trans i18nKey={'cannot-check.list.item-1'} ns="expectations" />
          </li>
          <li>{t('cannot-check.list.item-2')}</li>
        </ul>
        <h2 className="h2">{t('additional-info.header')}</h2>
        <p>{t('additional-info.documents-separately')}</p>
        <p>
          <Trans
            i18nKey="additional-info.contact-us"
            ns="expectations"
            components={{
              Link: <ExternalLink href={t('common:contact-us-link')} />,
            }}
          />
        </p>
        <AlertSection className="mt-8" type="warning">
          <p className="mb-4">
            <strong>{t('do-not-travel')}</strong>
          </p>
          <p>{t('not-liable')}</p>
        </AlertSection>
        <h2 className="h2">{t('header-privacy')}</h2>
        <p>
          <Trans i18nKey={'description-privacy.1'} ns="expectations" />
        </p>
        <p>{t('description-privacy.2')}</p>
        <p>{t('description-privacy.3')}</p>
        <p>
          <Trans
            i18nKey={'description-privacy.4'}
            ns="expectations"
            components={{
              Link: <ExternalLink href={t('description-privacy.4-link')} />,
            }}
          />
        </p>
        <p>
          <Trans
            i18nKey={'description-privacy.5'}
            ns="expectations"
            components={{
              Link: <ExternalLink href={t('description-privacy.5-link')} />,
            }}
          />
        </p>
        <p>
          <Trans
            i18nKey={'description-privacy.6'}
            ns="expectations"
            components={{
              Link: <ExternalLink href={t('description-privacy.6-link')} />,
            }}
          />
        </p>
        <div className="mt-8">
          <ActionButton
            id="btn-agree"
            style="primary"
            text={t('button-agree')}
            onClick={handleOnAgreeClick}
          />
        </div>
      </Layout>
    </>
  )
}
 
export const getServerSideProps: GetServerSideProps = async ({ locale }) => ({
  props: {
    ...(await pageWithServerSideTranslations(
      locale ?? 'default',
      'expectations',
    )),
  },
})
 
export default Expectations