mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-12 06:11:35 -05:00
06979babdb
GitOrigin-RevId: 615f95aca66b0c80e54a057cabd61c74b8c3f12d
46 lines
1.2 KiB
TypeScript
46 lines
1.2 KiB
TypeScript
import { useTranslation } from 'react-i18next'
|
|
import { User } from '../../../../../../types/group-management/user'
|
|
import MaterialIcon from '../../../../shared/components/material-icon'
|
|
|
|
type ManagedUserStatusProps = {
|
|
user: User
|
|
}
|
|
export default function ManagedUserStatus({ user }: ManagedUserStatusProps) {
|
|
const { t } = useTranslation()
|
|
const managedUserInvite = (
|
|
<span className="security-state-invite-pending">
|
|
<MaterialIcon
|
|
type="schedule"
|
|
category="outlined"
|
|
accessibilityLabel={t('pending_invite')}
|
|
/>
|
|
|
|
{t('managed')}
|
|
</span>
|
|
)
|
|
|
|
const managedUserAccepted = (
|
|
<span className="security-state-managed">
|
|
<MaterialIcon type="check" accessibilityLabel={t('managed')} />
|
|
|
|
{t('managed')}
|
|
</span>
|
|
)
|
|
const managedUserNotAccepted = (
|
|
<span className="security-state-not-managed">
|
|
<MaterialIcon type="close" accessibilityLabel={t('not_managed')} />
|
|
|
|
{t('managed')}
|
|
</span>
|
|
)
|
|
|
|
if (user.isEntityAdmin) {
|
|
return <span className="security-state-group-admin" />
|
|
}
|
|
if (user.invite) {
|
|
return managedUserInvite
|
|
}
|
|
return user.enrollment?.managedBy
|
|
? managedUserAccepted
|
|
: managedUserNotAccepted
|
|
}
|