Skip to content

feat: Info Sidebar menus [FC-0123]#2937

Merged
ChrisChV merged 18 commits intoopenedx:masterfrom
open-craft:chris/FAL-4337-sidebar-menus
Apr 13, 2026
Merged

feat: Info Sidebar menus [FC-0123]#2937
ChrisChV merged 18 commits intoopenedx:masterfrom
open-craft:chris/FAL-4337-sidebar-menus

Conversation

@ChrisChV
Copy link
Copy Markdown
Contributor

@ChrisChV ChrisChV commented Mar 10, 2026

Description

  • Add menus in the info sidebar for:
    • Section
    • Subsection
    • Unit in the course outline
    • Unit in the unit page
    • Components in the unit page
  • Which user roles will this change impact? "Course Author".
image image

Supporting information

Testing instructions

  • In the course outline, create a Section > Subsection > Unit > Some components.
  • In the course outline, add a Section, Subsection, Unit, and some components from a content library.
  • In the course outline, click in the Section Card to open the Section Info Sidebar.
  • Test the Menus: Duplicate, Move Up, Move Down, Delete.
  • In the Section from the library test the menus: View in Library, Unlink from library.
  • In the course outline, click in the Subsection Card to open the Subsection Info Sidebar.
  • Test the Menus: Duplicate, Move Up, Move Down, Delete.
  • In the Subsection from the library test the menus: View in Library, Unlink from library.
  • In the course outline, click in the Unit Card to open the Unit Info Sidebar.
  • Test the Menus: Duplicate, Copy to Clipboard, Copy Location Id, Move Up, Move Down, Delete.
  • In the Unit from the library test the menus: View in Library, Unlink from library.
  • In the unit page, test the Menus in the unit sidebar info: Copy to Clipboard, Copy Location id, Delete.
  • Open the unit page for the unit from library, test the menus: View in Library, Unlink from library
  • Click in a component to open the component sidebar, test the menus: Duplicate, Copy to Clipboard, Move, Delete.
  • Click in a component from library, test the menus: View in Library, Unlink from library.

Other information

N/A

Best Practices Checklist

We're trying to move away from some deprecated patterns in this codebase. Please
check if your PR meets these recommendations before asking for a review:

  • Any new files are using TypeScript (.ts, .tsx).
  • Avoid propTypes and defaultProps in any new or modified code.
  • Tests should use the helpers in src/testUtils.tsx (specifically initializeMocks)
  • Do not add new fields to the Redux state/store. Use React Context to share state among multiple components.
  • Use React Query to load data from REST APIs. See any apiHooks.ts in this repo for examples.
  • All new i18n messages in messages.ts files have a description for translators to use.
  • Avoid using ../ in import paths. To import from parent folders, use @src, e.g. import { initializeMocks } from '@src/testUtils'; instead of from '../../../../testUtils'

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

openedx-webhooks commented Mar 10, 2026

Thanks for the pull request, @ChrisChV!

This repository is currently maintained by @bradenmacdonald.

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.

@ChrisChV ChrisChV marked this pull request as draft March 10, 2026 22:04
@github-project-automation github-project-automation Bot moved this to Needs Triage in Contributions Mar 10, 2026
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Mar 11, 2026
@ChrisChV ChrisChV changed the title feat: Sidebar menus feat: Info Sidebar menus Mar 12, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 12, 2026

Codecov Report

❌ Patch coverage is 96.55172% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.59%. Comparing base (806135e) to head (13f3b2f).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
src/course-outline/CourseOutlineContext.tsx 95.74% 4 Missing ⚠️
...it/unit-sidebar/unit-info/ComponentInfoSidebar.tsx 95.38% 3 Missing ⚠️
...se-unit/unit-sidebar/unit-info/UnitInfoSidebar.tsx 94.33% 3 Missing ⚠️
src/library-authoring/history-log/HistoryLog.tsx 0.00% 3 Missing ⚠️
...e/outline-sidebar/info-sidebar/UnitInfoSidebar.tsx 96.82% 2 Missing ⚠️
src/course-unit/xblock-container-iframe/index.tsx 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2937      +/-   ##
==========================================
+ Coverage   95.57%   95.59%   +0.01%     
==========================================
  Files        1375     1379       +4     
  Lines       31954    32278     +324     
  Branches     7280     7405     +125     
