Skip to content

Commit

Permalink
fixup! feat: Add support for toggling more parts of the progress page…
Browse files Browse the repository at this point in the history
… on or off.
  • Loading branch information
xitij2000 committed Oct 15, 2024
1 parent 373955f commit 45a4cf4
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 16 deletions.
32 changes: 22 additions & 10 deletions src/pages-and-resources/progress/Settings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ const ProgressSettings = ({ onClose }) => {
...otherCourseSettings,
progressPage: {
showGrades: values.showGrades,
showGradeSummary: values.showGradeSummary,
showGradeBreakdown: values.showGradeBreakdown,
showRelatedLinks: values.showRelatedLinks,
showCertificateStatus: values.showCertificateStatus,
},
};
await saveOtherCourseSettings(updatedOtherCourseSettings);
Expand All @@ -39,15 +40,17 @@ const ProgressSettings = ({ onClose }) => {
onClose={onClose}
initialValues={{
enableProgressGraph: !disableProgressGraph,
showGrades: !!otherCourseSettings?.progressPage?.showGrades,
showGradeSummary: !!otherCourseSettings?.progressPage?.showGradeSummary,
showRelatedLinks: !!otherCourseSettings?.progressPage?.showRelatedLinks,
showGrades: otherCourseSettings?.progressPage?.showGrades ?? true,
showGradeBreakdown: otherCourseSettings?.progressPage?.showGradeBreakdown ?? true,
showRelatedLinks: otherCourseSettings?.progressPage?.showRelatedLinks ?? true,
showCertificateStatus: otherCourseSettings?.progressPage?.showCertificateStatus ?? true,
}}
validationSchema={{
enableProgressGraph: Yup.boolean(),
showGrades: Yup.boolean(),
showGradeSummary: Yup.boolean(),
showGradeBreakdown: Yup.boolean(),
showRelatedLinks: Yup.boolean(),
showCertificateStatus: Yup.boolean(),
}}
onSettingsSave={handleSettingsSave}
>
Expand Down Expand Up @@ -75,13 +78,13 @@ const ProgressSettings = ({ onClose }) => {
checked={values.showGrades}
/>
<FormSwitchGroup
id="show-grade-summary"
name="showGradeSummary"
label={intl.formatMessage(messages.showGradeSummaryLabel)}
helpText={intl.formatMessage(messages.showGradeSummaryHelp)}
id="show-grade-breakdown"
name="showGradeBreakdown"
label={intl.formatMessage(messages.showGradeBreakdownLabel)}
helpText={intl.formatMessage(messages.showGradeBreakdownHelp)}
onChange={handleChange}
onBlur={handleBlur}
checked={values.showGradeSummary}
checked={values.showGradeBreakdown}
/>
<FormSwitchGroup
id="show-related-links"
Expand All @@ -92,6 +95,15 @@ const ProgressSettings = ({ onClose }) => {
onBlur={handleBlur}
checked={values.showRelatedLinks}
/>
<FormSwitchGroup
id="show-certificate-status"
name="showCertificateStatus"
label={intl.formatMessage(messages.showCertificateStatusLabel)}
helpText={intl.formatMessage(messages.showCertificateStatusHelp)}
onChange={handleChange}
onBlur={handleBlur}
checked={values.showCertificateStatus}
/>
</>
)
}
Expand Down
20 changes: 14 additions & 6 deletions src/pages-and-resources/progress/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ const messages = defineMessages({
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',
showGradeBreakdownLabel: {
id: 'course-authoring.pages-resources.progress.show-grade-breakdown.label',
defaultMessage: 'Show Grade Breakdown',
},
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.',
showGradeBreakdownHelp: {
id: 'course-authoring.pages-resources.progress.show-grade-breakdown.help',
defaultMessage: 'If enabled, students can see a summary and detailed breakdown of their grades on the progress page.',
},
showRelatedLinksLabel: {
id: 'course-authoring.pages-resources.progress.show-related-links.label',
Expand All @@ -52,6 +52,14 @@ const messages = defineMessages({
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.',
},
showCertificateStatusLabel: {
id: 'course-authoring.pages-resources.progress.show-certificate-status.label',
defaultMessage: 'Show Certificate Status',
},
showCertificateStatusHelp: {
id: 'course-authoring.pages-resources.progress.show-certificate-status.help',
defaultMessage: 'If enabled, students can see the status of their certificates on the progress page.',
},
});

export default messages;

0 comments on commit 45a4cf4

Please sign in to comment.