UX(inspector): fix search, show graphs, see #2353

This commit is contained in:
Pieter Vander Vennet 2025-04-25 18:04:25 +02:00
parent 0ae58a740c
commit 4e5f32139e
6 changed files with 95 additions and 31 deletions

View file

@ -70,6 +70,8 @@
searchIsRunning.set(false)
}
})
let state = {
mapProperties: maplibremap,
searchState: {
@ -164,6 +166,19 @@
let showPreviouslyVisited = new UIEventSource(true)
const t = Translations.t.inspector
function search(suggestion?: GeocodeResult) {
suggestion ??= searchSuggestions?.data?.[0]
console.log("Seaching", suggestion)
if (!suggestion) {
return
}
map.data.flyTo({
zoom: 14,
center: [suggestion.lon, suggestion.lat]
})
}
</script>
<div class="flex h-screen w-full flex-col">
@ -251,12 +266,13 @@
<MaplibreMap {map} mapProperties={maplibremap} autorecovery={true} />
<div class="absolute right-0 top-0 w-1/4 p-4">
<Searchbar
on:search={() => search()}
isFocused={searchIsFocussed}
value={searchvalue}
on:focus={() => state.searchState.showSearchDrawer.set(true)}
/>
{#if $searchSuggestions?.length > 0 || $searchIsFocussed}
<GeocodeResults {state} />
<GeocodeResults {state} on:select={(event) => search(event.detail)} />
{/if}
</div>
</div>