==========================================
+ Hits        30540    30856     +316     
- Misses       1350     1358       +8     
  Partials       64       64              

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

@ChrisChV ChrisChV marked this pull request as ready for review March 12, 2026 22:12
@ChrisChV ChrisChV changed the title feat: Info Sidebar menus feat: Info Sidebar menus [FC-123] Mar 12, 2026
@ChrisChV ChrisChV changed the title feat: Info Sidebar menus [FC-123] feat: Info Sidebar menus [FC-0123] Mar 12, 2026
@ChrisChV ChrisChV force-pushed the chris/FAL-4337-sidebar-menus branch from 7d68b07 to a143306 Compare March 16, 2026 18:51
@ChrisChV ChrisChV force-pushed the chris/FAL-4337-sidebar-menus branch from a143306 to 3e4bcac Compare March 16, 2026 23:01
Copy link
Copy Markdown
Contributor

@navinkarkera navinkarkera left a comment

Choose a reason for hiding this comment

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

@ChrisChV Left some comments.

The menu options in the sidebar are not considering library links while showing duplicate, move, delete etc. options. Author should not be able to perform these actions if the parent item is linked to a library. You can refer to components menu items to determine the disabled options.

Image Image

We have same issue in component sidebar menu in unit page as well.

Comment thread src/course-outline/outline-sidebar/OutlineSidebarContext.tsx Outdated
Comment thread src/CourseAuthoringContext.tsx Outdated
Comment on lines +114 to +116
useEffect(() => {
dispatch(fetchCourseOutlineIndexQuery(courseId));
}, [courseId]);
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.

Is this required? We have the same in hooks.jsx

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.

Yes, it makes more sense to put it there, since that's where the sections are being saved. I've removed the duplicate.

Comment thread src/course-outline/hooks.jsx
Comment on lines +69 to +74
const sectionIndex = selectedContainerState?.sectionIndex;
const section = sectionIndex !== undefined ? sections[sectionIndex] : undefined;
const subsectionIndex = section && selectedContainerState?.subsectionId
? section.childInfo.children.findIndex((s) => s.id === selectedContainerState.subsectionId)
: -1;
const subsection = subsectionIndex !== -1 ? section?.childInfo.children[subsectionIndex] : undefined;
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.

Do we need to store sectionIndex in the selectedContainerState context? Like you are getting subsectionIndex, you can also fetch sectionIndex and unitIndex no?

Also, I would just use useCourseItemData to get element data instead of using index.

For example, line 78 can be replaced with

  const { data: section } = useCourseItemData(selectedContainerState?.sectionId);

This will be helpful while replacing redux with react query and the data will be up to date.

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.

Updated: 5b3a68e

@ChrisChV
Copy link
Copy Markdown
Contributor Author

ChrisChV commented Apr 3, 2026

The menu options in the sidebar are not considering library links while showing duplicate, move, delete etc. options. Author should not be able to perform these actions if the parent item is linked to a library. You can refer to components menu items to determine the disabled options.

Thanks! Updated in a2583bc

@ChrisChV ChrisChV requested a review from navinkarkera April 3, 2026 00:06
Copy link
Copy Markdown
Contributor

@navinkarkera navinkarkera left a comment

Choose a reason for hiding this comment

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

@ChrisChV Thanks! Looks good.

👍

  • I tested this: (Verified menu items in sidebar)
  • I read through the code
  • I checked for accessibility issues
  • Includes documentation

