Add full-text search

Add a search box with a quick results popover, as well full results in
the sidebar on pressing enter.
This commit is contained in:
2026-02-20 12:39:04 +04:00
parent 2734f08608
commit bf12305600
15 changed files with 878 additions and 68 deletions

View File

@@ -7,6 +7,7 @@ export default class MapUiService extends Service {
@tracked isCreating = false;
@tracked creationCoordinates = null;
@tracked returnToSearch = false;
@tracked currentCenter = null;
selectPlace(place) {
this.selectedPlace = place;
@@ -38,4 +39,8 @@ export default class MapUiService extends Service {
updateCreationCoordinates(lat, lon) {
this.creationCoordinates = { lat, lon };
}
updateCenter(lat, lon) {
this.currentCenter = { lat, lon };
}
}

View File

@@ -12,8 +12,8 @@ export default class PhotonService extends Service {
});
if (lat && lon) {
params.append('lat', String(lat));
params.append('lon', String(lon));
params.append('lat', parseFloat(lat).toFixed(4));
params.append('lon', parseFloat(lon).toFixed(4));
}
const url = `${this.baseUrl}?${params.toString()}`;
@@ -61,12 +61,18 @@ export default class PhotonService extends Service {
const description = addressParts.join(', ');
const title = props.name || description || 'Unknown Place';
const osmTypeMap = {
N: 'node',
W: 'way',
R: 'relation',
};
return {
title,
lat,
lon,
osmId: props.osm_id,
osmType: props.osm_type, // 'N', 'W', 'R'
osmType: osmTypeMap[props.osm_type] || props.osm_type, // 'node', 'way', 'relation'
osmTags: props, // Keep all properties as tags for now
description: props.name ? description : addressParts.slice(1).join(', '),
source: 'photon',