Skip to content

Commit

Permalink
refactor: update score label text and add tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
navinkarkera committed Jun 10, 2024
1 parent 73fe541 commit 26e9860
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { OverlayTrigger, Tooltip } from '@openedx/paragon';

import {
getLocale, injectIntl, intlShape, isRtl,
Expand All @@ -10,10 +11,26 @@ import messages from '../messages';

const ProblemScoreDrawer = ({ intl, problemScores, subsection }) => {
const isLocaleRtl = isRtl(getLocale());
const scoreLabel = subsection.hasGradedAssignment ? messages.problemScoreLabel : messages.ungradedProblemScoreLabel;

let scoreLabel = messages.practiceScoreLabel;
let scoreLabelTooltip = messages.practiceScoreLabelTooltip;
if (subsection.hasGradedAssignment) {
scoreLabel = messages.problemScoreLabel;
scoreLabelTooltip = messages.problemScoreLabelTooltip;
}

return (
<span className="row w-100 m-0 x-small ml-4 pt-2 pl-1 text-gray-700 flex-nowrap">
<span id="problem-score-label" className="col-auto p-0">{intl.formatMessage(scoreLabel)}</span>
<OverlayTrigger
placement="auto"
overlay={(
<Tooltip variant="light">
<small>{intl.formatMessage(scoreLabelTooltip)}</small>
</Tooltip>
)}
>
<span id="problem-score-label" className="col-auto p-0">{intl.formatMessage(scoreLabel)}</span>
</OverlayTrigger>
<div className={classNames('col', 'p-0', { 'greyed-out': !subsection.learnerHasAccess })}>
<ul className="list-unstyled row w-100 m-0" aria-labelledby="problem-score-label">
{problemScores.map((problemScore, i) => (
Expand Down
16 changes: 13 additions & 3 deletions src/course-home/progress-tab/grades/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,21 @@ const messages = defineMessages({
defaultMessage: 'Problem Scores:',
description: 'Label text which precedes detailed view of all scores per assignment',
},
ungradedProblemScoreLabel: {
id: 'progress.detailedGrades.ungraded.problemScore.label',
defaultMessage: 'Ungraded Problem Scores:',
problemScoreLabelTooltip: {
id: 'progress.detailedGrades.problemScore.tooltip',
defaultMessage: 'Scores from activities that contribute to your final grade.',
description: 'Tooltip text for the label which precedes detailed view of all scores per assignment',
},
practiceScoreLabel: {
id: 'progress.detailedGrades.practice.problemScore.label',
defaultMessage: 'Practice Scores:',
description: 'Label text which precedes detailed view of all ungraded problem scores per assignment',
},
practiceScoreLabelTooltip: {
id: 'progress.detailedGrades.practice.problemScore.tooltip',
defaultMessage: 'Scores from non-graded activities meant for practice and self-assessment.',
description: 'Tooltip text for the label which precedes detailed view of all ungraded problem scores per assignment',
},
problemScoreToggleAltText: {
id: 'progress.detailedGrades.problemScore.toggleButton',
defaultMessage: 'Toggle individual problem scores for {subsectionTitle}',
Expand Down

0 comments on commit 26e9860

Please sign in to comment.