Skip to content

feat: Course outline restructure with new plugin slots#1920

Open
xitij2000 wants to merge 3 commits into
openedx:masterfrom
open-craft:kshitij/course-outline-refactor-and-slots
Open

feat: Course outline restructure with new plugin slots#1920
xitij2000 wants to merge 3 commits into
openedx:masterfrom
open-craft:kshitij/course-outline-refactor-and-slots

Conversation

@xitij2000

Copy link
Copy Markdown
Contributor

Splits useCourseOutlineSidebar into useCourseOutlineData + useCourseOutlineSidebar, adds CourseOutlineSidebarHeadingSlot, CourseOutlineSidebarSectionCompletionIconSlot, and CourseOutlineSidebarSequenceCompletionIconSlot, and introduces CSS variables for theming the sidebar.

@openedx-webhooks openedx-webhooks added open-source-contribution PR author is not from Axim or 2U core contributor PR author is a Core Contributor (who may or may not have write access to this repo). labels May 27, 2026
@openedx-webhooks

Copy link
Copy Markdown

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.

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

@github-project-automation github-project-automation Bot moved this to Needs Triage in Contributions May 27, 2026
@xitij2000 xitij2000 force-pushed the kshitij/course-outline-refactor-and-slots branch from 44ec042 to cd853d0 Compare May 27, 2026 10:22
@xitij2000 xitij2000 changed the title refactor: Course outline restructure with new plugin slots and CSS variables refactor: Course outline restructure with new plugin slots May 27, 2026
@xitij2000 xitij2000 changed the title refactor: Course outline restructure with new plugin slots feat: Course outline restructure with new plugin slots May 27, 2026
@codecov

codecov Bot commented May 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.39%. Comparing base (cfc91c3) to head (dc917eb).
⚠️ Report is 9 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1920      +/-   ##
==========================================
+ Coverage   91.30%   91.39%   +0.08%     
==========================================
  Files         344      351       +7     
  Lines        5774     5844      +70     
  Branches     1351     1394      +43     
==========================================
+ Hits         5272     5341      +69     
- Misses        483      484       +1     
  Partials       19       19              

☔ View full report in Codecov by Harness.
📢 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 moved this from Needs Triage to Ready for Review in Contributions Jun 3, 2026
@itsjeyd itsjeyd added the waiting for eng review PR is ready for review. Review and merge it, or suggest changes. label Jun 3, 2026
@itsjeyd itsjeyd requested review from a team and brian-smith-tcril June 9, 2026 13:49
@xitij2000

Copy link
Copy Markdown
Contributor Author

@brian-smith-tcril Did you get a chance to look at this PR?

@brian-smith-tcril

Copy link
Copy Markdown
Contributor

@brian-smith-tcril Did you get a chance to look at this PR?

Not quite yet. I've been focused on a release testing bug fix. I definitely haven't forgotten about it and it's still high on my todo list.

@brian-smith-tcril brian-smith-tcril left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall these extension points seem like good ones to add. Looking forward to continuing to discuss these changes and finding a good path for them to land!

