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:
Braden MacDonald
2024-02-28 08:50:54 -08:00
committed by GitHub
parent 49fce4622c
commit 3c661e15cb
75 changed files with 910 additions and 254 deletions

View File

@@ -0,0 +1,49 @@
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import PropTypes from 'prop-types';
import React from 'react';
import * as Yup from 'yup';
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 WikiSettings = ({ intl, onClose }) => {
const [enablePublicWiki, saveSetting] = useAppSetting('allowPublicWikiAccess');
const handleSettingsSave = (values) => saveSetting(values.enablePublicWiki);
return (
<AppSettingsModal
appId="wiki"
title={intl.formatMessage(messages.heading)}
enableAppHelp={intl.formatMessage(messages.enableWikiHelp)}
enableAppLabel={intl.formatMessage(messages.enableWikiLabel)}
learnMoreText={intl.formatMessage(messages.enableWikiLink)}
onClose={onClose}
initialValues={{ enablePublicWiki }}
validationSchema={{ enablePublicWiki: Yup.boolean() }}
onSettingsSave={handleSettingsSave}
>
{
({ values, handleChange, handleBlur }) => (
<FormSwitchGroup
id="enable-public-wiki"
name="enablePublicWiki"
label={intl.formatMessage(messages.enablePublicWikiLabel)}
helpText={intl.formatMessage(messages.enablePublicWikiHelp)}
onChange={handleChange}
onBlue={handleBlur}
checked={values.enablePublicWiki}
/>
)
}
</AppSettingsModal>
);
};
WikiSettings.propTypes = {
intl: intlShape.isRequired,
onClose: PropTypes.func.isRequired,
};
export default injectIntl(WikiSettings);

View File

@@ -0,0 +1,34 @@
import { defineMessages } from '@edx/frontend-platform/i18n';
const messages = defineMessages({
heading: {
id: 'course-authoring.pages-resources.wiki.heading',
defaultMessage: 'Configure wiki',
},
enableWikiLabel: {
id: 'course-authoring.pages-resources.wiki.enable-wiki.label',
defaultMessage: 'Wiki',
},
enableWikiHelp: {
id: 'course-authoring.pages-resources.wiki.enable-wiki.help',
defaultMessage: `The course wiki can be set up based on the needs of your
course. Common uses might include sharing answers to course FAQs, sharing
editable course information, or providing access to learner-created
resources.`,
},
enableWikiLink: {
id: 'course-authoring.pages-resources.wiki.enable-wiki.link',
defaultMessage: 'Learn more about the wiki',
},
enablePublicWikiLabel: {
id: 'course-authoring.pages-resources.wiki.enable-public-wiki.label',
defaultMessage: 'Enable public wiki access',
},
enablePublicWikiHelp: {
id: 'course-authoring.pages-resources.wiki.enable-public-wiki.help',
defaultMessage: `If enabled, edX users can view the course wiki even when
they're not enrolled in the course.`,
},
});
export default messages;

View File

@@ -0,0 +1,18 @@
{
"name": "@openedx-plugins/course-app-wiki",
"version": "0.1.0",
"description": "Wiki 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
}
}
}