mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-11 21:02:22 -05:00
e60885aa88
Move CSS loading in Cypress to individual test spec files GitOrigin-RevId: 92bb5167cfa81b0bd54acc724efb23b397421ccb
58 lines
1.7 KiB
TypeScript
58 lines
1.7 KiB
TypeScript
import { useTranslation } from 'react-i18next'
|
|
import { UserEmailData } from '../../../../../../types/user-email'
|
|
import ResendConfirmationEmailButton from './resend-confirmation-email-button'
|
|
import { ssoAvailableForInstitution } from '../../utils/sso'
|
|
import OLBadge from '@/features/ui/components/ol/ol-badge'
|
|
import { isBootstrap5 } from '@/features/utils/bootstrap-5'
|
|
import classnames from 'classnames'
|
|
|
|
type EmailProps = {
|
|
userEmailData: UserEmailData
|
|
}
|
|
|
|
function Email({ userEmailData }: EmailProps) {
|
|
const { t } = useTranslation()
|
|
|
|
const ssoAvailable = ssoAvailableForInstitution(
|
|
userEmailData.affiliation?.institution || null
|
|
)
|
|
|
|
const isPrimary = userEmailData.default
|
|
const isProfessional =
|
|
userEmailData.confirmedAt &&
|
|
userEmailData.affiliation?.institution.confirmed &&
|
|
userEmailData.affiliation.licence !== 'free'
|
|
const hasBadges = isPrimary || isProfessional
|
|
|
|
return (
|
|
<>
|
|
{userEmailData.email}
|
|
{!userEmailData.confirmedAt && (
|
|
<div className="small">
|
|
<strong>
|
|
{t('unconfirmed')}.
|
|
{!ssoAvailable && <span> {t('please_check_your_inbox')}.</span>}
|
|
</strong>
|
|
<br />
|
|
{!ssoAvailable && (
|
|
<ResendConfirmationEmailButton email={userEmailData.email} />
|
|
)}
|
|
</div>
|
|
)}
|
|
{hasBadges && (
|
|
<div className={classnames({ small: !isBootstrap5() })}>
|
|
{isPrimary && (
|
|
<>
|
|
<OLBadge bg="info">Primary</OLBadge>{' '}
|
|
</>
|
|
)}
|
|
{isProfessional && (
|
|
<OLBadge bg="primary">{t('professional')}</OLBadge>
|
|
)}
|
|
</div>
|
|
)}
|
|
</>
|
|
)
|
|
}
|
|
|
|
export default Email
|