feat: add plugin slot for course end course recommendations (#1618)

This commit is contained in:
Jansen Kantor
2025-03-04 15:12:53 -05:00
committed by GitHub
parent 06e5fb5a44
commit 0ac127e4c9
4 changed files with 56 additions and 2 deletions

View File

@@ -32,7 +32,7 @@ import UpgradeFootnote from './UpgradeFootnote';
import SocialIcons from '../../social-share/SocialIcons';
import { logClick, logVisit } from './utils';
import { DashboardLink, IdVerificationSupportLink, ProfileLink } from '../../../shared/links';
import CourseRecommendations from './CourseRecommendations';
import CourseRecommendationsSlot from '../../../plugin-slots/CourseRecommendationsSlot';
const LINKEDIN_BLUE = '#2867B2';
@@ -357,7 +357,7 @@ const CourseCelebration = ({ intl }) => {
/>
))}
{footnote}
<CourseRecommendations variant={visitEvent} />
<CourseRecommendationsSlot variant={visitEvent} />
</div>
</div>
</>

View File

@@ -0,0 +1,39 @@
# Unit Title Slot
### Slot ID: `course_recommendations_slot`
### Props:
* `variant`
## Description
This slot is used for modifying the course end recommendation
## Example
The following `env.config.jsx` will replace the course recommendations with a thumbs up
![Screenshot of modified course celebration](./screenshot_custom.png)
```js
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
const config = {
pluginSlots: {
course_recommendations_slot: {
plugins: [
{
op: PLUGIN_OPERATIONS.Insert,
widget: {
id: 'inserted_direct_plugin',
type: DIRECT_PLUGIN,
priority: 10,
RenderWidget: () => (<div >👍</div>),
},
},
]
},
},
}
export default config;
```

View File

@@ -0,0 +1,15 @@
import PropTypes from 'prop-types';
import { PluginSlot } from '@openedx/frontend-plugin-framework';
import CourseRecommendations from '../../courseware/course/course-exit/CourseRecommendations';
const CourseRecommendationsSlot = ({ variant }) => (
<PluginSlot id="course_recommendations_slot">
<CourseRecommendations variant={variant} />
</PluginSlot>
);
CourseRecommendationsSlot.propTypes = {
variant: PropTypes.string.isRequired,
};
export default CourseRecommendationsSlot;

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB