Skip to content

Commit 65096fd

Browse files
authored
feat: add card in Pages and Resources to allow hiding the dates tab (#2834)
1 parent af204c7 commit 65096fd

File tree

6 files changed

+95
-1
lines changed

6 files changed

+95
-1
lines changed

package-lock.json

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"@edx/frontend-platform": "^8.4.0",
5252
"@edx/openedx-atlas": "^0.7.0",
5353
"@openedx-plugins/course-app-calculator": "file:plugins/course-apps/calculator",
54+
"@openedx-plugins/course-app-dates": "file:plugins/course-apps/dates",
5455
"@openedx-plugins/course-app-edxnotes": "file:plugins/course-apps/edxnotes",
5556
"@openedx-plugins/course-app-learning_assistant": "file:plugins/course-apps/learning_assistant",
5657
"@openedx-plugins/course-app-live": "file:plugins/course-apps/live",
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import React from 'react';
2+
import { useIntl } from '@edx/frontend-platform/i18n';
3+
4+
import AppSettingsModal from 'CourseAuthoring/pages-and-resources/app-settings-modal/AppSettingsModal';
5+
import messages from './messages';
6+
7+
type DatesSettingsProps = {
8+
onClose: () => void;
9+
};
10+
11+
const DatesSettings: React.FC<DatesSettingsProps> = ({ onClose }) => {
12+
const intl = useIntl();
13+
14+
return (
15+
<AppSettingsModal
16+
appId="dates"
17+
title={intl.formatMessage(messages.heading)}
18+
enableAppHelp={intl.formatMessage(messages.enableAppHelp)}
19+
enableAppLabel={intl.formatMessage(messages.enableAppLabel)}
20+
learnMoreText={intl.formatMessage(messages.learnMore)}
21+
onClose={onClose}
22+
validationSchema={{}}
23+
initialValues={{}}
24+
onSettingsSave={async () => true}
25+
/>
26+
);
27+
};
28+
29+
export default DatesSettings;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { defineMessages } from '@edx/frontend-platform/i18n';
2+
3+
const messages = defineMessages({
4+
heading: {
5+
id: 'course-authoring.pages-resources.dates.heading',
6+
defaultMessage: 'Configure dates',
7+
description: 'Heading for the Dates settings modal shown in Pages & Resources.',
8+
},
9+
enableAppLabel: {
10+
id: 'course-authoring.pages-resources.dates.enable-app.label',
11+
defaultMessage: 'Dates',
12+
description: 'Label for the toggle that enables the Dates experience.',
13+
},
14+
enableAppHelp: {
15+
id: 'course-authoring.pages-resources.dates.enable-app.help',
16+
defaultMessage: 'Show the Dates tab in course navigation, where learners can view important course dates.',
17+
description: 'Helper text explaining what enabling the Dates experience does.',
18+
},
19+
learnMore: {
20+
id: 'course-authoring.pages-resources.dates.learn-more',
21+
defaultMessage: 'Learn more about dates',
22+
description: 'Link text that leads to documentation about the Dates experience.',
23+
},
24+
});
25+
26+
export default messages;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "@openedx-plugins/course-app-dates",
3+
"version": "0.1.0",
4+
"description": "Dates configuration for courses using it",
5+
"peerDependencies": {
6+
"@edx/frontend-app-authoring": "*",
7+
"@edx/frontend-platform": "*",
8+
"@openedx/paragon": "*",
9+
"prop-types": "*",
10+
"react": "*"
11+
},
12+
"peerDependenciesMeta": {
13+
"@edx/frontend-app-authoring": {
14+
"optional": true
15+
}
16+
}
17+
}

src/pages-and-resources/SettingsComponent.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const SettingsComponent = ({ url }) => {
1717

1818
const LazyLoadedComponent = React.useMemo(
1919
() => React.lazy(() =>
20-
import(`@openedx-plugins/course-app-${appId}/Settings.jsx`).catch((err) => { // eslint-disable-line
20+
import(`@openedx-plugins/course-app-${appId}/Settings`).catch((err) => { // eslint-disable-line
2121
// If we couldn't load this plugin, log the details to the console.
2222
console.trace(err); // eslint-disable-line no-console
2323
return { default: PluginLoadFailedError };

0 commit comments

Comments
 (0)