-
Notifications
You must be signed in to change notification settings - Fork 119
feat: create section and subsection in library #2013
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
base: master
Are you sure you want to change the base?
feat: create section and subsection in library #2013
Conversation
Thanks for the pull request, @navinkarkera! 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. 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:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2013 +/- ##
==========================================
- Coverage 93.96% 93.95% -0.01%
==========================================
Files 1155 1155
Lines 24128 24169 +41
Branches 5115 5242 +127
==========================================
+ Hits 22671 22709 +38
+ Misses 1389 1383 -6
- Partials 68 77 +9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
c5cf00a
to
54ada1b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Thank you for your work, @navinkarkera!
- I tested this using the instructions from the PR
- I read through the code
- I checked for accessibility issues
- Includes documentation
I just added some nits.
Unit = 'unit', | ||
/** | ||
* Vertical is the old name for Unit. Generally, **please avoid using this term entirely in any libraries code** or | ||
* Chapter, Sequential and Vertical is the old name for Unit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit
* Chapter, Sequential and Vertical is the old name for Unit. | |
* Chapter, Sequential and Vertical are the old names for Section, Subsection and Unit. |
const unitId = 'lct:orf1:lib1:unit:test-1'; | ||
renderWithUnit(unitId); | ||
|
||
expect(await screen.findByRole('button', { name: 'Text' })).toBeInTheDocument(); | ||
screen.debug(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
screen.debug(); |
createUnitModalNamePlaceholder: { | ||
id: 'course-authoring.library-authoring.modals.create-unit.form.name.placeholder', | ||
defaultMessage: 'Give a descriptive title', | ||
description: 'Placeholder of the Name field of the Create Unit modal form', | ||
}, | ||
createSubsectionModalNamePlaceholder: { | ||
id: 'course-authoring.library-authoring.modals.create-subsection.form.name.placeholder', | ||
defaultMessage: 'Give a descriptive title', | ||
description: 'Placeholder of the Name field of the Create Subsection modal form', | ||
}, | ||
createSectionModalNamePlaceholder: { | ||
id: 'course-authoring.library-authoring.modals.create-section.form.name.placeholder', | ||
defaultMessage: 'Give a descriptive title', | ||
description: 'Placeholder of the Name field of the Create Section modal form', | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about removing the common strings here?
createUnitModalNamePlaceholder: { | |
id: 'course-authoring.library-authoring.modals.create-unit.form.name.placeholder', | |
defaultMessage: 'Give a descriptive title', | |
description: 'Placeholder of the Name field of the Create Unit modal form', | |
}, | |
createSubsectionModalNamePlaceholder: { | |
id: 'course-authoring.library-authoring.modals.create-subsection.form.name.placeholder', | |
defaultMessage: 'Give a descriptive title', | |
description: 'Placeholder of the Name field of the Create Subsection modal form', | |
}, | |
createSectionModalNamePlaceholder: { | |
id: 'course-authoring.library-authoring.modals.create-section.form.name.placeholder', | |
defaultMessage: 'Give a descriptive title', | |
description: 'Placeholder of the Name field of the Create Section modal form', | |
}, | |
createContainerModalNamePlaceholder: { | |
id: 'course-authoring.library-authoring.modals.create-container.form.name.placeholder', | |
defaultMessage: 'Give a descriptive title', | |
description: 'Placeholder of the Name field of the Create Container modal form', | |
}, |
if (insideSection) { | ||
// Should only allow adding subsections | ||
return [subsectionButtonData]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To fix coverage and not let us forget it later:
if (insideSection) { | |
// Should only allow adding subsections | |
return [subsectionButtonData]; | |
// istanbul ignore if: not implemented | |
if (insideSection) { | |
// Should only allow adding subsections | |
throw new Error('Not implemented'); | |
// return [subsectionButtonData]; |
if (insideSubsection) { | ||
// Should only allow adding units | ||
return [unitButtonData]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
if (insideSubsection) { | |
// Should only allow adding units | |
return [unitButtonData]; | |
// istanbul ignore if: not implemented | |
if (insideSubsection) { | |
// Should only allow adding units | |
throw new Error('Not implemented'); | |
// return [unitButtonData]; |
return ( | ||
<> | ||
{(collectionId || unitId) && componentPicker && ( | ||
{visibleContentTypes.map((contentType) => ( | ||
<AddContentButton contentType={contentType} onCreateContent={onCreateContent} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: missing key
<AddContentButton contentType={contentType} onCreateContent={onCreateContent} /> | |
<AddContentButton key={contentType} contentType={contentType} onCreateContent={onCreateContent} /> |
Nice refactor, btw! 👍
Description
Adds create section and subsection buttons in sidebar.
Useful information to include:
Supporting information
Private-ref
: https://tasks.opencraft.com/browse/FAL-4170Testing instructions
New
button in library authoring page.Other information
Include anything else that will help reviewers and consumers understand the change.