overleaf/services/web/frontend/js/features/group-management/components/managed-users/managed-user-status.tsx
Alexandre Bourdin 0c5ba1e96e Merge pull request #14491 from overleaf/ab-update-managed-users-icons
[web] Update managed users icons and improve display on smaller screen sizes

GitOrigin-RevId: 7b6263ea9afa9bb52bed3a3f50cbe361e7064085
2023-08-28 08:04:02 +00:00

55 lines
1.5 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()
return (
<span>
{user.isEntityAdmin ? (
<>
<span className="security-state-group-admin" />
</>
) : (
<>
{user.invite ? (
<span className="security-state-invite-pending">
<MaterialIcon
type="schedule"
category="outlined"
accessibilityLabel={t('pending_invite')}
/>
&nbsp;
{t('managed')}
</span>
) : (
<>
{user.enrollment?.managedBy ? (
<span className="security-state-managed">
<MaterialIcon
type="check"
accessibilityLabel={t('managed')}
/>
&nbsp;
{t('managed')}
</span>
) : (
<span className="security-state-not-managed">
<MaterialIcon
type="close"
accessibilityLabel={t('not_managed')}
/>
&nbsp;
{t('managed')}
</span>
)}
</>
)}
</>
)}
</span>
)
}