File tree Expand file tree Collapse file tree 3 files changed +16
-5
lines changed
src/renderer/components/filters Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -133,7 +133,9 @@ export const SearchFilter: FC = () => {
133133 onRemove = { removeIncludeSearchToken }
134134 showSuggestionsOnFocusIfEmpty = { ! hasIncludeSearchFilters ( settings ) }
135135 tokens = { includeSearchTokens }
136+ isDetailedNotificationsEnabled = { settings . detailedNotifications }
136137 />
138+
137139 < TokenSearchInput
138140 icon = { NoEntryFillIcon }
139141 iconColorClass = { IconColor . RED }
@@ -142,6 +144,7 @@ export const SearchFilter: FC = () => {
142144 onRemove = { removeExcludeSearchToken }
143145 showSuggestionsOnFocusIfEmpty = { ! hasExcludeSearchFilters ( settings ) }
144146 tokens = { excludeSearchTokens }
147+ isDetailedNotificationsEnabled = { settings . detailedNotifications }
145148 />
146149 </ Stack >
147150 </ fieldset >
Original file line number Diff line number Diff line change @@ -14,23 +14,28 @@ const QUALIFIERS = Object.values(SEARCH_QUALIFIERS);
1414interface SearchFilterSuggestionsProps {
1515 open : boolean ;
1616 inputValue : string ;
17+ isDetailedNotificationsEnabled : boolean ;
1718 onClose : ( ) => void ;
1819}
1920
2021export const SearchFilterSuggestions : FC < SearchFilterSuggestionsProps > = ( {
2122 open,
2223 inputValue,
24+ isDetailedNotificationsEnabled,
2325 onClose,
2426} ) => {
2527 if ( ! open ) {
2628 return null ;
2729 }
2830
2931 const lower = inputValue . toLowerCase ( ) ;
30- const suggestions = QUALIFIERS . filter (
32+ const base = isDetailedNotificationsEnabled
33+ ? QUALIFIERS
34+ : QUALIFIERS . filter ( ( q ) => ! q . requiresDetailsNotifications ) ;
35+ const suggestions = base . filter (
3136 ( q ) => q . prefix . startsWith ( lower ) || inputValue === '' ,
3237 ) ;
33- const beginsWithKnownQualifier = QUALIFIERS . some ( ( q ) =>
38+ const beginsWithKnownQualifier = base . some ( ( q ) =>
3439 lower . startsWith ( q . prefix ) ,
3540 ) ;
3641
@@ -55,7 +60,7 @@ export const SearchFilterSuggestions: FC<SearchFilterSuggestionsProps> = ({
5560 < Box >
5661 < Text className = { cn ( 'text-xs' , Opacity . HIGH ) } >
5762 Please use one of the supported filters [
58- { QUALIFIERS . map ( ( q ) =>
63+ { base . map ( ( q ) =>
5964 q . prefix . replace ( SEARCH_DELIMITER , '' ) ,
6065 ) . join ( ', ' ) }
6166 ]
Original file line number Diff line number Diff line change @@ -15,11 +15,12 @@ export interface TokenInputItem {
1515}
1616
1717interface TokenSearchInputProps {
18- label : string ; // "Include" | "Exclude"
18+ label : string ;
1919 icon : FC < { className ?: string } > ;
2020 iconColorClass : string ;
2121 tokens : TokenInputItem [ ] ;
22- showSuggestionsOnFocusIfEmpty : boolean ; // parent pre-computed condition
22+ showSuggestionsOnFocusIfEmpty : boolean ;
23+ isDetailedNotificationsEnabled : boolean ;
2324 onAdd : ( token : string ) => void ;
2425 onRemove : ( tokenId : string | number ) => void ;
2526}
@@ -32,6 +33,7 @@ export const TokenSearchInput: FC<TokenSearchInputProps> = ({
3233 iconColorClass,
3334 tokens,
3435 showSuggestionsOnFocusIfEmpty,
36+ isDetailedNotificationsEnabled,
3537 onAdd,
3638 onRemove,
3739} ) => {
@@ -110,6 +112,7 @@ export const TokenSearchInput: FC<TokenSearchInputProps> = ({
110112 < SearchFilterSuggestions
111113 inputValue = { inputValue }
112114 onClose = { ( ) => setShowSuggestions ( false ) }
115+ isDetailedNotificationsEnabled = { isDetailedNotificationsEnabled }
113116 open = { showSuggestions }
114117 />
115118 </ Box >
You can’t perform that action at this time.
0 commit comments