diff --git a/src/components/CollapsibleFeedback/AssessmentCriterion.jsx b/src/components/CollapsibleFeedback/AssessmentCriterion.jsx new file mode 100644 index 00000000..79d2efcf --- /dev/null +++ b/src/components/CollapsibleFeedback/AssessmentCriterion.jsx @@ -0,0 +1,45 @@ +import React from 'react'; +import PropTypes from 'prop-types'; + +import { useIntl } from '@edx/frontend-platform/i18n'; +import Feedback from './Feedback'; +import messages from './messages'; + +const AssessmentCriterion = ({ assessmentCriterions, overallFeedback, stepName }) => { + const { formatMessage } = useIntl(); + + return ( + <> + {assessmentCriterions.map((criterion) => { + return ( + + ); + })} + + + ); +}; +AssessmentCriterion.defaultProps = {}; +AssessmentCriterion.propTypes = { + assessmentCriterions: PropTypes.arrayOf(PropTypes.shape({ + name: PropTypes.string.isRequired, + selectedOption: PropTypes.string, + selectedPoints: PropTypes.number, + feedback: PropTypes.string, + })), + overallFeedback: PropTypes.string, + stepName: PropTypes.string.isRequired, +}; + +export default AssessmentCriterion; diff --git a/src/components/CollapsibleFeedback/Feedback.jsx b/src/components/CollapsibleFeedback/Feedback.jsx index 7eddbe52..35247dde 100644 --- a/src/components/CollapsibleFeedback/Feedback.jsx +++ b/src/components/CollapsibleFeedback/Feedback.jsx @@ -5,16 +5,38 @@ import { Collapsible, Icon } from '@edx/paragon'; import { ExpandMore, ExpandLess } from '@edx/paragon/icons'; import { useIntl } from '@edx/frontend-platform/i18n'; import messages from './messages'; +import InfoPopover from 'components/InfoPopover'; -const Feedback = ({ criterion, selectedOption, selectedPoints, commentHeader, commentBody, defaultOpen }) => { +const Feedback = ({ + criterionName, + selectedOption, + selectedPoints, + commentHeader, + commentBody, + defaultOpen, +}) => { const [isExpanded, setIsExpanded] = React.useState(defaultOpen); const { formatMessage } = useIntl(); return ( <>
-
{criterion.name}
- {selectedOption &&

{selectedOption} -- {selectedPoints} points

} +
+
{criterionName}
+ {}}> +

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do + eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut + enim ad minim veniam, quis nostrud exercitation ullamco laboris + nisi ut aliquip ex ea commodo consequat. +

+
+
+ {selectedOption && ( +

+ {selectedOption} -- {selectedPoints} points +

+ )}
{ - const assessmentCriterions = assessment.assessmentCriterions; +const CollapsibleFeedback = ({ children, stepScore, stepName }) => { const { formatMessage } = useIntl(); return ( - {formatMessage(messages.grade, { - stepName, - })} + {formatMessage(messages.grade, { stepName })} {stepScore && formatMessage(messages.gradePoints, stepScore)} } > - {assessmentCriterions.map((criterion) => { - return ( - - ); - })} - + {children} ); }; CollapsibleFeedback.defaultProps = {}; CollapsibleFeedback.propTypes = { - // assessment: PropTypes.shape({ - // overallFeedback: PropTypes.string, - // }), stepName: PropTypes.string.isRequired, + stepScore: PropTypes.shape({ + earned: PropTypes.number, + possible: PropTypes.number, + }), + children: PropTypes.node.isRequired, }; export default CollapsibleFeedback; diff --git a/src/components/CollapsibleFeedback/messages.js b/src/components/CollapsibleFeedback/messages.js index ed38e668..aa8bd9be 100644 --- a/src/components/CollapsibleFeedback/messages.js +++ b/src/components/CollapsibleFeedback/messages.js @@ -26,6 +26,11 @@ const messages = defineMessages({ defaultMessage: '(Not weighted toward final grade))', description: 'Not weighted grade label', }, + overallFeedback: { + id: 'ora-collapsible-comment.overallFeedback', + defaultMessage: 'Overall Feedback', + description: 'Overall feedback label', + }, }); export default messages; diff --git a/src/views/GradeView/FinalGrade.jsx b/src/views/GradeView/FinalGrade.jsx index 77458dc0..6b4a4e86 100644 --- a/src/views/GradeView/FinalGrade.jsx +++ b/src/views/GradeView/FinalGrade.jsx @@ -1,10 +1,11 @@ -import React from 'react'; +import React, { Fragment } from 'react'; import { useIntl } from '@edx/frontend-platform/i18n'; import CollapsibleFeedback from 'components/CollapsibleFeedback'; import { useAssessmentsData } from 'data/services/lms/hooks/selectors'; import messages from './messages'; +import AssessmentCriterion from 'components/CollapsibleFeedback/AssessmentCriterion'; const FinalGrade = () => { const { formatMessage } = useIntl(); @@ -14,47 +15,69 @@ const FinalGrade = () => { let finalStepScore = null; if (assessments.staff) { finalStepScore = assessments.staff.stepScore; + const stepName = formatMessage(messages.staffStep); result.push( + stepName={stepName} + stepScore={assessments.staff.stepScore} + > + + ); } if (assessments.peer) { finalStepScore = finalStepScore || assessments.peer.stepScore; + const stepName = formatMessage(messages.peerStep); result.push(
- {assessments.peer.assessment?.map((peer, index) => ( - - ))} + + {assessments.peer.assessment?.map((peer, index) => ( + +

+ {stepName} {index}: +

+ +
+
+ ))} +
); } if (assessments.peerUnweighted) { + const stepName = formatMessage(messages.unweightedPeerStep); result.push(
- {assessments.peerUnweighted.assessment?.map((peer, index) => ( - - ))} + + {assessments.peerUnweighted.assessment?.map((peer, index) => ( + +

+ {stepName} {index}: +

+ +
+
+ ))} +
); } if (assessments.self) { finalStepScore = finalStepScore || assessments.self.stepScore; + const stepName = formatMessage(messages.selfStep); result.push( + stepName={stepName} + stepScore={assessments.self.stepScore} + > + + ); }