Merge master

This commit is contained in:
Pieter Vander Vennet 2025-01-28 16:37:41 +01:00
commit c939d8ea8e
352 changed files with 976 additions and 212534 deletions

View file

@ -51,7 +51,7 @@ export interface NSIItem {
}
readonly tags: Readonly<Record<string, string>>
fromTemplate?: boolean
ext? : string
ext?: string
}
export default class NameSuggestionIndex {
@ -214,9 +214,7 @@ export default class NameSuggestionIndex {
for (const nsiItem of actualBrands) {
const tags = nsiItem.tags
const frequency = frequencies[nsiItem.displayName]
const iconUrl = this.getIconExternalUrl(nsiItem, type)
const hasIcon = iconUrl !== undefined
const icon = hasIcon ? this.getIconUrl(nsiItem, type) : undefined
const icon = this.getIconUrl(nsiItem)
mappings.push({
if: new Tag(type, tags[type]),
addExtraTags: Object.keys(tags)
@ -274,7 +272,7 @@ export default class NameSuggestionIndex {
const values = tags[osmKey]
for (const osmValue of values) {
const suggestions = this.getSuggestionsForKV(type, osmKey, osmValue)
if(!suggestions){
if (!suggestions) {
console.warn("No suggestions found for", type, osmKey, osmValue)
continue
}
@ -399,9 +397,14 @@ export default class NameSuggestionIndex {
return logos?.facebook ?? logos?.wikidata
}
public getIconUrl(nsiItem: NSIItem, type: string) {
public getIconUrl(nsiItem: NSIItem): string | undefined {
if (!nsiItem.ext) {
// No extension -> there is no logo
return undefined
}
return "./assets/data/nsi/logos/" + nsiItem.id + "." + nsiItem.ext
}
private static readonly brandPrefix = ["name", "alt_name", "operator", "brand"] as const
/**

View file

@ -6,8 +6,8 @@ import { UIEventSource } from "../UIEventSource"
export default class ThemeViewStateHashActor {
private readonly _state: {
indexedFeatures: IndexedFeatureSource,
selectedElement: UIEventSource<Feature>,
indexedFeatures: IndexedFeatureSource
selectedElement: UIEventSource<Feature>
guistate: MenuState
}
private isUpdatingHash = false
@ -22,7 +22,7 @@ export default class ThemeViewStateHashActor {
"",
"The possible hashes are:",
"",
MenuState.pageNames.map((tab) => "`" + tab + "`").join(",")
MenuState.pageNames.map((tab) => "`" + tab + "`").join(","),
]
/**
@ -35,9 +35,9 @@ export default class ThemeViewStateHashActor {
*
*/
constructor(state: {
indexedFeatures: IndexedFeatureSource,
selectedElement: UIEventSource<Feature>,
guistate: MenuState,
indexedFeatures: IndexedFeatureSource
selectedElement: UIEventSource<Feature>
guistate: MenuState
}) {
this._state = state