forked from MapComplete/MapComplete
Merge develop
This commit is contained in:
commit
3fe1f39c46
457 changed files with 6866 additions and 218533 deletions
33
src/Logic/Web/CommunityIndex.ts
Normal file
33
src/Logic/Web/CommunityIndex.ts
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* Various tools and types to work with the community index (https://openstreetmap.community/; https://github.com/osmlab/osm-community-index)
|
||||
*/
|
||||
|
||||
|
||||
export interface CommunityResource {
|
||||
/**
|
||||
* A unique identifier for the resource
|
||||
* "pattern": "^[-_.A-Za-z0-9]+$"
|
||||
*/
|
||||
id: string,
|
||||
/**
|
||||
* Type of community resource (thus: platform)
|
||||
*/
|
||||
type: string,
|
||||
/**
|
||||
* included and excluded locations for this item
|
||||
* See location-conflation documentation for compatible values: https://github.com/rapideditor/location-conflation#readme
|
||||
*/
|
||||
locationSet?,
|
||||
|
||||
/** Array of ISO-639-1 (2 letter) or ISO-639-3 (3 letter) codes in lowercase
|
||||
* */
|
||||
languageCodes?: string[]
|
||||
/**
|
||||
* Resource account string, required for some resource types
|
||||
*/
|
||||
account?: string
|
||||
|
||||
resolved?: { url: string, name: string, description: string } & Record<string, string>
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -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
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ import { Store, 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
|
||||
|
|
@ -23,7 +23,7 @@ export default class ThemeViewStateHashActor {
|
|||
"",
|
||||
"The possible hashes are:",
|
||||
"",
|
||||
MenuState.pageNames.map((tab) => "`" + tab + "`").join(",")
|
||||
MenuState.pageNames.map((tab) => "`" + tab + "`").join(","),
|
||||
]
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue