Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add course end dashboard plugin slots #1658

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

jansenk
Copy link
Contributor

@jansenk jansenk commented Mar 26, 2025

Add plugin slots to allow control of course end dashboard links

Copy link

codecov bot commented Mar 26, 2025

Codecov Report

Attention: Patch coverage is 95.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 90.11%. Comparing base (d5a092b) to head (8a62a38).

Files with missing lines Patch % Lines
...ourseware/course/course-exit/CourseCelebration.jsx 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1658      +/-   ##
==========================================
+ Coverage   90.09%   90.11%   +0.02%     
==========================================
  Files         338      340       +2     
  Lines        5784     5796      +12     
  Branches     1370     1371       +1     
==========================================
+ Hits         5211     5223      +12     
  Misses        557      557              
  Partials       16       16              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines 27 to 31
const CourseExitViewCoursesPluginSlot = ({ href }) => (
<PluginSlot id="course_exit_view_courses_slot">
<ViewCoursesLink content={{ href }} />
</PluginSlot>
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const CourseExitViewCoursesPluginSlot = ({ href }) => (
<PluginSlot id="course_exit_view_courses_slot">
<ViewCoursesLink content={{ href }} />
</PluginSlot>
);
const CourseExitViewCoursesPluginSlot = () => {
const href = `${getConfig().LMS_BASE_URL}/dashboard`;
return (
<PluginSlot id="course_exit_view_courses_slot">
<ViewCoursesLink content={{ href }} />
</PluginSlot>
);
};

{intl.formatMessage(messages.viewCoursesButton)}
</Button>
</div>
<CourseExitViewCoursesPluginSlot href={`${getConfig().LMS_BASE_URL}/dashboard`} />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<CourseExitViewCoursesPluginSlot href={`${getConfig().LMS_BASE_URL}/dashboard`} />
<CourseExitViewCoursesPluginSlot />

See comment on plugin file

const { courseId } = useSelector(state => state.courseware);
const { org } = useModel('courseHomeMeta', courseId);
const { administrator } = getAuthenticatedUser();

const dashboardLink = (
<Hyperlink
style={{ textDecoration: 'underline' }}
destination={`${getConfig().LMS_BASE_URL}/dashboard`}
destination={content?.dashboardFootnoteUrl || `${getConfig().LMS_BASE_URL}/dashboard`}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this conditional necessary? In the default version, you always pass in a url so it should always be defined.


CourseExitViewCoursesPluginSlot.propTypes = {};

export default CourseExitViewCoursesPluginSlot;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't need to block this PR if you didn't know, but: whenever creating new files in this repo or any MFE repo, please:

  1. Use TypeScript .tsx instead of .jsx
  2. Use TypeScript types instead of propTypes - propTypes have been deprecated for 8 years!

You also don't need to use default exports anymore, but you can if you want to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants