-
Notifications
You must be signed in to change notification settings - Fork 10
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
543 Refactor of Saved Search Accordion #561
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…r-crasm-545' into 543-refactor-of-saved-search-accordion
- Started working on functions to handle Saved Searches via the checkbox controlled list in the DrawerInterior component.
- Removed useHistory hook from DrawerInterior.tsx - Removed unnecessary imports from DrawerInterior.tsx - Removed history.push to '/Inventory' as search is only inside of Inventory now. - Toggling of saved search Checkbox now handled by toggleSavedSearch function in DrawerInterior.tsx. - filtering by Saved Search handled by displaySavedSearch function in DrawerInterior.tsx. - Restroing search to default handled by revertSearch function in DrawerInterior.tsx.
…r-crasm-545' into 543-refactor-of-saved-search-accordion
…ved-search-accordion
- Created a state based prop for initial filters in Layout.tsx - Passed this prop to FilterDrawerV2.tsx and DrawerInterior.tsx - Created new function restoreInitialFilters that iterates over the initial filters and adds them to the filter context. - revertSearch clears filters and searchTerm then applies restoreInitialFilters. - displaySavedSearch nows clear filters then applies filter from the saved search object. - cleaned up code.
- Remove 'savedSearch' from localStorage on revertSearch. - Built isSavedSearchActive function to check if a saved search is active. - Edited toggleSavedSearch to use isSavedSearchActive. - Checked prop is now based on isSavedSearchActive.
- switched prototype method from .find to .filter in toggleSavedSearch - refactored isSavedSearchActive to parse 'savedSearch' id from localStorage and compare to id passed in from checkbox.
- Switched the 'Save Search' button from standard button to MUI button. - Removed button styling from sortBarStyle.ts in favor of default MUI styling.
- Created new SavedSearchContext. - Created new SavedSearchContextProvider. - Moved fetchSearches to SavedSearchContextProvider. - savedSearches and setSavedSearches are now in SavedSearchContext. - savedSearchCount and setSavedSearchCount are now in SavedSearchContext. - removed old fetchSearches from DrawerInterior. - removed old savedSearches and savedSearchCount state from DrawerInterior.
- Imported savedSearches from SavedSearchContext. - Added check in onChange that triggers alert and return if target value is equal to any savedSearch.name
- Deleted original code and imports. - Refactored Saved Search Layout. - Added ternary operator to check if there are saved searches.
5 tasks
…ved-search-accordion
- Deleting a saved search now removes the "update saved search" button.
…or-of-saved-search-accordion
- Removed Alert for duplicate saved search name. - Added a to-do to reference a need for btter validation inside a new MUI dialog. - Commented out savedSearchContext as it may be needed for validation.
ameliav
approved these changes
Aug 30, 2024
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
chrtorres
approved these changes
Sep 4, 2024
schmelz21
approved these changes
Sep 5, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Refactored the Saved Searches Accordion to better match the recently improved Side Drawer.
🗣 Description
💭 Motivation and context
🧪 Testing
📷 Screenshots (if appropriate)
✅ Pre-approval checklist
in code comments.
✅ Pre-merge checklist
✅ Post-merge checklist