@@ -184,37 +184,11 @@ export function DialogModel(props: { providerID?: string }) {
184184 )
185185 : [ ]
186186
187- // Apply fuzzy filtering to each section separately, maintaining section order
188- // Sort with prefix matches first (alphabetically), then other matches (alphabetically)
189- // Preserve "Free first" ordering within each group
190- if ( q ) {
191- const needle = q . toLowerCase ( )
192- const sortWithPrefixFirst = < T extends { title : string ; footer ?: string } > ( items : T [ ] ) : T [ ] =>
193- items . sort ( ( a , b ) => {
194- const aTitle = a . title . toLowerCase ( )
195- const bTitle = b . title . toLowerCase ( )
196- const aIsPrefix = aTitle . startsWith ( needle )
197- const bIsPrefix = bTitle . startsWith ( needle )
198- if ( aIsPrefix && ! bIsPrefix ) return - 1
199- if ( ! aIsPrefix && bIsPrefix ) return 1
200- // Preserve "Free first" within same prefix group
201- if ( a . footer === "Free" && b . footer !== "Free" ) return - 1
202- if ( a . footer !== "Free" && b . footer === "Free" ) return 1
203- return a . title . localeCompare ( b . title )
204- } )
205- const filteredFavorites = sortWithPrefixFirst (
206- fuzzysort . go ( q , favoriteOptions , { keys : [ "title" ] } ) . map ( ( x ) => x . obj ) ,
207- )
208- const filteredRecents = sortWithPrefixFirst (
209- fuzzysort . go ( q , recentOptions , { keys : [ "title" ] } ) . map ( ( x ) => x . obj ) . slice ( 0 , 5 ) ,
210- )
211- const filteredProviders = sortWithPrefixFirst (
212- fuzzysort . go ( q , providerOptions , { keys : [ "title" , "category" ] } ) . map ( ( x ) => x . obj ) ,
213- )
214- const filteredPopular = sortWithPrefixFirst (
215- fuzzysort . go ( q , popularProviders , { keys : [ "title" ] } ) . map ( ( x ) => x . obj ) ,
216- )
217- return [ ...filteredFavorites , ...filteredRecents , ...filteredProviders , ...filteredPopular ]
187+ // Search shows a single merged list (favorites inline)
188+ if ( needle ) {
189+ const filteredProviders = fuzzysort . go ( needle , providerOptions , { keys : [ "title" , "category" ] } ) . map ( ( x ) => x . obj )
190+ const filteredPopular = fuzzysort . go ( needle , popularProviders , { keys : [ "title" ] } ) . map ( ( x ) => x . obj )
191+ return [ ...filteredProviders , ...filteredPopular ]
218192 }
219193
220194 return [ ...favoriteOptions , ...recentOptions , ...providerOptions , ...popularProviders ]
0 commit comments