Skip to content

feat: Add slots to add tab links and add mechanism for plugin routes #1645

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xitij2000
Copy link
Contributor

@xitij2000 xitij2000 commented Mar 21, 2025

Description

This PR adds mechanisms to add course tabs using a frontend plugin.

It includes two plugin slots:

  • course_tab_links_slot: This slot allows adding additional course tabs or modifying existing course tabs.
  • course_page_route_slot: This slot allows create a full new page in the learning MFE.

It also adds a new mechanism to add course routes using the PLUGIN_ROUTES config. This is a simple array that adds new routes for the MFE that can then be handled by plugins.

The combination of the above will allow injecting a new course tab by:

  • Adding a new route to the PLUGIN_ROUTES array.
  • Adding a slot to the course page route slot so that the page is rendered on that route
  • Adding a new link to the course_tab_links_slot.

It is also possible to add the links anywhere else, to simply add new pages that are not tabs.

Other Information

Currently there is a single plugin slot for all pages and each plugin would need to check if the route matches and render itself. Another alternative is for the plugin routes to be a mapping of plugin name to the route, and the plugin name can be added to the slot ID. For example:

PLUGIN_ROUTES = {
  tab1: "/course/:courseId/tab1",
  tab2: "/course/:courseId/tab2",
};

<PluginSlot id={`${pluginName}_page_route_slot`} ... />

This would create slots like: tab1_page_route_slot and tab2_page_route_slot etc.

Or, it can just use the route itself in the slot name. While this will result in clumsy names like: "/course/:courseId/tab1_page_route_slot" there is not reason why that shouldn't work.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Mar 21, 2025
@openedx-webhooks
Copy link

Thanks for the pull request, @xitij2000!

This repository is currently maintained by @openedx/committers-frontend-app-learning.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

🔘 Update the status of your PR

Your PR is currently marked as a draft. After completing the steps above, update its status by clicking "Ready for Review", or removing "WIP" from the title, as appropriate.


Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

Copy link

codecov bot commented Mar 21, 2025

Codecov Report

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

Project coverage is 90.09%. Comparing base (f39a50e) to head (8956242).
Report is 8 commits behind head on master.

Files with missing lines Patch % Lines
src/index.jsx 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1645   +/-   ##
=======================================
  Coverage   90.08%   90.09%           
=======================================
  Files         338      338           
  Lines        5782     5793   +11     
  Branches     1410     1372   -38     
=======================================
+ Hits         5209     5219   +10     
- Misses        556      558    +2     
+ Partials       17       16    -1     

☔ 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.

@itsjeyd itsjeyd added the core contributor PR author is a Core Contributor (who may or may not have write access to this repo). label Apr 1, 2025
@itsjeyd itsjeyd moved this from Needs Triage to Waiting on Author in Contributions Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core contributor PR author is a Core Contributor (who may or may not have write access to this repo). open-source-contribution PR author is not from Axim or 2U
Projects
Status: Waiting on Author
Development

Successfully merging this pull request may close these issues.

3 participants