mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-12 15:53:37 -05:00
c4bea21ee2
[web] Fix SSO status in group members table GitOrigin-RevId: e54e7b0c9640f0b96d9692c0208357e3bac2de91
54 lines
1.3 KiB
TypeScript
54 lines
1.3 KiB
TypeScript
import { useTranslation } from 'react-i18next'
|
|
import getMeta from '@/utils/meta'
|
|
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 groupId = getMeta('ol-groupId')
|
|
|
|
if (user.invite) {
|
|
return <PendingInvite />
|
|
}
|
|
|
|
const linkedSSO = user.enrollment?.sso?.some(sso => sso.groupId === groupId)
|
|
|
|
return linkedSSO ? <SSOLinked /> : <SSOUnlinked />
|
|
}
|
|
|
|
function PendingInvite() {
|
|
const { t } = useTranslation()
|
|
return (
|
|
<span className="security-state-invite-pending">
|
|
<MaterialIcon
|
|
type="schedule"
|
|
category="outlined"
|
|
accessibilityLabel={t('pending_invite')}
|
|
/>
|
|
{t('sso')}
|
|
</span>
|
|
)
|
|
}
|
|
|
|
function SSOLinked() {
|
|
const { t } = useTranslation()
|
|
return (
|
|
<span className="security-state-managed">
|
|
<MaterialIcon type="check" accessibilityLabel={t('sso_active')} />
|
|
{t('sso')}
|
|
</span>
|
|
)
|
|
}
|
|
|
|
function SSOUnlinked() {
|
|
const { t } = useTranslation()
|
|
return (
|
|
<span className="security-state-not-managed">
|
|
<MaterialIcon type="close" accessibilityLabel={t('sso_not_active')} />
|
|
{t('sso')}
|
|
</span>
|
|
)
|
|
}
|