-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
849 additions
and
331 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Button } from '@openedx/paragon'; | ||
import { Add } from '@openedx/paragon/icons'; | ||
import PropTypes from 'prop-types'; | ||
|
||
const AddMemberTableAction = ({ openModal }) => ( | ||
<Button iconBefore={Add} onClick={openModal} variant="outline-primary">Add members</Button> | ||
); | ||
|
||
AddMemberTableAction.propTypes = { | ||
openModal: PropTypes.func.isRequired, | ||
}; | ||
|
||
export default AddMemberTableAction; |
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,70 @@ | ||
import PropTypes from 'prop-types'; | ||
import { StatefulButton } from '@openedx/paragon'; | ||
import { useIntl } from '@edx/frontend-platform/i18n'; | ||
import { useGetAllEnterpriseLearnerEmails } from './data/hooks/useEnterpriseLearnersTableData'; | ||
import { getSelectedEmailsByRow } from './utils'; | ||
|
||
const AddMembersBulkAction = ({ | ||
isEntireTableSelected, | ||
selectedFlatRows, | ||
onHandleAddMembersBulkAction, | ||
enterpriseId, | ||
enterpriseGroupLearners, | ||
}) => { | ||
const intl = useIntl(); | ||
const { fetchLearnerEmails, addButtonState } = useGetAllEnterpriseLearnerEmails({ | ||
enterpriseId, | ||
isEntireTableSelected, | ||
onHandleAddMembersBulkAction, | ||
enterpriseGroupLearners, | ||
}); | ||
const handleOnClick = () => { | ||
if (isEntireTableSelected) { | ||
fetchLearnerEmails(); | ||
return; | ||
} | ||
const addedMemberEmails = enterpriseGroupLearners.map(learner => learner.memberDetails.userEmail); | ||
const emails = getSelectedEmailsByRow(selectedFlatRows).filter(email => !addedMemberEmails.includes(email)); | ||
onHandleAddMembersBulkAction(emails); | ||
}; | ||
|
||
return ( | ||
<StatefulButton | ||
labels={{ | ||
default: intl.formatMessage({ | ||
id: 'people.management.add.new.group.modal.button', | ||
defaultMessage: 'Add', | ||
description: 'Button state text for adding members from datatable', | ||
}), | ||
pending: intl.formatMessage({ | ||
id: 'people.management.add.new.group.modal.pending', | ||
defaultMessage: 'Adding...', | ||
description: 'Button state text for adding members from datatable', | ||
}), | ||
complete: intl.formatMessage({ | ||
id: 'people.management.add.new.group.modal.complete', | ||
defaultMessage: 'Add', | ||
description: 'Button state text for adding members from datatable', | ||
}), | ||
error: intl.formatMessage({ | ||
id: 'people.management.add.new.group.modal.try.again', | ||
defaultMessage: 'Try again', | ||
description: 'Button state text for trying to add members again', | ||
}), | ||
}} | ||
state={addButtonState} | ||
onClick={handleOnClick} | ||
disabledStates={['pending']} | ||
/> | ||
); | ||
}; | ||
|
||
AddMembersBulkAction.propTypes = { | ||
selectedFlatRows: PropTypes.arrayOf(PropTypes.shape()).isRequired, | ||
enterpriseId: PropTypes.string.isRequired, | ||
onHandleAddMembersBulkAction: PropTypes.func.isRequired, | ||
isEntireTableSelected: PropTypes.bool, | ||
enterpriseGroupLearners: PropTypes.arrayOf(PropTypes.string), | ||
}; | ||
|
||
export default AddMembersBulkAction; |
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
40 changes: 40 additions & 0 deletions
40
src/components/PeopleManagement/EnrollmentsTableColumnHeader.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,40 @@ | ||
import React from 'react'; | ||
import { | ||
OverlayTrigger, | ||
Tooltip, | ||
Stack, | ||
Icon, | ||
} from '@openedx/paragon'; | ||
import { InfoOutline } from '@openedx/paragon/icons'; | ||
import { FormattedMessage } from '@edx/frontend-platform/i18n'; | ||
|
||
const EnrollmentsTableColumnHeader = () => ( | ||
<Stack gap={1} direction="horizontal"> | ||
<span data-testid="members-table-enrollments-column-header"> | ||
<FormattedMessage | ||
id="people.management.groups.detail.page.learnersTable.enrollmentsColumn" | ||
defaultMessage="Enrollments" | ||
description="Enrollments column header in the Members table" | ||
/> | ||
</span> | ||
<OverlayTrigger | ||
key="enrollments-column-tooltip" | ||
placement="top" | ||
overlay={( | ||
<Tooltip id="enrollments-column-tooltip"> | ||
<div> | ||
<FormattedMessage | ||
id="people.management.groups.detail.page.learnersTable.enrollmentsColumn.tooltip" | ||
defaultMessage="Total number of enrollment originated from the budget" | ||
description="Tooltip for the Enrollments column header in the Group Members table" | ||
/> | ||
</div> | ||
</Tooltip> | ||
)} | ||
> | ||
<Icon size="xs" src={InfoOutline} className="ml-1 d-inline-flex" /> | ||
</OverlayTrigger> | ||
</Stack> | ||
); | ||
|
||
export default EnrollmentsTableColumnHeader; |
Oops, something went wrong.