const intl = useIntl();
return (
<div
className="outline-sidebar-heading-wrapper sticky d-flex justify-content-between align-self-start align-items-center p-2.5 pl-4"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This doesn't match the classes that existed in the sidebarHeading const in CourseOutlineTray.jsx. Could you explain why the removed classes are being removed? Adding a suggestion here for putting the old classes back just to make it easy to see what changed:

Suggested change
className="outline-sidebar-heading-wrapper sticky d-flex justify-content-between align-self-start align-items-center p-2.5 pl-4"
className="outline-sidebar-heading-wrapper sticky d-flex justify-content-between align-self-start align-items-center bg-light-200 p-2.5 pl-4"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I had moved these to the SCSS file applied to the outline-sidebar-heading-wrapper class but it seems during the subsequent changes to SCSS and rebasing those changes got accidentally removed. It was to make this easier to theme since bg-light-200 applies a !important. Likewise for the other removed classes.

Is that an acceptable change to make or should I revert these changes?

<Button
variant="link"
iconBefore={ChevronLeftIcon}
className="outline-sidebar-heading p-0 mb-0 text-left"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This doesn't match the classes that existed in the sidebarHeading const in CourseOutlineTray.jsx. Could you explain why the removed classes are being removed? Adding a suggestion here for putting the old classes back just to make it easy to see what changed:

Suggested change
className="outline-sidebar-heading p-0 mb-0 text-left"
className="outline-sidebar-heading p-0 mb-0 text-left text-dark-500"

{title}
</Button>
) : (
<span className="outline-sidebar-heading mb-0 h4">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This doesn't match the classes that existed in the sidebarHeading const in CourseOutlineTray.jsx. Could you explain why the removed classes are being removed? Adding a suggestion here for putting the old classes back just to make it easy to see what changed:

Suggested change
<span className="outline-sidebar-heading mb-0 h4">
<span className="outline-sidebar-heading mb-0 h4 text-dark-500">

{onToggleCollapse && (
<IconButton
alt={intl.formatMessage(messages.toggleCourseOutlineTrigger)}
className="outline-sidebar-toggle-btn flex-shrink-0 text-dark"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This doesn't match the classes that existed in the sidebarHeading const in CourseOutlineTray.jsx. Could you explain why the removed classes are being removed? Adding a suggestion here for putting the old classes back just to make it easy to see what changed:

Suggested change
className="outline-sidebar-toggle-btn flex-shrink-0 text-dark"
className="outline-sidebar-toggle-btn flex-shrink-0 text-dark bg-light-200"

);

return (
<li className="mb-2 course-sidebar-section">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Curious about the mb-2 removal here

<CourseOverviewSequenceCompletionIconSlot
completionStat={completionStat}
enabled={isEnabledCompletionTracking}
active={isActiveSequence}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same comment as https://github.com/openedx/frontend-app-learning/pull/1920/changes#r3419773864

This isn't used by the default content (the CompletionIcon component) or any examples in the slot README. I think this should either be removed, or a slot README example showing why this is needed should be added.


return (
<li className={classNames({ 'bg-info-100': isActive, 'border-top border-light': !isFirst })}>
<li className={classNames({ 'active-unit bg-info-100': isActive, 'border-top border-light': !isFirst })}>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

active-unit doesn't appear to exist.

Comment on lines +35 to +41
const handleClick = React.useCallback(() => {
// Hide the sidebar after selecting a unit on a mobile device.
if (shouldDisplayFullScreen) {
handleToggleCollapse();
}
handleUnitClick({ sequenceId, activeUnitId, id });
}, [handleUnitClick, sequenceId, activeUnitId, id]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This might not be needed after #1923 lands, worth double checking once that's in.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This seems very similar to the sequence icon slot. I'm wondering if having 1 slot to handle both makes more sense. Doing that would mean plugin authors that want to have different components based on sequence vs section would likely need a prop, but that feels lighter than having 2 different slots.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I agree, I think I can consolidate this and use a prop to select where the icon rendered since I think in most cases people can ignore that prop and render the same component.

Splits `useCourseOutlineSidebar` into `useCourseOutlineData` and `useCourseOutlineSidebar` for improved separation of responsibilities. Updates components and styles to reflect this change.

This change allows the usage of the course outline outside of a sidebar context.
…ce completion icons

Introduces `CourseOutlineSidebarSectionCompletionIconSlot` and `CourseOutlineSidebarSequenceCompletionIconSlot` to enable customization, modification, or replacement of completion icons in the course outline. Updated components to integrate with these new slots.
@xitij2000

Copy link
Copy Markdown
Contributor Author

@brian-smith-tcril

Just giving context on some of the issues:

  • I removed some of the padding, and colors classes so that themes can more easily override those. Unfortunately I had move them to the CSS file but those changes are lost. I can reimplement it, or revert to the original classes if what I'm planning is unacceptable.
  • I've added active-unit and active-section to allow themes to override these styles even if the default theme doesn't do it or does it by simply applying a class.

I tried splitting this PR into two parts, however there were quite a few dependencies between the commits so it wasn't as easy a split as I hoped. I'll apply the other fixes first.

… fields with a `backButton` object

Consolidates `isSequenceLevel`, `title`, and `onClickBack` into a single `backButton` object in `CourseOutlineHeading`. Refactors the related logic and updates calling components to align with this change.
@xitij2000 xitij2000 force-pushed the kshitij/course-outline-refactor-and-slots branch from dc917eb to d627014 Compare June 17, 2026 13:53
@brian-smith-tcril

Copy link
Copy Markdown
Contributor

I removed some of the padding, and colors classes so that themes can more easily override those. Unfortunately I had move them to the CSS file but those changes are lost. I can reimplement it, or revert to the original classes if what I'm planning is unacceptable.

I'm open to discussing those changes, but I'd like to keep this PR focused on adding the plugin slots. By keeping the PR focused we won't have changes blocking each other from landing.

I've added active-unit and active-section to allow themes to override these styles even if the default theme doesn't do it or does it by simply applying a class.

That's probably fine, but I'd still prefer to have this as a "just adding slots" PR.

I tried splitting this PR into two parts, however there were quite a few dependencies between the commits so it wasn't as easy a split as I hoped. I'll apply the other fixes first.

I'm sorry about that. I know it can be frustrating to split things up, but I think the benefits of focused PRs are very real.

@xitij2000

Copy link
Copy Markdown
Contributor Author

@brian-smith-tcril I've split out the slots into this PR: #1933

A test is failing locally so I still have work to do, but I'll rebase this PR once that one is merged.

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 waiting for eng review PR is ready for review. Review and merge it, or suggest changes.

Projects

Status: Ready for Review

Development

Successfully merging this pull request may close these issues.

4 participants