overleaf/services/web/frontend/js/features/group-management/components/managed-users/sso-status.tsx
Davinder Singh 06979babdb Group SSO - cleaning ternary operators in status files (#15365)
GitOrigin-RevId: 615f95aca66b0c80e54a057cabd61c74b8c3f12d
2023-10-26 08:03:24 +00:00

38 lines
1 KiB
TypeScript

import { useTranslation } from 'react-i18next'
import { User } from '../../../../../../types/group-management/user'
import MaterialIcon from '@/shared/components/material-icon'
type SSOStatusProps = {
user: User
}
export default function SSOStatus({ user }: SSOStatusProps) {
const { t } = useTranslation()
const invitedSSO = (
<span className="security-state-invite-pending">
<MaterialIcon
type="schedule"
category="outlined"
accessibilityLabel={t('pending_invite')}
/>
&nbsp; {t('sso')}
</span>
)
const acceptedSSO = (
<span className="security-state-managed">
<MaterialIcon type="check" accessibilityLabel={t('sso_linked')} />
&nbsp; {t('sso')}
</span>
)
const notAcceptedSSO = (
<span className="security-state-not-managed">
<MaterialIcon type="close" accessibilityLabel={t('sso_unlinked')} />
&nbsp; {t('sso')}
</span>
)
if (user.invite) {
return invitedSSO
}
return user.enrollment?.sso ? acceptedSSO : notAcceptedSSO
}