-
Notifications
You must be signed in to change notification settings - Fork 80
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
feat: add library component picker #1356
feat: add library component picker #1356
Conversation
Thanks for the pull request, @rpenido! What's next?Please work through the following steps to get your changes 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. 🔘 Let us know that your PR is ready for review:Who will review my changes?This repository is currently maintained by 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. |
adb7247
to
785a830
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1356 +/- ##
==========================================
+ Coverage 93.04% 93.09% +0.05%
==========================================
Files 1043 1047 +4
Lines 19954 20128 +174
Branches 4155 4266 +111
==========================================
+ Hits 18566 18738 +172
+ Misses 1326 1325 -1
- Partials 62 65 +3 ☔ View full report in Codecov by Sentry. |
5b8042d
to
5c2842a
Compare
<Routes> | ||
<Route | ||
path={TabList.home} | ||
element={( | ||
<LibraryHome tabList={TabList} handleTabChange={handleTabChange} /> | ||
)} | ||
/> | ||
<Route | ||
path={TabList.components} | ||
element={<LibraryComponents variant="full" />} | ||
/> | ||
<Route | ||
path={TabList.collections} | ||
element={<LibraryCollections variant="full" />} | ||
/> | ||
<Route | ||
path="*" | ||
element={<NotFoundAlert />} | ||
/> | ||
</Routes> |
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.
We had to change to render based on a state instead of the route because of the ComponentPicker
component
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.
Can you elaborate? Why can't we have nested routes, with three home/components/collections routes underneath /library/foo and the same three home/components/collections routes also available underneath /library-component-picker/ ?
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.
Hmm. You're right. We can. I didn't think this way when I refactored this.
Do you prefer we stick to the routing approach? We will just need to fix some places where we do absolute redirects to '/library/libraryId' to support this.
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.
Well what I really want is to implement #1230 ASAP, which will simplify everything. Then the "All/Collections/Components" tabs will essentially be just another filter. But yeah, I do think it should be in the route if possible.
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.
Though it doesn't need to be in the route for the content picker.
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.
Just to be clear, it is still in the URL path as it was. I'm just using states from the context to render the child components instead of the Router
component.
I will check how far I'm from using Routes
again tomorrow.
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.
Oh ok. Maybe that's not so bad? I'll have a look later.
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.
I think it would be better to fix the Route
issue with #1230. I moved more things to the context here, which will help the refactor a bit.
This PR is "functional".
We will probably want to change the endpoint to add the content, but is it possible to test it? It is missing the Modal tough.
I will post a more detailed update about the task status tomorrow.
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.
This change seems to have broken the Back/Forward button in the browser. Before, you could change tabs and then press BACK and it would return to the previous tab, but now it's not working.
<Routes> | ||
<Route | ||
path="collection/:collectionId" | ||
element={<LibraryCollectionPage />} | ||
/> | ||
<Route | ||
path="*" | ||
element={<LibraryAuthoringPage />} | ||
/> | ||
</Routes> |
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.
We had to change to render based on a state instead of the route because of the ComponentPicker
component
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.
We can keep this as is, don't need to remove the routes. Using match
in line 15 to get collectionId and passing it to LibraryProvider
should be enough.
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.
Great! Fixed here: 1ce80cb
9babe85
to
7e61a2c
Compare
7e61a2c
to
cdfe3d6
Compare
46d7a0d
to
d8f3d7a
Compare
0f0a5d6
to
7ca8f22
Compare
a6ec33d
to
de1be9e
Compare
ef416c9
to
edf787f
Compare
edf787f
to
3a4497b
Compare
@bradenmacdonald Conflicts resolved! |
@rpenido This is minor, but there's no spacing around the "Next" button and it's touching the edge of the browser window. |
@rpenido Also, the "+ Add Collection" button should not appear in this read-only mode. |
@rpenido When we implement #1385 , we're going to have to change a bunch of things with this modal (to support multi-select, and not to add to the course right away - instead just add to a list and pass that list to the Problem Bank). But this is totally fine for now - just making you aware it will need some changes. |
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.
Phew! This is a huge PR. Lots of nice refactors in here. Just a few small issues. If you want to address any of my feedback in a follow-up PR or skip it entirely, let me know.
<Routes> | ||
<Route | ||
path={TabList.home} | ||
element={( | ||
<LibraryHome tabList={TabList} handleTabChange={handleTabChange} /> | ||
)} | ||
/> | ||
<Route | ||
path={TabList.components} | ||
element={<LibraryComponents variant="full" />} | ||
/> | ||
<Route | ||
path={TabList.collections} | ||
element={<LibraryCollections variant="full" />} | ||
/> | ||
<Route | ||
path="*" | ||
element={<NotFoundAlert />} | ||
/> | ||
</Routes> |
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.
This change seems to have broken the Back/Forward button in the browser. Before, you could change tabs and then press BACK and it would return to the previous tab, but now it's not working.
throw new Error('parentLocator is required'); | ||
} | ||
|
||
// URLSearchParams decodes '+' to ' ', so we need to convert it back |
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.
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.
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.
Yes, but there it's in the path part of the URL. Here it's in a query string, and it's definitely wrong to assume that a +
in a query string value will be interpreted as +
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.
It's fine to leave this in; as you said it's not doing any harm. But we should be encoding the ID when we pass it into the query string.
@@ -0,0 +1,3 @@ | |||
.library-list { | |||
min-height: 620px; |
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.
Can this style be removed? When the picker is inset in an iframe, this makes the page longer than it needs to be.
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.
Yes. This was to make the list have the same height while showing less than 5 results.
Removed here: 72f7b85
This should fix it: a31836e |
I think I addressed the issues. Let me know if I missed anything! |
@rpenido What about the spacing around the "Next" button and the need to hide the " + Add Collection" button? Edit: I see they're both fixed now :) |
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.
Looking good now, thanks for this nice work! Let me know when I can merge.
Waiting for the CI/CD. If something fails, I will fix it later today, |
Description
This PR implements the components
Select Library
Pick Component
Additional Information
Part of:
Depends on:
Testing instruction
block-v1:edX+DemoX+Demo_Course+type@vertical+block@vertical1
should be the usageKey of aUnit
Unit
providedPrivate-ref: FAL-3876