2023-06-30 04:30:20 -04:00
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
import { User } from '../../../../../../types/group-management/user'
|
2023-08-25 04:51:45 -04:00
|
|
|
import MaterialIcon from '../../../../shared/components/material-icon'
|
2023-06-30 04:30:20 -04:00
|
|
|
|
|
|
|
type ManagedUserStatusProps = {
|
|
|
|
user: User
|
|
|
|
}
|
|
|
|
export default function ManagedUserStatus({ user }: ManagedUserStatusProps) {
|
|
|
|
const { t } = useTranslation()
|
2023-10-25 07:10:25 -04:00
|
|
|
const managedUserInvite = (
|
|
|
|
<span className="security-state-invite-pending">
|
|
|
|
<MaterialIcon
|
|
|
|
type="schedule"
|
|
|
|
category="outlined"
|
|
|
|
accessibilityLabel={t('pending_invite')}
|
|
|
|
/>
|
|
|
|
|
|
|
|
{t('managed')}
|
2023-06-30 04:30:20 -04:00
|
|
|
</span>
|
|
|
|
)
|
2023-10-25 07:10:25 -04:00
|
|
|
|
|
|
|
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
|
2023-06-30 04:30:20 -04:00
|
|
|
}
|