Skip to content

Commit 0ac127e

Browse files
authored
feat: add plugin slot for course end course recommendations (#1618)
1 parent 06e5fb5 commit 0ac127e

File tree

4 files changed

+56
-2
lines changed

4 files changed

+56
-2
lines changed

src/courseware/course/course-exit/CourseCelebration.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import UpgradeFootnote from './UpgradeFootnote';
3232
import SocialIcons from '../../social-share/SocialIcons';
3333
import { logClick, logVisit } from './utils';
3434
import { DashboardLink, IdVerificationSupportLink, ProfileLink } from '../../../shared/links';
35-
import CourseRecommendations from './CourseRecommendations';
35+
import CourseRecommendationsSlot from '../../../plugin-slots/CourseRecommendationsSlot';
3636

3737
const LINKEDIN_BLUE = '#2867B2';
3838

@@ -357,7 +357,7 @@ const CourseCelebration = ({ intl }) => {
357357
/>
358358
))}
359359
{footnote}
360-
<CourseRecommendations variant={visitEvent} />
360+
<CourseRecommendationsSlot variant={visitEvent} />
361361
</div>
362362
</div>
363363
</>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Unit Title Slot
2+
3+
### Slot ID: `course_recommendations_slot`
4+
### Props:
5+
* `variant`
6+
7+
## Description
8+
9+
This slot is used for modifying the course end recommendation
10+
11+
## Example
12+
13+
The following `env.config.jsx` will replace the course recommendations with a thumbs up
14+
15+
![Screenshot of modified course celebration](./screenshot_custom.png)
16+
17+
```js
18+
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
19+
20+
const config = {
21+
pluginSlots: {
22+
course_recommendations_slot: {
23+
plugins: [
24+
{
25+
op: PLUGIN_OPERATIONS.Insert,
26+
widget: {
27+
id: 'inserted_direct_plugin',
28+
type: DIRECT_PLUGIN,
29+
priority: 10,
30+
RenderWidget: () => (<div >👍</div>),
31+
},
32+
},
33+
]
34+
},
35+
},
36+
}
37+
38+
export default config;
39+
```
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import PropTypes from 'prop-types';
2+
import { PluginSlot } from '@openedx/frontend-plugin-framework';
3+
import CourseRecommendations from '../../courseware/course/course-exit/CourseRecommendations';
4+
5+
const CourseRecommendationsSlot = ({ variant }) => (
6+
<PluginSlot id="course_recommendations_slot">
7+
<CourseRecommendations variant={variant} />
8+
</PluginSlot>
9+
);
10+
11+
CourseRecommendationsSlot.propTypes = {
12+
variant: PropTypes.string.isRequired,
13+
};
14+
15+
export default CourseRecommendationsSlot;
120 KB
Loading

0 commit comments

Comments
 (0)