feat: Info Sidebar menus [FC-0123]#2937
Conversation
|
Thanks for the pull request, @ChrisChV! 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. |
Codecov Report❌ Patch coverage is 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. 🚀 New features to boost your workflow:
|
7d68b07 to
a143306
Compare
a143306 to
3e4bcac
Compare
There was a problem hiding this comment.
@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.
We have same issue in component sidebar menu in unit page as well.
| useEffect(() => { | ||
| dispatch(fetchCourseOutlineIndexQuery(courseId)); | ||
| }, [courseId]); |
There was a problem hiding this comment.
Is this required? We have the same in hooks.jsx
There was a problem hiding this comment.
Yes, it makes more sense to put it there, since that's where the sections are being saved. I've removed the duplicate.
| 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; |
There was a problem hiding this comment.
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.
Thanks! Updated in a2583bc |
navinkarkera
left a comment
There was a problem hiding this comment.
@ChrisChV Thanks! Looks good.
👍
- I tested this: (Verified menu items in sidebar)
- I read through the code
- I checked for accessibility issues
- Includes documentation
| // 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); |
There was a problem hiding this comment.
Oh nice. We should put this on the Files & Uploads page sometime too: #2463
| 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; |
There was a problem hiding this comment.
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?
|
@bradenmacdonald It's ready for another review. @navinkarkera, I made a refactor in the code, so it needs another round of UI testing |
|
@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. Weird.bug.mov |
bradenmacdonald
left a comment
There was a problem hiding this comment.
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.
Description
Supporting information
Testing instructions
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:
.ts,.tsx).propTypesanddefaultPropsin any new or modified code.src/testUtils.tsx(specificallyinitializeMocks)apiHooks.tsin this repo for examples.messages.tsfiles have adescriptionfor translators to use.../in import paths. To import from parent folders, use@src, e.g.import { initializeMocks } from '@src/testUtils';instead offrom '../../../../testUtils'