Repository navigation
fix: Filter memory (filtering pt. 1) #320
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: main
Are you sure you want to change the base?
Changes from all commits
211ccdf
7e8a637
821d1be
4046c0d
95cc96d
8488d2e
6617c56
c5428ff
dd98158
de2da36
c68e3f0
3504bec
87eb759
1180175
599918d
6c335cf
d8e401e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| import { chunk, includes, map, reduce, values } from "lodash"; | ||
| import { chunk, map, reduce, values } from "lodash"; | ||
| import { createSelector } from "reselect"; | ||
|
|
||
| import { | ||
|
|
@@ -23,7 +23,6 @@ import { | |
| getColorBySelection, | ||
| getDownloadConfig, | ||
| getDownloadRoot, | ||
| getFiltersToExclude, | ||
| getSelectedGroupKeys, | ||
| getSelectedGroups, | ||
| getSelectedSetTotals, | ||
|
|
@@ -37,8 +36,13 @@ import { | |
| getYValues, | ||
| getXValues, | ||
| getColorOverrides, | ||
| getGroupByFilter, | ||
| } from "../../state/selection/selectors"; | ||
| import { ColorForPlot, LassoOrBoxSelectPointData } from "../../state/selection/types"; | ||
| import { | ||
| ColorForPlot, | ||
| DiscreteFilterData, | ||
| LassoOrBoxSelectPointData, | ||
| } from "../../state/selection/types"; | ||
| import { convertSingleImageIdToDownloadId } from "../../state/util"; | ||
|
|
||
| import { PanelData } from "./types"; | ||
|
|
@@ -65,9 +69,14 @@ export const getGroupByTitle = createSelector( | |
| ); | ||
|
|
||
| export const getCheckAllCheckboxIsIntermediate = createSelector( | ||
| [getFiltersToExclude, getGroupingCategoryNames], | ||
| (filtersToExclude, categoryNames: string[]): boolean => { | ||
| return filtersToExclude.length > 0 && filtersToExclude.length !== categoryNames.length; | ||
| [getGroupByFilter, getGroupingCategoryNames], | ||
| (groupByFilter, categoryNames: string[]): boolean => { | ||
| const excludedValues = groupByFilter?.excludedValues; | ||
| return ( | ||
| excludedValues !== undefined && | ||
| excludedValues.size > 0 && | ||
| excludedValues.size !== categoryNames.length | ||
| ); | ||
|
Comment on lines
+72
to
+79
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think there may be a tiny bug here where unselecting all options except N/A shows the checkbox in as unchecked instead of indeterminate. I think #322 addresses it and we can resolve merge conflicts as one or the other branch goes through, don't consider it blocking. |
||
| } | ||
| ); | ||
|
|
||
|
|
@@ -126,7 +135,7 @@ export const getInteractivePanelData = createSelector( | |
| getGroupByCategory, | ||
| getColorBySelection, | ||
| getGroupByFeatureOptionsAsList, | ||
| getFiltersToExclude, | ||
| getGroupByFilter, | ||
| getDisplayableGroups, | ||
| getGroupingCategoryNamesAsArray, | ||
| getColorOverrides, | ||
|
|
@@ -135,7 +144,7 @@ export const getInteractivePanelData = createSelector( | |
| categoryToGroupBy: keyof MappingOfMeasuredValuesArrays, | ||
| categoryToColorBy: keyof MappingOfMeasuredValuesArrays, | ||
| categories: MeasuredFeaturesOption[], | ||
| filtersToExclude: string[], | ||
| groupByFilter: DiscreteFilterData | undefined, | ||
| displayableGroups: string[], | ||
| categoryNamesArray: string[], | ||
| colorOverrides: (string | undefined)[] | ||
|
|
@@ -168,15 +177,16 @@ export const getInteractivePanelData = createSelector( | |
| const id = category.key ?? category.name; | ||
| const total: number = countsByCategory[id] || category.count || 0; | ||
| const disabled = !displayableGroups.includes(id); | ||
| const excluded = groupByFilter?.excludedValues.has(id) ?? false; | ||
| const color = getColorForCategory( | ||
| categoryToColorBy === categoryToGroupBy, | ||
| includes(filtersToExclude, id), | ||
| excluded, | ||
| disabled, | ||
| category.color, | ||
| colorOverrides[index] | ||
| ); | ||
| return { | ||
| checked: !includes(filtersToExclude, id), | ||
| checked: !excluded, | ||
| color: color, | ||
| id: id, | ||
| name: names[index], | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,4 +34,11 @@ | |
|
|
||
| .feature-select-row :global(.ant-select) { | ||
| width: 100%; | ||
| } | ||
| } | ||
|
|
||
| /* Make intermediate checkbox visible */ | ||
| .interactive-legend-container | ||
| :global(.ant-checkbox.ant-checkbox-indeterminate) | ||
| > :global(.ant-checkbox-inner)::after { | ||
| background-color: var(--dimgray); | ||
| } | ||
|
Comment on lines
+39
to
+44
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixes a bug where this checkbox was too low contrast and couldn't be seen. |
||
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: when would
filter.discretebe false? given line 114, looks like thisifwould always be true right?