-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adds flex groups dropdown menu in assignment modal (#1335)
* feat: adds group selection to assignment modal
- Loading branch information
1 parent
4f9d197
commit 4e72019
Showing
16 changed files
with
620 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
src/components/learner-credit-management/assignment-modal/AssignmentModalFlexGroup.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import React from 'react'; | ||
import { | ||
Form, MenuItem, Dropdown, Button, | ||
} from '@openedx/paragon'; | ||
import { FormattedMessage } from '@edx/frontend-platform/i18n'; | ||
import PropTypes from 'prop-types'; | ||
|
||
const AssignmentModalFlexGroup = ({ | ||
enterpriseFlexGroups, | ||
onCheckedGroupsChanged, | ||
checkedGroups, | ||
onHandleSubmitGroup, | ||
dropdownToggleLabel, | ||
dropdownRef, | ||
}) => { | ||
const renderFlexGroupSelection = enterpriseFlexGroups.map(flexGroup => ( | ||
<MenuItem | ||
as={Form.Checkbox} | ||
className="group-dropdown mt-2 mb-2" | ||
key={flexGroup.uuid} | ||
onChange={onCheckedGroupsChanged} | ||
checked={checkedGroups[flexGroup.uuid]?.checked} | ||
value={flexGroup.name} | ||
id={flexGroup.uuid} | ||
> | ||
{flexGroup.name} ({flexGroup.acceptedMembersCount}) | ||
</MenuItem> | ||
)); | ||
|
||
return ( | ||
<Form.Group className="group-dropdown mb-4.5 pr-1.5"> | ||
<Dropdown ref={dropdownRef} autoClose="outside" className="group-dropdown"> | ||
Groups | ||
<Dropdown.Toggle variant="outline-primary" id="group-select-toggle" className="group-dropdown mt-2"> | ||
{dropdownToggleLabel} | ||
</Dropdown.Toggle> | ||
<Dropdown.Menu className="pl-3 pr-3 group-dropdown"> | ||
{renderFlexGroupSelection} | ||
<Button className="mt-3 justify-content-center" block onClick={onHandleSubmitGroup}>Apply selections</Button> | ||
</Dropdown.Menu> | ||
</Dropdown> | ||
<Form.Control.Feedback> | ||
<FormattedMessage | ||
id="lcm.budget.detail.page.catalog.tab.assign.course.section.assign.to.flex.group.help.text" | ||
defaultMessage="Select one or more group to add its members to the assignment." | ||
description="Help text for the flex group drop down menu to add learners from selected group." | ||
/> | ||
</Form.Control.Feedback> | ||
</Form.Group> | ||
); | ||
}; | ||
|
||
AssignmentModalFlexGroup.propTypes = { | ||
checkedGroups: PropTypes.shape({ | ||
id: PropTypes.string, | ||
memberEmails: PropTypes.arrayOf(PropTypes.string), | ||
name: PropTypes.string, | ||
checked: PropTypes.bool, | ||
}).isRequired, | ||
onHandleSubmitGroup: PropTypes.func.isRequired, | ||
onCheckedGroupsChanged: PropTypes.func.isRequired, | ||
enterpriseFlexGroups: PropTypes.arrayOf(PropTypes.shape({ | ||
name: PropTypes.string, | ||
uuid: PropTypes.string, | ||
acceptedMembersCount: PropTypes.number, | ||
})), | ||
dropdownToggleLabel: PropTypes.string.isRequired, | ||
dropdownRef: PropTypes.oneOfType([ | ||
PropTypes.func, | ||
PropTypes.shape({ current: PropTypes.instanceOf(Element) }), | ||
]), | ||
}; | ||
|
||
export default AssignmentModalFlexGroup; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.