mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-20 19:16:08 +00:00
fix(search): place searches find a name typed without its accents (#3075)
"Obidos" did not find "Óbidos", nor "Sao Bras" "São Brás". The search of the places list, a collection, the saved-place picker, the import from a trip and the location picker now compare without case and Latin accents, with letters such as ß, ø or ł folded to their plain spelling. Marks outside Latin script stay, since there they change the word.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useId, useRef, useState } from 'react'
|
||||
import { MapPin, Search } from 'lucide-react'
|
||||
import { mapsApi } from '../../api/client'
|
||||
import { textMatchesSearch } from '../../utils/placeSearch'
|
||||
import { useTranslation } from '../../i18n'
|
||||
import { useLocationBias } from '../../hooks/useLocationBias'
|
||||
import { usePlaceSuggestions } from '../../hooks/usePlaceSuggestions'
|
||||
@@ -196,7 +197,7 @@ function SourceMark({ label }: { label: string | null }) {
|
||||
function pickRows<T>(value: LocationPoint | null, typed: string, places: LocationPoint[] | undefined, results: T[]) {
|
||||
const showPicks = !value && typed.length < 3 && !!places?.length
|
||||
const rows: (T | LocationPoint)[] = showPicks
|
||||
? (places ?? []).filter(p => !typed || p.name.toLowerCase().includes(typed.toLowerCase()))
|
||||
? (places ?? []).filter(p => textMatchesSearch([p.name], typed))
|
||||
: results
|
||||
return { showPicks, rows }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user