@@ -22,35 +22,55 @@ import UserTableAvatarInfo from './UserTableAvatarInfo';
22
22
interface ActionButtonsProps {
23
23
tableMeta : MUIDataTableMeta ;
24
24
isRemoveFromTeamAllowed : boolean ;
25
+ isEditUserAllowed : boolean ;
25
26
handleRemoveFromTeam : ( data : any [ ] ) => ( ) => void ;
27
+ handleEditUser : ( data : any [ ] ) => ( ) => void ;
26
28
theme ?: Theme ;
27
29
}
28
30
29
31
const ActionButtons : React . FC < ActionButtonsProps > = ( {
30
32
tableMeta,
31
33
handleRemoveFromTeam,
34
+ handleEditUser,
32
35
isRemoveFromTeamAllowed,
36
+ isEditUserAllowed,
33
37
theme
34
38
} ) => {
35
39
return (
36
- < div >
40
+ < TableIconsContainer >
41
+ { isEditUserAllowed ? (
42
+ < TooltipIcon
43
+ id = { `edit_user-${ tableMeta . rowIndex } ` }
44
+ onClick = { handleEditUser ( tableMeta . rowData ) }
45
+ title = "Edit user"
46
+ iconType = "edit"
47
+ >
48
+ < EditIcon fill = { theme ?. palette . text . primary } />
49
+ </ TooltipIcon >
50
+ ) : (
51
+ < EditIcon
52
+ style = { {
53
+ marginRight : '.5rem'
54
+ } }
55
+ fill = { CHARCOAL }
56
+ height = "30"
57
+ width = "30"
58
+ />
59
+ ) }
60
+
37
61
{ isRemoveFromTeamAllowed ? (
38
- < TableIconsContainer >
39
- < TooltipIcon
40
- id = { `delete_user-${ tableMeta . rowIndex } ` }
41
- onClick = { handleRemoveFromTeam ( tableMeta . rowData ) }
42
- title = "Remove user membership from team"
43
- iconType = "delete"
44
- >
45
- < LogoutIcon fill = { theme ?. palette . icon . default } />
46
- </ TooltipIcon >
47
- </ TableIconsContainer >
62
+ < TooltipIcon
63
+ id = { `delete_user-${ tableMeta . rowIndex } ` }
64
+ onClick = { handleRemoveFromTeam ( tableMeta . rowData ) }
65
+ title = "Remove user membership from team"
66
+ iconType = "delete"
67
+ >
68
+ < LogoutIcon fill = { theme ?. palette . text . primary } />
69
+ </ TooltipIcon >
48
70
) : (
49
- < TableIconsDisabledContainer >
50
- < LogoutIcon fill = { theme ?. palette . icon . disabled } secondaryFill = { CHARCOAL } />
51
- </ TableIconsDisabledContainer >
71
+ < LogoutIcon fill = { CHARCOAL } secondaryFill = { CHARCOAL } />
52
72
) }
53
- </ div >
73
+ </ TableIconsContainer >
54
74
) ;
55
75
} ;
56
76
@@ -61,6 +81,8 @@ interface UsersTableProps {
61
81
useRemoveUserFromTeamMutation : any ;
62
82
useNotificationHandlers : any ;
63
83
isRemoveFromTeamAllowed : boolean ;
84
+ isEditUserAllowed : boolean ;
85
+ handleEditUser : ( data : any [ ] ) => ( ) => void ;
64
86
theme ?: Theme ;
65
87
}
66
88
@@ -71,6 +93,8 @@ const UsersTable: React.FC<UsersTableProps> = ({
71
93
useRemoveUserFromTeamMutation,
72
94
useNotificationHandlers,
73
95
isRemoveFromTeamAllowed,
96
+ isEditUserAllowed,
97
+ handleEditUser,
74
98
theme
75
99
} ) => {
76
100
const [ page , setPage ] = useState < number > ( 0 ) ;
@@ -412,7 +436,9 @@ const UsersTable: React.FC<UsersTableProps> = ({
412
436
< ActionButtons
413
437
tableMeta = { tableMeta }
414
438
handleRemoveFromTeam = { handleRemoveFromTeam }
439
+ handleEditUser = { handleEditUser }
415
440
isRemoveFromTeamAllowed = { isRemoveFromTeamAllowed }
441
+ isEditUserAllowed = { isEditUserAllowed }
416
442
theme = { theme }
417
443
/>
418
444
)
0 commit comments