@mphilbrick211 mphilbrick211 added the FC Relates to an Axim Funded Contribution project label Apr 6, 2026
@mphilbrick211 mphilbrick211 moved this from Waiting on Author to In Eng Review in Contributions Apr 6, 2026
@ChrisChV ChrisChV requested a review from bradenmacdonald April 6, 2026 22:13
Comment thread src/course-outline/drag-helper/utils.ts
Comment thread src/generic/sidebar/InfoSidebarMenu.tsx Outdated
Comment on lines +144 to +151
// Fallback for HTTP (non-secure) dev environments
// Note: execCommand is deprecated but still widely supported as fallback
const textarea = document.createElement('textarea');
textarea.value = locationId;
document.body.appendChild(textarea);
textarea.select();
document.execCommand('copy'); // eslint-disable-line deprecation/deprecation
document.body.removeChild(textarea);
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.

Oh nice. We should put this on the Files & Uploads page sometime too: #2463

Comment thread src/course-unit/unit-sidebar/unit-info/ComponentInfoSidebar.tsx Outdated
Comment thread src/course-unit/unit-sidebar/unit-info/UnitInfoSidebar.tsx Outdated
Comment thread src/course-unit/unit-sidebar/unit-info/UnitInfoSidebar.tsx Outdated
Comment thread src/CourseAuthoringContext.tsx Outdated
Comment on lines +49 to +65
sections: XBlock[];
restoreSectionList: () => void;
setSections: React.Dispatch<React.SetStateAction<XBlock[]>>;
isDuplicatingItem: boolean;
isDeleteModalOpen: boolean;
openDeleteModal: () => void;
closeDeleteModal: () => void;
getHandleDeleteItemSubmit: (callback: () => void) => () => Promise<void>;
handleDuplicateSectionSubmit: () => void;
handleDuplicateSubsectionSubmit: () => void;
handleDuplicateUnitSubmit: () => void;
handleSectionDragAndDrop: (sectionListIds: string[]) => void;
handleSubsectionDragAndDrop: (sectionId: string, prevSectionId: string, subsectionListIds: string[]) => void;
handleUnitDragAndDrop: (sectionId: string, prevSectionId: string, subsectionId: string, unitListIds: string[]) => void;
updateSectionOrderByIndex: (currentIndex: number, newIndex: number) => void;
updateSubsectionOrderByIndex: (section: XBlock, moveDetails: any) => void;
updateUnitOrderByIndex: (section: XBlock, moveDetails: any) => void;
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 context is getting very big, and many of these new additions do not seem relevant to most course pages like advanced settings, files & uploads, unit content, sync updates, etc.

What do you think about moving some of these to a separate CourseOutlineContext that's only for the course outline page?

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.

Done. I refactored the code in 5b332b2

Comment thread src/CourseAuthoringContext.tsx Outdated
@ChrisChV
Copy link
Copy Markdown
Contributor Author

ChrisChV commented Apr 7, 2026

@bradenmacdonald It's ready for another review. @navinkarkera, I made a refactor in the code, so it needs another round of UI testing

@bradenmacdonald
Copy link
Copy Markdown
Contributor

@ChrisChV Thanks for those refactors! And sorry for the reviewing delay here.

While testing, I noticed a weird bug. But I think you can fix it after the merge, as it's not a big deal.
When I "move down" a subsection, one of the units that I duplicated earlier in the other subsection gets highlighted for a couple seconds as if it is newly created.

Weird.bug.mov

Copy link
Copy Markdown
Contributor

@bradenmacdonald bradenmacdonald left a comment

Choose a reason for hiding this comment

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

LGTM! I noticed some minor things when testing which I mentioned on #2790 as well as the comment above ^. But they don't need to block the merge.

@ChrisChV ChrisChV merged commit 199823a into openedx:master Apr 13, 2026
7 checks passed
@github-project-automation github-project-automation Bot moved this from In Eng Review to Done in Contributions Apr 13, 2026
@ChrisChV ChrisChV deleted the chris/FAL-4337-sidebar-menus branch April 13, 2026 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FC Relates to an Axim Funded Contribution project open-source-contribution PR author is not from Axim or 2U

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants