UX: more work on a search function

This commit is contained in:
Pieter Vander Vennet 2024-08-21 14:06:42 +02:00
parent 3cd04df60b
commit 00ad21d5ef
30 changed files with 636 additions and 138 deletions

View file

@ -4,6 +4,7 @@ import { Utils } from "../Utils"
import { AuthConfig } from "../Logic/Osm/AuthConfig"
export type PriviligedLayerType = (typeof Constants.priviliged_layers)[number]
export type DefaultPinIcon = (typeof Constants._defaultPinIcons)[number]
export default class Constants {
public static vNumber: string = packagefile.version
@ -113,14 +114,18 @@ export default class Constants {
public static countryCoderEndpoint: string = Constants.config.country_coder_host
public static osmAuthConfig: AuthConfig = Constants.config.oauth_credentials
public static nominatimEndpoint: string = Constants.config.nominatimEndpoint
public static photonEndpoint: string = Constants.config.photonEndpoint
public static linkedDataProxy: string = Constants.config["jsonld-proxy"]
/**
* These are the values that are allowed to use as 'backdrop' icon for a map pin
*/
private static readonly _defaultPinIcons = [
public static readonly _defaultPinIcons = [
"addSmall",
"airport",
"brick_wall_round",
"brick_wall_square",
"building_office_2",
"bug",
"checkmark",
"checkmark",
@ -135,12 +140,14 @@ export default class Constants {
"desktop",
"direction",
"gear",
"globe_alt",
"gps_arrow",
"heart",
"heart_outline",
"help",
"help",
"home",
"house",
"invalid",
"invalid",
"link",
@ -160,7 +167,9 @@ export default class Constants {
"square_rounded",
"teardrop",
"teardrop_with_hole_green",
"train",
"triangle",
"user_circle",
"wifi",
] as const
public static readonly defaultPinIcons: string[] = <any>Constants._defaultPinIcons
@ -183,6 +192,7 @@ export default class Constants {
Constants.countryCoderEndpoint,
Constants.osmAuthConfig.url,
Constants.nominatimEndpoint,
Constants.photonEndpoint,
Constants.linkedDataProxy,
...Constants.defaultOverpassUrls,
]

View file

@ -321,7 +321,13 @@ export interface QuestionableTagRenderingConfigJson extends TagRenderingConfigJs
editButtonAriaLabel?: Translatable
/**
* What labels should be applied on this tagRendering?
*
* A list of labels. These are strings that are used for various purposes, e.g. to only include a subset of the tagRenderings when reusing a layer
*
* Special values:
* - "hidden": do not show this tagRendering. Useful in it is used by e.g. an accordion
* - "description": this label is a description used in the search
*/
labels?: string[]
}

View file

@ -898,9 +898,7 @@ export default class TagRenderingConfig {
].join("\n")
}
public
usedTags(): TagsFilter[] {
public usedTags(): TagsFilter[] {
const tags: TagsFilter[] = []
tags.push(
this.metacondition,

View file

@ -79,6 +79,8 @@ import CombinedSearcher from "../Logic/Geocoding/CombinedSearcher"
import { NominatimGeocoding } from "../Logic/Geocoding/NominatimGeocoding"
import CoordinateSearch from "../Logic/Geocoding/CoordinateSearch"
import LocalElementSearch from "../Logic/Geocoding/LocalElementSearch"
import { RecentSearch } from "../Logic/Geocoding/RecentSearch"
import PhotonSearch from "../Logic/Geocoding/PhotonSearch"
/**
*
@ -160,6 +162,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
public readonly nearbyImageSearcher: CombinedFetcher
public readonly geosearch: GeocodingProvider
public readonly recentlySearched: RecentSearch
constructor(layout: LayoutConfig, mvtAvailableLayers: Set<string>) {
Utils.initDomPurify()
@ -387,11 +390,12 @@ export default class ThemeViewState implements SpecialVisualizationState {
this.toCacheSavers = layout.enableCache ? this.initSaveToLocalStorage() : undefined
this.geosearch = new CombinedSearcher(
new NominatimGeocoding(),
new LocalElementSearch(this, 5),
new PhotonSearch(), // new NominatimGeocoding(),
new CoordinateSearch(),
new LocalElementSearch(this)
)
this.recentlySearched = new RecentSearch(this)
this.initActors()
this.drawSpecialLayers()