-
Notifications
You must be signed in to change notification settings - Fork 204
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
Support toggling different filter states independently #6056
Conversation
src/sidebar/store/modules/filters.ts
Outdated
*/ | ||
export type FilterKey = 'cfi' | 'page' | 'user'; | ||
export type FilterKey = 'cfi' | 'pages' | 'user'; |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
22140e4
to
3414a52
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6056 +/- ##
=======================================
Coverage 99.44% 99.45%
=======================================
Files 265 265
Lines 10149 10195 +46
Branches 2459 2474 +15
=======================================
+ Hits 10093 10139 +46
Misses 56 56 ☔ View full report in Codecov by Sentry. |
I need to check that the Edit: Reverted this change and updated code comments to save the next guy from making the same mistake. |
3414a52
to
6b749dc
Compare
Store the focus filter activation state as a set of active filters (eg. `{"user", "page"}`) instead of a boolean. This will allow the filters to be toggled independently in future. To support the existing UI where there is only a single toggle control, `toggleFocusMode` retains the ability to toggle all configured filters. Once the new search UI is rolled out for everyone, we can probably remove this.
- Try to better explain the context in which each of the filters is used - Re-organize the state fields so that user-applied filters are at the top, followed by the focus filter state
This unfortunately doesn't catch mistakes where incorrect property names are used because TS allows excess properties, but it does at least document what the expected keys are.
6b749dc
to
64624f1
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 👍🏼
In order to support a UI like the one shown in #6006 (comment) it needs to be possible to toggle different filter modes independently. For example, if a teacher is grading an assignment with a page range specified, there will be filters for both the student being graded and the page range, and it should be possible to toggle them independently. This PR refactors the
focusActive
state in thefilters
store module to support this.focusActive
state from a boolean to a set of enabled states and extends thetoggleFocusMode
store action APIThere should be no functional changes , as the new capabilities are not used by the UI yet.