From bfad5cf684bcb5a4255500b3bcdf8b34e431ec9f Mon Sep 17 00:00:00 2001 From: Abderraouf Mehdi Bouhali Date: Thu, 15 Sep 2022 17:46:52 +0100 Subject: [PATCH] fix(rtl): use backslash to write fractions (grades) --- .../grades/detailed-grades/DetailedGradesTable.jsx | 7 +++++-- .../grades/detailed-grades/ProblemScoreDrawer.jsx | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) 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 a25c1a72..0e349070 100644 --- a/src/course-home/progress-tab/grades/detailed-grades/DetailedGradesTable.jsx +++ b/src/course-home/progress-tab/grades/detailed-grades/DetailedGradesTable.jsx @@ -1,7 +1,9 @@ import React from 'react'; import { useSelector } from 'react-redux'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { + getLocale, injectIntl, intlShape, isRtl, +} from '@edx/frontend-platform/i18n'; import { DataTable } from '@edx/paragon'; import { useModel } from '../../../../generic/model-store'; @@ -17,6 +19,7 @@ function DetailedGradesTable({ intl }) { sectionScores, } = useModel('progress', courseId); + const isLocaleRtl = isRtl(getLocale()); return ( sectionScores.map((chapter) => { const subsectionScores = chapter.subsections.filter( @@ -32,7 +35,7 @@ function DetailedGradesTable({ intl }) { const detailedGradesData = subsectionScores.map((subsection) => ({ subsectionTitle: , - score: {subsection.numPointsEarned}/{subsection.numPointsPossible}, + score: {subsection.numPointsEarned}{isLocaleRtl ? '\\' : '/'}{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 2a90551e..7f64aa8f 100644 --- a/src/course-home/progress-tab/grades/detailed-grades/ProblemScoreDrawer.jsx +++ b/src/course-home/progress-tab/grades/detailed-grades/ProblemScoreDrawer.jsx @@ -2,18 +2,21 @@ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { + getLocale, injectIntl, intlShape, isRtl, +} from '@edx/frontend-platform/i18n'; import messages from '../messages'; function ProblemScoreDrawer({ intl, problemScores, subsection }) { + const isLocaleRtl = isRtl(getLocale()); return ( {intl.formatMessage(messages.problemScoreLabel)}
    {problemScores.map(problemScore => ( -
  • {problemScore.earned}/{problemScore.possible}
  • +
  • {problemScore.earned}{isLocaleRtl ? '\\' : '/'}{problemScore.possible}
  • ))}