feat: Course outline restructure with new plugin slots#1920
Conversation
|
Thanks for the pull request, @xitij2000! This repository is currently maintained by 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 approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo 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:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere 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:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
44ec042 to
cd853d0
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|
@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
left a comment
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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:
| 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" |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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:
| 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"> |
There was a problem hiding this comment.
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:
| <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" |
There was a problem hiding this comment.
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:
| 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"> |
There was a problem hiding this comment.
Curious about the mb-2 removal here
| <CourseOverviewSequenceCompletionIconSlot | ||
| completionStat={completionStat} | ||
| enabled={isEnabledCompletionTracking} | ||
| active={isActiveSequence} |
There was a problem hiding this comment.
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 })}> |
There was a problem hiding this comment.
active-unit doesn't appear to exist.
| 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]); |
There was a problem hiding this comment.
This might not be needed after #1923 lands, worth double checking once that's in.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
|
Just giving context on some of the issues:
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.
dc917eb to
d627014
Compare
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.
That's probably fine, but I'd still prefer to have this as a "just adding slots" PR.
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. |
|
@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. |
Splits
useCourseOutlineSidebarintouseCourseOutlineData+useCourseOutlineSidebar, addsCourseOutlineSidebarHeadingSlot,CourseOutlineSidebarSectionCompletionIconSlot, andCourseOutlineSidebarSequenceCompletionIconSlot, and introduces CSS variables for theming the sidebar.