Convert "Pages & Resources" page to a plugin system (#638)
* feat: Make "Pages & Resources" course apps into plugins * feat: move ora_settings * feat: move proctoring * feat: move progress * feat: move teams * feat: move wiki * feat: move Xpert settings * fix: add webpack.prod.config.js * fix: clean up unused parts of package.json files * feat: Add an error message when displaying a Course App Plugin fails * chore: fix various eslint warnings * chore: fix jest tests * fix: error preventing "npm ci" from working * feat: better tests for <SettingsComponent> * chore: move xpert_unit_summary into same dir as other plugins * fix: eslint-import-resolver-webpack is a dev dependency * chore: move learning_assistant to be a plugin too * feat: for compatibility, install 2U plugins by default * fix: bug with learning_assistant package.json
This commit is contained in:
55
plugins/course-apps/progress/Settings.jsx
Normal file
55
plugins/course-apps/progress/Settings.jsx
Normal file
@@ -0,0 +1,55 @@
|
||||
import { injectIntl, intlShape } 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 FormSwitchGroup from 'CourseAuthoring/generic/FormSwitchGroup';
|
||||
import { useAppSetting } from 'CourseAuthoring/utils';
|
||||
import AppSettingsModal from 'CourseAuthoring/pages-and-resources/app-settings-modal/AppSettingsModal';
|
||||
import messages from './messages';
|
||||
|
||||
const ProgressSettings = ({ intl, onClose }) => {
|
||||
const [disableProgressGraph, saveSetting] = useAppSetting('disableProgressGraph');
|
||||
const showProgressGraphSetting = getConfig().ENABLE_PROGRESS_GRAPH_SETTINGS.toString().toLowerCase() === 'true';
|
||||
|
||||
const handleSettingsSave = async (values) => {
|
||||
if (showProgressGraphSetting) { await saveSetting(!values.enableProgressGraph); }
|
||||
};
|
||||
|
||||
return (
|
||||
<AppSettingsModal
|
||||
appId="progress"
|
||||
title={intl.formatMessage(messages.heading)}
|
||||
enableAppHelp={intl.formatMessage(messages.enableProgressHelp)}
|
||||
enableAppLabel={intl.formatMessage(messages.enableProgressLabel)}
|
||||
learnMoreText={intl.formatMessage(messages.enableProgressLink)}
|
||||
onClose={onClose}
|
||||
initialValues={{ enableProgressGraph: !disableProgressGraph }}
|
||||
validationSchema={{ enableProgressGraph: Yup.boolean() }}
|
||||
onSettingsSave={handleSettingsSave}
|
||||
>
|
||||
{
|
||||
({ handleChange, handleBlur, values }) => (
|
||||
showProgressGraphSetting && (
|
||||
<FormSwitchGroup
|
||||
id="enable-progress-graph"
|
||||
name="enableProgressGraph"
|
||||
label={intl.formatMessage(messages.enableGraphLabel)}
|
||||
helpText={intl.formatMessage(messages.enableGraphHelp)}
|
||||
onChange={handleChange}
|
||||
onBlur={handleBlur}
|
||||
checked={values.enableProgressGraph}
|
||||
/>
|
||||
)
|
||||
)
|
||||
}
|
||||
</AppSettingsModal>
|
||||
);
|
||||
};
|
||||
|
||||
ProgressSettings.propTypes = {
|
||||
intl: intlShape.isRequired,
|
||||
onClose: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
export default injectIntl(ProgressSettings);
|
||||
33
plugins/course-apps/progress/messages.js
Normal file
33
plugins/course-apps/progress/messages.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import { defineMessages } from '@edx/frontend-platform/i18n';
|
||||
|
||||
const messages = defineMessages({
|
||||
heading: {
|
||||
id: 'course-authoring.pages-resources.progress.heading',
|
||||
defaultMessage: 'Configure progress',
|
||||
},
|
||||
enableProgressLabel: {
|
||||
id: 'course-authoring.pages-resources.progress.enable-progress.label',
|
||||
defaultMessage: 'Progress',
|
||||
},
|
||||
enableProgressHelp: {
|
||||
id: 'course-authoring.pages-resources.progress.enable-progress.help',
|
||||
defaultMessage: `As students work through graded assignments, scores
|
||||
will appear under the progress tab. The progress tab contains a chart of
|
||||
all graded assignments in the course, with a list of all assignments and
|
||||
scores below.`,
|
||||
},
|
||||
enableProgressLink: {
|
||||
id: 'course-authoring.pages-resources.progress.enable-progress.link',
|
||||
defaultMessage: 'Learn more about progress',
|
||||
},
|
||||
enableGraphLabel: {
|
||||
id: 'course-authoring.pages-resources.progress.enable-graph.label',
|
||||
defaultMessage: 'Enable progress graph',
|
||||
},
|
||||
enableGraphHelp: {
|
||||
id: 'course-authoring.pages-resources.progress.enable-graph.help',
|
||||
defaultMessage: 'If enabled, students can view the progress graph',
|
||||
},
|
||||
});
|
||||
|
||||
export default messages;
|
||||
18
plugins/course-apps/progress/package.json
Normal file
18
plugins/course-apps/progress/package.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "@openedx-plugins/course-app-progress",
|
||||
"version": "0.1.0",
|
||||
"description": "Progress configuration for courses using it",
|
||||
"peerDependencies": {
|
||||
"@edx/frontend-app-course-authoring": "*",
|
||||
"@edx/frontend-platform": "*",
|
||||
"@openedx/paragon": "*",
|
||||
"prop-types": "*",
|
||||
"react": "*",
|
||||
"yup": "*"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@edx/frontend-app-course-authoring": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user