diff --git a/src/pages-and-resources/progress/Settings.jsx b/src/pages-and-resources/progress/Settings.jsx
index f9326aee8d..3e16a0f61d 100644
--- a/src/pages-and-resources/progress/Settings.jsx
+++ b/src/pages-and-resources/progress/Settings.jsx
@@ -1,19 +1,32 @@
-import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
+import { getConfig } from '@edx/frontend-platform';
+import { useIntl } from '@edx/frontend-platform/i18n';
import PropTypes from 'prop-types';
import React from 'react';
import * as Yup from 'yup';
-import { getConfig } from '@edx/frontend-platform';
+import messages from './messages';
import FormSwitchGroup from '../../generic/FormSwitchGroup';
import { useAppSetting } from '../../utils';
import AppSettingsModal from '../app-settings-modal/AppSettingsModal';
-import messages from './messages';
-const ProgressSettings = ({ intl, onClose }) => {
+const ProgressSettings = ({ onClose }) => {
+ const intl = useIntl();
const [disableProgressGraph, saveSetting] = useAppSetting('disableProgressGraph');
- const showProgressGraphSetting = getConfig().ENABLE_PROGRESS_GRAPH_SETTINGS.toLowerCase() === 'true';
+ const [otherCourseSettings, saveOtherCourseSettings] = useAppSetting('otherCourseSettings');
+ const showProgressGraphSetting = getConfig().ENABLE_PROGRESS_GRAPH_SETTINGS.toString().toLowerCase() === 'true';
- const handleSettingsSave = (values) => {
- if (showProgressGraphSetting) { saveSetting(!values.enableProgressGraph); }
+ const handleSettingsSave = async (values) => {
+ if (showProgressGraphSetting) {
+ await saveSetting(!values.enableProgressGraph);
+ }
+ const updatedOtherCourseSettings = {
+ ...otherCourseSettings,
+ progressPage: {
+ showGrades: values.showGrades,
+ showGradeSummary: values.showGradeSummary,
+ showRelatedLinks: values.showRelatedLinks,
+ },
+ };
+ await saveOtherCourseSettings(updatedOtherCourseSettings);
};
return (
@@ -24,23 +37,62 @@ const ProgressSettings = ({ intl, onClose }) => {
enableAppLabel={intl.formatMessage(messages.enableProgressLabel)}
learnMoreText={intl.formatMessage(messages.enableProgressLink)}
onClose={onClose}
- initialValues={{ enableProgressGraph: !disableProgressGraph }}
- validationSchema={{ enableProgressGraph: Yup.boolean() }}
+ initialValues={{
+ enableProgressGraph: !disableProgressGraph,
+ showGrades: !!otherCourseSettings?.progressPage?.showGrades,
+ showGradeSummary: !!otherCourseSettings?.progressPage?.showGradeSummary,
+ showRelatedLinks: !!otherCourseSettings?.progressPage?.showRelatedLinks,
+ }}
+ validationSchema={{
+ enableProgressGraph: Yup.boolean(),
+ showGrades: Yup.boolean(),
+ showGradeSummary: Yup.boolean(),
+ showRelatedLinks: Yup.boolean(),
+ }}
onSettingsSave={handleSettingsSave}
>
{
({ handleChange, handleBlur, values }) => (
- showProgressGraphSetting && (
-
- )
+ <>
+ {showProgressGraphSetting && (
+
+ )}
+
+
+
+ >
)
}
@@ -48,8 +100,7 @@ const ProgressSettings = ({ intl, onClose }) => {
};
ProgressSettings.propTypes = {
- intl: intlShape.isRequired,
onClose: PropTypes.func.isRequired,
};
-export default injectIntl(ProgressSettings);
+export default ProgressSettings;
diff --git a/src/pages-and-resources/progress/messages.js b/src/pages-and-resources/progress/messages.js
index 6bf0f6f36e..8ee155920b 100644
--- a/src/pages-and-resources/progress/messages.js
+++ b/src/pages-and-resources/progress/messages.js
@@ -28,6 +28,30 @@ const messages = defineMessages({
id: 'course-authoring.pages-resources.progress.enable-graph.help',
defaultMessage: 'If enabled, students can view the progress graph',
},
+ showGradesLabel: {
+ id: 'course-authoring.pages-resources.progress.show-grades.label',
+ defaultMessage: 'Show grades',
+ },
+ showGradesHelp: {
+ id: 'course-authoring.pages-resources.progress.show-grades.help',
+ defaultMessage: 'If enabled, students can see their grades on the progress page.',
+ },
+ showGradeSummaryLabel: {
+ id: 'course-authoring.pages-resources.progress.show-grade-summary.label',
+ defaultMessage: 'Show grades Summary',
+ },
+ showGradeSummaryHelp: {
+ id: 'course-authoring.pages-resources.progress.show-grade-summary.help',
+ defaultMessage: 'If enabled, students can see a summary of their grades on the progress page.',
+ },
+ showRelatedLinksLabel: {
+ id: 'course-authoring.pages-resources.progress.show-related-links.label',
+ defaultMessage: 'Show Related Links',
+ },
+ showRelatedLinksHelp: {
+ id: 'course-authoring.pages-resources.progress.show-related-links.help',
+ defaultMessage: 'If enabled, students can see related links in the sidebar on the progress page.',
+ },
});
export default messages;