-
Notifications
You must be signed in to change notification settings - Fork 178
feat: Add sidebar and library dropdown filter [FC-0114] #2778
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 sidebar and library dropdown filter [FC-0114] #2778
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. 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 #2778 +/- ##
==========================================
+ Coverage 94.99% 95.04% +0.05%
==========================================
Files 1256 1264 +8
Lines 28800 29123 +323
Branches 6538 6648 +110
==========================================
+ Hits 27358 27681 +323
+ Misses 1384 1372 -12
- Partials 58 70 +12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
rpenido
left a comment
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
| await waitFor(() => expect(mockApi).toHaveBeenLastCalledWith({ | ||
| pagination: false, | ||
| search: 'Test Library', | ||
| }), { timeout: 600 }); |
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.
Out of curiosity: why do we need this timeout here?
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.
368ada5 to
469e469
Compare
bradenmacdonald
left a comment
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.
Thanks for those changes!
638c09c to
07773d1
Compare
rpenido
left a comment
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.
Thank you for your work, @navinkarkera! Kudos for the great refactor here
I left some comments (optional) and a minor bug that I found.
| openComponentEditor('', (data) => data && linkComponent(data.id), blockType); | ||
| } else { | ||
| openComponentEditor?.('', (data) => data && linkComponent(data.id), blockType); | ||
| } else if (libraryId) { |
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.
libraryId should always be defined here. The type inference is not getting it?
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.
@rpenido We were using useOptionalLibraryContext(), so libraryId could be undefined. But I tested now with normal useLibraryContext and it seems to be working fine without errors as the AddContent component is not displayed anywhere via ComponentPicker.
| overflow-y: auto; | ||
| min-height: 100vh; | ||
| height: 100%; | ||
| max-height: 300vh; |
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.
Do we need this to solve any specific issue?
Couldn't we let the sidebar take all the height?
| max-height: 300vh; |
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, if we have a lot of library content, the sidebar becomes very long. So I limited it to 3 times of viewport with scroll.
|
|
||
| export function useOptionalLibraryContext(): Partial<LibraryContextData> { | ||
| const ctx = useContext(LibraryContext); | ||
| return ctx || {}; |
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.
Nice catch! Thanks!
f710585 to
71a2195
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.
@navinkarkera The code looks good! Very nice work!
|
@navinkarkera @ChrisChV This is causing problems with the sidebar for me.
Also, what's the plan for when the sidebar is at the bottom of the screen? It seems unusable when it's at the very bottom of the outline, and the upper "change sidebar" button doesn't seem to do anything if you can't even see the sidebar. I'm not sure what the point is of making it responsive like this. |




Description
In addition to changes in #2775 (comment), this PR adds following:
Adds library dropdown filter and collections dropdown filter in add sidebar. Allows authors to filter containers by selected libraries and collections.
Useful information to include:
Screenshots
Supporting information
Addbutton Flow) #2629Private-ref: https://tasks.opencraft.com/browse/FAL-4298Testing instructions
Other information
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'