diff --git a/src/course-home/progress-tab/grades/detailed-grades/DetailedGrades.jsx b/src/course-home/progress-tab/grades/detailed-grades/DetailedGrades.jsx index 9a5a0a5e..51c24ce7 100644 --- a/src/course-home/progress-tab/grades/detailed-grades/DetailedGrades.jsx +++ b/src/course-home/progress-tab/grades/detailed-grades/DetailedGrades.jsx @@ -52,8 +52,8 @@ function DetailedGrades({ intl }) {

{intl.formatMessage(messages.detailedGrades)}

{gradesFeatureIsPartiallyLocked && ( -
- +
+ {intl.formatMessage(messages.gradeSummaryLimitedAccessExplanation)}
)} diff --git a/src/course-home/progress-tab/grades/detailed-grades/DetailedGradesTable.jsx b/src/course-home/progress-tab/grades/detailed-grades/DetailedGradesTable.jsx index e9d5e362..0f5e561f 100644 --- a/src/course-home/progress-tab/grades/detailed-grades/DetailedGradesTable.jsx +++ b/src/course-home/progress-tab/grades/detailed-grades/DetailedGradesTable.jsx @@ -32,7 +32,7 @@ function DetailedGradesTable({ intl }) { const detailedGradesData = subsectionScores.map((subsection) => ({ subsectionTitle: , - score: {subsection.numPointsEarned}/{subsection.numPointsPossible}, + score: {subsection.numPointsEarned}/{subsection.numPointsPossible}, })); return ( diff --git a/src/course-home/progress-tab/grades/detailed-grades/ProblemScoreDrawer.jsx b/src/course-home/progress-tab/grades/detailed-grades/ProblemScoreDrawer.jsx index 68018fc5..29179f7f 100644 --- a/src/course-home/progress-tab/grades/detailed-grades/ProblemScoreDrawer.jsx +++ b/src/course-home/progress-tab/grades/detailed-grades/ProblemScoreDrawer.jsx @@ -1,15 +1,16 @@ import React from 'react'; import PropTypes from 'prop-types'; +import classNames from 'classnames'; import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import messages from '../messages'; -function ProblemScoreDrawer({ intl, problemScores }) { +function ProblemScoreDrawer({ intl, problemScores, subsection }) { return ( {intl.formatMessage(messages.problemScoreLabel)} -
+
    {problemScores.map(problemScore => (
  • {problemScore.earned}/{problemScore.possible}
  • @@ -26,6 +27,7 @@ ProblemScoreDrawer.propTypes = { earned: PropTypes.number.isRequired, possible: PropTypes.number.isRequired, })).isRequired, + subsection: PropTypes.shape({ learnerHasAccess: PropTypes.bool }).isRequired, }; export default injectIntl(ProblemScoreDrawer); diff --git a/src/course-home/progress-tab/grades/detailed-grades/SubsectionTitleCell.jsx b/src/course-home/progress-tab/grades/detailed-grades/SubsectionTitleCell.jsx index d74b5a12..2ab27834 100644 --- a/src/course-home/progress-tab/grades/detailed-grades/SubsectionTitleCell.jsx +++ b/src/course-home/progress-tab/grades/detailed-grades/SubsectionTitleCell.jsx @@ -44,21 +44,22 @@ function SubsectionTitleCell({ intl, subsection }) { - - {gradesFeatureIsFullyLocked || subsection.learnerHasAccess ? '' : } + + {gradesFeatureIsFullyLocked || subsection.learnerHasAccess ? '' : } {url ? ( {displayName} @@ -68,7 +69,7 @@ function SubsectionTitleCell({ intl, subsection }) { - + ); diff --git a/src/course-home/progress-tab/grades/grade-summary/AssignmentTypeCell.jsx b/src/course-home/progress-tab/grades/grade-summary/AssignmentTypeCell.jsx index 6a16638a..015e39c8 100644 --- a/src/course-home/progress-tab/grades/grade-summary/AssignmentTypeCell.jsx +++ b/src/course-home/progress-tab/grades/grade-summary/AssignmentTypeCell.jsx @@ -1,12 +1,14 @@ import React from 'react'; import { useSelector } from 'react-redux'; import PropTypes from 'prop-types'; +import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { Blocked } from '@edx/paragon/icons'; import { Icon } from '@edx/paragon'; import { useModel } from '../../../../generic/model-store'; +import messages from '../messages'; function AssignmentTypeCell({ - assignmentType, footnoteMarker, footnoteId, locked, + intl, assignmentType, footnoteMarker, footnoteId, locked, }) { const { courseId, @@ -16,7 +18,7 @@ function AssignmentTypeCell({ gradesFeatureIsFullyLocked, } = useModel('progress', courseId); - const lockedIcon = locked ? : ''; + const lockedIcon = locked ? : ''; return (
    @@ -29,6 +31,7 @@ function AssignmentTypeCell({ href={`#${footnoteId}-footnote`} aria-describedby="grade-summary-footnote-label" tabIndex={gradesFeatureIsFullyLocked ? '-1' : '0'} + aria-labelledby={`assignmentTypeBlockedIcon${assignmentType}`} > {footnoteMarker} @@ -39,6 +42,7 @@ function AssignmentTypeCell({ } AssignmentTypeCell.propTypes = { + intl: intlShape.isRequired, assignmentType: PropTypes.string.isRequired, footnoteId: PropTypes.string, footnoteMarker: PropTypes.number, @@ -51,4 +55,4 @@ AssignmentTypeCell.defaultProps = { locked: false, }; -export default AssignmentTypeCell; +export default injectIntl(AssignmentTypeCell); diff --git a/src/course-home/progress-tab/grades/grade-summary/GradeSummary.jsx b/src/course-home/progress-tab/grades/grade-summary/GradeSummary.jsx index 4b9d96c2..b937652c 100644 --- a/src/course-home/progress-tab/grades/grade-summary/GradeSummary.jsx +++ b/src/course-home/progress-tab/grades/grade-summary/GradeSummary.jsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useState } from 'react'; import { useSelector } from 'react-redux'; import { useModel } from '../../../../generic/model-store'; @@ -16,14 +16,16 @@ function GradeSummary() { }, } = useModel('progress', courseId); + const [allOfSomeAssignmentTypeIsLocked, setAllOfSomeAssignmentTypeIsLocked] = useState(false); + if (assignmentPolicies.length === 0) { return null; } return (
    - - + +
    ); } diff --git a/src/course-home/progress-tab/grades/grade-summary/GradeSummaryHeader.jsx b/src/course-home/progress-tab/grades/grade-summary/GradeSummaryHeader.jsx index e2b355c6..230d2059 100644 --- a/src/course-home/progress-tab/grades/grade-summary/GradeSummaryHeader.jsx +++ b/src/course-home/progress-tab/grades/grade-summary/GradeSummaryHeader.jsx @@ -1,5 +1,6 @@ import React, { useState } from 'react'; import { useSelector } from 'react-redux'; +import PropTypes from 'prop-types'; import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { @@ -10,15 +11,15 @@ import { Blocked, InfoOutline } from '@edx/paragon/icons'; import messages from '../messages'; import { useModel } from '../../../../generic/model-store'; -function GradeSummaryHeader({ intl }) { +function GradeSummaryHeader({ intl, allOfSomeAssignmentTypeIsLocked }) { const { courseId, } = useSelector(state => state.courseHome); const { gradesFeatureIsFullyLocked, - gradesFeatureIsPartiallyLocked, } = useModel('progress', courseId); const [showTooltip, setShowTooltip] = useState(false); + return (

    {intl.formatMessage(messages.gradeSummary)}

    @@ -45,9 +46,9 @@ function GradeSummaryHeader({ intl }) { disabled={gradesFeatureIsFullyLocked} /> - {gradesFeatureIsPartiallyLocked && ( -
    - + {!gradesFeatureIsFullyLocked && allOfSomeAssignmentTypeIsLocked && ( +
    + {intl.formatMessage(messages.gradeSummaryLimitedAccessExplanation)}
    )} @@ -57,6 +58,7 @@ function GradeSummaryHeader({ intl }) { GradeSummaryHeader.propTypes = { intl: intlShape.isRequired, + allOfSomeAssignmentTypeIsLocked: PropTypes.bool.isRequired, }; export default injectIntl(GradeSummaryHeader); diff --git a/src/course-home/progress-tab/grades/grade-summary/GradeSummaryTable.jsx b/src/course-home/progress-tab/grades/grade-summary/GradeSummaryTable.jsx index 670e447f..591c162c 100644 --- a/src/course-home/progress-tab/grades/grade-summary/GradeSummaryTable.jsx +++ b/src/course-home/progress-tab/grades/grade-summary/GradeSummaryTable.jsx @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import { useSelector } from 'react-redux'; import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; @@ -11,7 +12,7 @@ import GradeSummaryTableFooter from './GradeSummaryTableFooter'; import messages from '../messages'; -function GradeSummaryTable({ intl }) { +function GradeSummaryTable({ intl, setAllOfSomeAssignmentTypeIsLocked }) { const { courseId, } = useSelector(state => state.courseHome); @@ -37,9 +38,13 @@ function GradeSummaryTable({ intl }) { && (subsection.numPointsPossible > 0 || subsection.numPointsEarned > 0) ))).flat(); if (subsectionAssignmentsOfType.length) { - return !subsectionAssignmentsOfType.some((subsection) => ( + const noAccessToAssignmentsOfType = !subsectionAssignmentsOfType.some((subsection) => ( subsection.learnerHasAccess === true )); + if (noAccessToAssignmentsOfType) { + setAllOfSomeAssignmentTypeIsLocked(true); + return true; + } } return false; }; @@ -59,7 +64,7 @@ function GradeSummaryTable({ intl }) { footnoteMarker = footnotes.length; } - const locked = !gradesFeatureIsFullyLocked && hasNoAccessToAssignmentsOfType(assignment.type) ? 'locked-overlay' : ''; + const locked = !gradesFeatureIsFullyLocked && hasNoAccessToAssignmentsOfType(assignment.type) ? 'greyed-out' : ''; return { type: { @@ -97,7 +102,7 @@ function GradeSummaryTable({ intl }) { headerClassName: 'justify-content-end h5 mb-0', // eslint-disable-next-line react/prop-types Cell: ({ value }) => ( - {value.weight} // eslint-disable-line react/prop-types + {value.weight} // eslint-disable-line react/prop-types ), cellClassName: 'float-right small', }, @@ -107,7 +112,7 @@ function GradeSummaryTable({ intl }) { headerClassName: 'justify-content-end h5 mb-0', // eslint-disable-next-line react/prop-types Cell: ({ value }) => ( - {value.grade} // eslint-disable-line react/prop-types + {value.grade} // eslint-disable-line react/prop-types ), cellClassName: 'float-right small', }, @@ -117,7 +122,7 @@ function GradeSummaryTable({ intl }) { headerClassName: 'justify-content-end h5 mb-0 text-right', // eslint-disable-next-line react/prop-types Cell: ({ value }) => ( - {value.weightedGrade} // eslint-disable-line react/prop-types + {value.weightedGrade} // eslint-disable-line react/prop-types ), cellClassName: 'float-right font-weight-bold small', }, @@ -136,6 +141,7 @@ function GradeSummaryTable({ intl }) { GradeSummaryTable.propTypes = { intl: intlShape.isRequired, + setAllOfSomeAssignmentTypeIsLocked: PropTypes.func.isRequired, }; export default injectIntl(GradeSummaryTable); diff --git a/src/course-home/progress-tab/grades/messages.js b/src/course-home/progress-tab/grades/messages.js index 652684c2..1d6efda5 100644 --- a/src/course-home/progress-tab/grades/messages.js +++ b/src/course-home/progress-tab/grades/messages.js @@ -139,6 +139,14 @@ const messages = defineMessages({ id: 'progress.weightedGradeSummary', defaultMessage: 'Your current weighted grade summary', }, + noAcessToAssignmentType: { + id: 'progress.noAcessToAssignmentType', + defaultMessage: 'You do not have access to assignments of type {assignmentType}', + }, + noAcessToSubsection: { + id: 'progress.noAcessToSubsection', + defaultMessage: 'You do not have access to subsection {displayName}', + }, }); export default messages; diff --git a/src/index.scss b/src/index.scss index c905358a..c6bda565 100755 --- a/src/index.scss +++ b/src/index.scss @@ -357,6 +357,10 @@ } } +.greyed-out { + opacity: .3; +} + .locked-overlay { opacity: .3; pointer-events: none;