managed-user-status.tsx 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import { useTranslation } from 'react-i18next'
  2. import { User } from '../../../../../../types/group-management/user'
  3. import MaterialIcon from '../../../../shared/components/material-icon'
  4. type ManagedUserStatusProps = {
  5. user: User
  6. }
  7. export default function ManagedUserStatus({ user }: ManagedUserStatusProps) {
  8. const { t } = useTranslation()
  9. return (
  10. <span>
  11. {user.isEntityAdmin ? (
  12. <>
  13. <span className="security-state-group-admin" />
  14. </>
  15. ) : (
  16. <>
  17. {user.invite ? (
  18. <span className="security-state-invite-pending">
  19. <MaterialIcon
  20. type="schedule"
  21. category="outlined"
  22. accessibilityLabel={t('pending_invite')}
  23. />
  24. &nbsp;
  25. {t('managed')}
  26. </span>
  27. ) : (
  28. <>
  29. {user.enrollment?.managedBy ? (
  30. <span className="security-state-managed">
  31. <MaterialIcon
  32. type="check"
  33. accessibilityLabel={t('managed')}
  34. />
  35. &nbsp;
  36. {t('managed')}
  37. </span>
  38. ) : (
  39. <span className="security-state-not-managed">
  40. <MaterialIcon
  41. type="close"
  42. accessibilityLabel={t('not_managed')}
  43. />
  44. &nbsp;
  45. {t('managed')}
  46. </span>
  47. )}
  48. </>
  49. )}
  50. </>
  51. )}
  52. </span>
  53. )
  54. }