-
Notifications
You must be signed in to change notification settings - Fork 6
Feature 2284 review period employees #2358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
021682c
7ff9419
9bd1e6e
065a23c
19a5907
12a12b4
0c97e00
0dbb3d1
ac51898
9d3cc73
fee7fe3
788e140
2286478
8deb114
1935e66
9237929
4fd5cab
afa9131
144b3a2
3276e5b
e9245db
78bb14d
59732ac
0f35c61
e9cc1d6
c0f541e
338a5ad
2a6a03c
71d33cb
3467556
e0885a1
af5db91
ce81e72
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,30 +4,20 @@ import { | |
| Avatar, | ||
| Card, | ||
| CardHeader, | ||
| Collapse, | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lots of UI functionality was removed from this component per Michael. |
||
| Divider, | ||
| IconButton, | ||
| List, | ||
| ListItem, | ||
| ListItemAvatar, | ||
| ListItemIcon, | ||
| ListItemText, | ||
| Menu, | ||
| MenuItem, | ||
| Tooltip, | ||
| Typography | ||
| } from '@mui/material'; | ||
| import AddIcon from '@mui/icons-material/Add'; | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some of these icons are no longer used and access to the ones that are was simplified by using their given names. |
||
| import RemoveIcon from '@mui/icons-material/Remove'; | ||
| import HighlightOffIcon from '@mui/icons-material/HighlightOff'; | ||
| import MoreVertIcon from '@mui/icons-material/MoreVert'; | ||
| import { Add, FileDownload } from '@mui/icons-material'; | ||
| import { getAvatarURL } from '../../api/api'; | ||
|
|
||
| import ExpandMore from '../expand-more/ExpandMore.jsx'; | ||
| import MemberSelectorDialog, { | ||
| FilterType | ||
| } from './member_selector_dialog/MemberSelectorDialog'; | ||
| import DownloadIcon from '@mui/icons-material/FileDownload'; | ||
| import { reportSelectedMembersCsv } from '../../api/member.js'; | ||
| import { AppContext } from '../../context/AppContext.jsx'; | ||
| import { selectCsrfToken } from '../../context/selectors.js'; | ||
|
|
@@ -58,8 +48,6 @@ const propTypes = { | |
| outlined: PropTypes.bool, | ||
| /** If true, include a button to export the list of members to a CSV file. False by default. */ | ||
| exportable: PropTypes.bool, | ||
| /** Adjusts the height of the scrollable list of selected members (in pixels) */ | ||
| listHeight: PropTypes.number, | ||
| /** If true, members cannot be added to or removed from the current selection. False by default. */ | ||
| disabled: PropTypes.bool, | ||
| /** A custom class name to additionally apply to the top-level card */ | ||
|
|
@@ -76,7 +64,6 @@ const MemberSelector = ({ | |
| expand = true, | ||
| outlined = false, | ||
| exportable = false, | ||
| listHeight = 400, | ||
| disabled = false, | ||
| className, | ||
| style | ||
|
|
@@ -93,7 +80,7 @@ const MemberSelector = ({ | |
| filter => filter.type === FilterType.ROLE | ||
| ); | ||
| const roleFilter = filters.find(filter => filter.type === FilterType.ROLE); | ||
| const memberDescriptor = isFilteredByRole ? roleFilter.value : 'members'; | ||
| const memberDescriptor = isFilteredByRole ? roleFilter.value : 'Members'; | ||
|
|
||
| const handleExpandClick = () => setExpanded(!expanded); | ||
|
|
||
|
|
@@ -104,8 +91,8 @@ const MemberSelector = ({ | |
| } | ||
| }, [disabled]); | ||
|
|
||
| const addMembers = membersToAdd => { | ||
| onChange([...selected, ...membersToAdd]); | ||
| const replaceSelectedMembers = members => { | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We now replace the complete set of selected members rather than adding to it. |
||
| onChange(members); | ||
| setDialogOpen(false); | ||
| }; | ||
|
|
||
|
|
@@ -115,9 +102,7 @@ const MemberSelector = ({ | |
| }; | ||
|
|
||
| const downloadMemberCsv = useCallback(() => { | ||
| if (!exportable) { | ||
| return; | ||
| } | ||
| if (!exportable) return; | ||
|
|
||
| const memberIds = selected.map(member => member.id); | ||
| reportSelectedMembersCsv(memberIds, csrf).then(res => { | ||
|
|
@@ -152,14 +137,6 @@ const MemberSelector = ({ | |
| style={style} | ||
| > | ||
| <CardHeader | ||
| avatar={ | ||
| <ExpandMore | ||
| expand={expanded} | ||
| onClick={handleExpandClick} | ||
| aria-expanded={expanded} | ||
| aria-label="show more" | ||
| /> | ||
| } | ||
| title={ | ||
| <div className="member-selector-card-title-container"> | ||
| <Typography | ||
|
|
@@ -180,111 +157,37 @@ const MemberSelector = ({ | |
| } | ||
| action={ | ||
| <> | ||
| <Tooltip title={`Add ${memberDescriptor}`} arrow> | ||
| <Tooltip title={`Change ${memberDescriptor}`} arrow> | ||
| <IconButton | ||
| style={{ margin: '4px 8px 0 0' }} | ||
| onClick={() => setDialogOpen(true)} | ||
| disabled={disabled} | ||
| > | ||
| <AddIcon /> | ||
| <Add /> | ||
| </IconButton> | ||
| </Tooltip> | ||
| <IconButton | ||
| style={{ margin: '4px 8px 0 0' }} | ||
| onClick={event => setMenuAnchor(event.currentTarget)} | ||
| > | ||
| <MoreVertIcon /> | ||
| </IconButton> | ||
| <Menu | ||
| anchorEl={menuAnchor} | ||
| open={!!menuAnchor} | ||
| onClose={() => setMenuAnchor(null)} | ||
| > | ||
| <MenuItem | ||
| onClick={() => { | ||
| setMenuAnchor(null); | ||
| clearMembers(); | ||
| }} | ||
| disabled={disabled || !selected.length} | ||
| > | ||
| <ListItemIcon> | ||
| <HighlightOffIcon fontSize="small" /> | ||
| </ListItemIcon> | ||
| <ListItemText>Remove all</ListItemText> | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Members can now only be removed in MemberSelectorDialog. |
||
| </MenuItem> | ||
| {exportable && ( | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The button to download a member list as a CSV file was moved to be on the |
||
| <MenuItem | ||
| onClick={() => { | ||
| setMenuAnchor(null); | ||
| downloadMemberCsv(); | ||
| }} | ||
| disabled={!selected.length} | ||
| {exportable && ( | ||
| <Tooltip title="Download"> | ||
| <IconButton | ||
| onClick={downloadMemberCsv} | ||
| edge="end" | ||
| aria-label="Download" | ||
| > | ||
| <ListItemIcon> | ||
| <DownloadIcon fontSize="small" /> | ||
| </ListItemIcon> | ||
| <ListItemText>Download</ListItemText> | ||
| </MenuItem> | ||
| )} | ||
| </Menu> | ||
| <FileDownload /> | ||
| </IconButton> | ||
| </Tooltip> | ||
| )} | ||
| </> | ||
| } | ||
| /> | ||
| <Collapse in={expanded}> | ||
| <Divider /> | ||
| <List | ||
| dense | ||
| role="list" | ||
| sx={{ maxHeight: listHeight, overflow: 'auto' }} | ||
| > | ||
| {selected.length ? ( | ||
| selected.map(member => ( | ||
| <ListItem | ||
| key={member.id} | ||
| role="listitem" | ||
| secondaryAction={ | ||
| <Tooltip title="Deselect member" arrow> | ||
| <IconButton | ||
| onClick={() => removeMember(member)} | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Members can now only be removed in MemberSelectorDialog. |
||
| disabled={disabled} | ||
| > | ||
| <RemoveIcon /> | ||
| </IconButton> | ||
| </Tooltip> | ||
| } | ||
| > | ||
| <ListItemAvatar> | ||
| <Avatar src={getAvatarURL(member.workEmail)} /> | ||
| </ListItemAvatar> | ||
| <ListItemText | ||
| primary={ | ||
| <Typography fontWeight="bold">{member.name}</Typography> | ||
| } | ||
| secondary={ | ||
| <Typography color="textSecondary" component="h6"> | ||
| {member.title} | ||
| </Typography> | ||
| } | ||
| /> | ||
| </ListItem> | ||
| )) | ||
| ) : ( | ||
| <ListItem> | ||
| <ListItemText style={{ color: 'gray' }}> | ||
| No {memberDescriptor} selected | ||
| </ListItemText> | ||
| </ListItem> | ||
| )} | ||
| </List> | ||
| </Collapse> | ||
| </Card> | ||
| <MemberSelectorDialog | ||
| open={dialogOpen} | ||
| initialFilters={filters} | ||
| memberDescriptor={memberDescriptor} | ||
| selectedMembers={selected} | ||
| onClose={() => setDialogOpen(false)} | ||
| onSubmit={membersToAdd => addMembers(membersToAdd)} | ||
| onSubmit={replaceSelectedMembers} | ||
| /> | ||
| </> | ||
| ); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,7 +46,6 @@ describe('MemberSelector', () => { | |
| title="Custom Title" | ||
| outlined | ||
| exportable | ||
| listHeight={300} | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This prop was removed since we no longer display a list of the selected members in this component. |
||
| className="test-class" | ||
| style={{ margin: '10px' }} | ||
| /> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adjusted some font sizes to improve UI.