* 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
46 lines
1.6 KiB
JavaScript
46 lines
1.6 KiB
JavaScript
import React, { useCallback, useContext, useEffect } from 'react';
|
|
import { useDispatch } from 'react-redux';
|
|
|
|
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
|
|
import { PagesAndResourcesContext } from 'CourseAuthoring/pages-and-resources/PagesAndResourcesProvider';
|
|
import { useNavigate } from 'react-router-dom';
|
|
|
|
import SettingsModal from './settings-modal/SettingsModal';
|
|
import messages from './messages';
|
|
|
|
import { fetchXpertSettings } from './data/thunks';
|
|
|
|
const XpertUnitSummarySettings = ({ intl }) => {
|
|
const { path: pagesAndResourcesPath, courseId } = useContext(PagesAndResourcesContext);
|
|
const dispatch = useDispatch();
|
|
const navigate = useNavigate();
|
|
|
|
useEffect(() => {
|
|
dispatch(fetchXpertSettings(courseId));
|
|
}, [courseId]);
|
|
|
|
const handleClose = useCallback(() => {
|
|
navigate(pagesAndResourcesPath);
|
|
}, [pagesAndResourcesPath]);
|
|
|
|
return (
|
|
<SettingsModal
|
|
appId="xpert-unit-summary"
|
|
title={intl.formatMessage(messages.heading)}
|
|
enableAppHelp={intl.formatMessage(messages.enableXpertUnitSummaryHelp)}
|
|
helpPrivacyText={intl.formatMessage(messages.enableXpertUnitSummaryHelpPrivacyLink)}
|
|
enableAppLabel={intl.formatMessage(messages.enableXpertUnitSummaryLabel)}
|
|
learnMoreText={intl.formatMessage(messages.enableXpertUnitSummaryLink)}
|
|
allUnitsEnabledText={intl.formatMessage(messages.allUnitsEnabledByDefault)}
|
|
noUnitsEnabledText={intl.formatMessage(messages.noUnitsEnabledByDefault)}
|
|
onClose={handleClose}
|
|
/>
|
|
);
|
|
};
|
|
|
|
XpertUnitSummarySettings.propTypes = {
|
|
intl: intlShape.isRequired,
|
|
};
|
|
|
|
export default injectIntl(XpertUnitSummarySettings);
|