* 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
70 lines
2.1 KiB
JavaScript
70 lines
2.1 KiB
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import * as Yup from 'yup';
|
|
|
|
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
|
|
|
|
import { Hyperlink } from '@openedx/paragon';
|
|
import { useModel } from 'CourseAuthoring/generic/model-store';
|
|
|
|
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 ORASettings = ({ intl, onClose }) => {
|
|
const appId = 'ora_settings';
|
|
const appInfo = useModel('courseApps', appId);
|
|
const [enableFlexiblePeerGrade, saveSetting] = useAppSetting(
|
|
'forceOnFlexiblePeerOpenassessments',
|
|
);
|
|
const handleSettingsSave = (values) => saveSetting(values.enableFlexiblePeerGrade);
|
|
|
|
const title = (
|
|
<div>
|
|
<p>{intl.formatMessage(messages.heading)}</p>
|
|
<div className="pt-3">
|
|
<Hyperlink
|
|
className="text-primary-500 small"
|
|
destination={appInfo.documentationLinks?.learnMoreConfiguration}
|
|
target="_blank"
|
|
rel="noreferrer noopener"
|
|
>
|
|
{intl.formatMessage(messages.ORASettingsHelpLink)}
|
|
</Hyperlink>
|
|
</div>
|
|
</div>
|
|
);
|
|
|
|
return (
|
|
<AppSettingsModal
|
|
appId={appId}
|
|
title={title}
|
|
onClose={onClose}
|
|
initialValues={{ enableFlexiblePeerGrade }}
|
|
validationSchema={{ enableFlexiblePeerGrade: Yup.boolean() }}
|
|
onSettingsSave={handleSettingsSave}
|
|
hideAppToggle
|
|
>
|
|
{({ values, handleChange, handleBlur }) => (
|
|
<FormSwitchGroup
|
|
id="enable-flexible-peer-grade"
|
|
name="enableFlexiblePeerGrade"
|
|
label={intl.formatMessage(messages.enableFlexPeerGradeLabel)}
|
|
helpText={intl.formatMessage(messages.enableFlexPeerGradeHelp)}
|
|
onChange={handleChange}
|
|
onBlur={handleBlur}
|
|
checked={values.enableFlexiblePeerGrade}
|
|
/>
|
|
)}
|
|
</AppSettingsModal>
|
|
);
|
|
};
|
|
|
|
ORASettings.propTypes = {
|
|
intl: intlShape.isRequired,
|
|
onClose: PropTypes.func.isRequired,
|
|
};
|
|
|
|
export default injectIntl(ORASettings);
|