diff --git a/src/components/Users.tsx b/src/components/Users.tsx index e12a4e2cb..269bea01f 100644 --- a/src/components/Users.tsx +++ b/src/components/Users.tsx @@ -6,6 +6,7 @@ import { Box, Button, Checkbox, Tooltip } from '@mui/material' import ContentCopyIcon from '@mui/icons-material/ContentCopy' import DoneIcon from '@mui/icons-material/Done' import useSettings from 'hooks/useSettings' +import { isEqual } from 'lodash' import ListTable from './ListTable' import RLink from './Link' import { HeadCell } from './EnhancedTable' @@ -93,9 +94,9 @@ function UserTeamSelector({ ) } -const updateUsers = (onClick: () => void) => { +const updateUsers = (onClick: () => void, disabled: boolean) => { return ( - ) @@ -134,24 +135,17 @@ export default function ({ users: inUsers, teamId }: Props): React.ReactElement }, ] : [] - const assignToTeam = - isTeamView && oboTeamId !== 'admin' - ? [ - { - id: 'assign', - label: t(`Assign to team ${oboTeamId}`), - renderer: (row: Row) => ( - - ), - }, - ] - : [] + const assignToTeam = isTeamView + ? [ + { + id: 'assign', + label: t(`Assign to team ${oboTeamId}`), + renderer: (row: Row) => ( + + ), + }, + ] + : [] const headCells: HeadCell[] = [ { id: 'email', @@ -180,7 +174,7 @@ export default function ({ users: inUsers, teamId }: Props): React.ReactElement resourceType='User' title='Users' noCrud={isTeamView} - customButton={isTeamView && updateUsers(handleUpdateUsers)} + customButton={isTeamView && updateUsers(handleUpdateUsers, isEqual(users, inUsers))} /> ) }