mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-12 22:13:05 +00:00
Polish selected-first filter shells after simplify.
Drop redundant comments, use a Set for mobile checkmarks, and keep behavior unchanged.
This commit is contained in:
parent
38c310a1db
commit
0b6843eb80
3 changed files with 2 additions and 4 deletions
|
|
@ -101,8 +101,6 @@ export const CampaignHeaderFilterPopover = ({
|
|||
const filteredRows = needle
|
||||
? searchIndex.filter((entry) => entry.haystack.includes(needle)).map((entry) => entry.row)
|
||||
: optionRows
|
||||
// Order only while open: a closed popover keeps the natural facet order, and
|
||||
// the snapshot is irrelevant until the next open.
|
||||
const { ordered: visibleRows, selectedCount } =
|
||||
open && isMultiSelect
|
||||
? orderFilterOptionsSelectedFirst(filteredRows, selectionSnapshot)
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ export const CampaignMobileMultiFilterField = ({
|
|||
// No snapshot: the NativeSelect closes on every choice, so the next open
|
||||
// already wants the just-toggled value at the top.
|
||||
const { ordered } = orderFilterOptionsSelectedFirst(options, selected)
|
||||
const selectedSet = new Set(selected)
|
||||
|
||||
return (
|
||||
<Field>
|
||||
|
|
@ -44,7 +45,7 @@ export const CampaignMobileMultiFilterField = ({
|
|||
</NativeSelectOption>
|
||||
{ordered.map((option) => (
|
||||
<NativeSelectOption key={option.value} value={option.value}>
|
||||
{selected.includes(option.value) ? `✓ ${option.label}` : option.label}
|
||||
{selectedSet.has(option.value) ? `✓ ${option.label}` : option.label}
|
||||
</NativeSelectOption>
|
||||
))}
|
||||
</NativeSelect>
|
||||
|
|
|
|||
|
|
@ -176,7 +176,6 @@ describe('CampaignHeaderFilterPopover selected-first ordering', () => {
|
|||
target: { value: 'o' },
|
||||
})
|
||||
|
||||
// Echo / Foxtrot / Golf / Hotel match "o"; selected (Hotel, Foxtrot) first.
|
||||
expect(labelsInOrder(optionNav())).toEqual(['Foxtrot', 'Hotel', 'Echo', 'Golf'])
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue