forked from MapComplete/MapComplete
Chore: housekeeping
This commit is contained in:
parent
8178c5607b
commit
cd0d275965
73 changed files with 2105 additions and 2219 deletions
|
@ -55,16 +55,12 @@ export default class InitialMapPositioning {
|
|||
layoutToUse?.startZoom ?? 1,
|
||||
"The initial/current zoom level"
|
||||
)
|
||||
const defaultLat =layoutToUse?.startLat ?? 0
|
||||
const lat = localStorageSynced(
|
||||
"lat",
|
||||
defaultLat ,
|
||||
"The initial/current latitude"
|
||||
)
|
||||
const defaultLat = layoutToUse?.startLat ?? 0
|
||||
const lat = localStorageSynced("lat", defaultLat, "The initial/current latitude")
|
||||
const defaultLon = layoutToUse?.startLon ?? 0
|
||||
const lon = localStorageSynced(
|
||||
"lon",
|
||||
defaultLon ,
|
||||
defaultLon,
|
||||
"The initial/current longitude of the app"
|
||||
)
|
||||
|
||||
|
@ -92,16 +88,21 @@ export default class InitialMapPositioning {
|
|||
const [lat, lon] = osmObject.centerpoint()
|
||||
this.location.setData({ lon, lat })
|
||||
})
|
||||
} else if (Constants.GeoIpServer && lat.data === defaultLat && lon.data === defaultLon && !Utils.runningFromConsole) {
|
||||
} else if (
|
||||
Constants.GeoIpServer &&
|
||||
lat.data === defaultLat &&
|
||||
lon.data === defaultLon &&
|
||||
!Utils.runningFromConsole
|
||||
) {
|
||||
console.log("Using geoip to determine start location...")
|
||||
// We use geo-IP to zoom to some location
|
||||
Utils.downloadJson<{ latitude: number, longitude: number }>(
|
||||
Utils.downloadJson<{ latitude: number; longitude: number }>(
|
||||
Constants.GeoIpServer + "ip"
|
||||
).then(({ longitude, latitude }) => {
|
||||
if(geolocationState.currentGPSLocation.data !== undefined){
|
||||
if (geolocationState.currentGPSLocation.data !== undefined) {
|
||||
return // We got a geolocation by now, abort
|
||||
}
|
||||
console.log("Setting location based on geoip", longitude, latitude)
|
||||
console.log("Setting location based on geoip", longitude, latitude)
|
||||
this.zoom.setData(8)
|
||||
this.location.setData({ lon: longitude, lat: latitude })
|
||||
})
|
||||
|
|
|
@ -163,24 +163,31 @@ export default class DetermineLayout {
|
|||
return dict
|
||||
}
|
||||
private static getSharedTagRenderingOrder(): string[] {
|
||||
return questions.tagRenderings.map(tr => tr.id)
|
||||
return questions.tagRenderings.map((tr) => tr.id)
|
||||
}
|
||||
|
||||
private static prepCustomTheme(json: any, sourceUrl?: string, forceId?: string): LayoutConfig {
|
||||
if (json.layers === undefined && json.tagRenderings !== undefined) {
|
||||
// We got fed a layer instead of a theme
|
||||
const layerConfig = <LayerConfigJson>json
|
||||
const icon = Utils.NoNull(layerConfig.pointRendering.flatMap(
|
||||
pr => pr.marker
|
||||
).map(iconSpec => {
|
||||
const icon = new TagRenderingConfig(<TagRenderingConfigJson>iconSpec.icon).render.txt
|
||||
if(iconSpec.color === undefined || icon.startsWith("http:") || icon.startsWith("https:")){
|
||||
return icon
|
||||
}
|
||||
const color = new TagRenderingConfig(<TagRenderingConfigJson>iconSpec.color).render.txt
|
||||
return icon+":"+color
|
||||
|
||||
})).join(";")
|
||||
const icon = Utils.NoNull(
|
||||
layerConfig.pointRendering
|
||||
.flatMap((pr) => pr.marker)
|
||||
.map((iconSpec) => {
|
||||
const icon = new TagRenderingConfig(<TagRenderingConfigJson>iconSpec.icon)
|
||||
.render.txt
|
||||
if (
|
||||
iconSpec.color === undefined ||
|
||||
icon.startsWith("http:") ||
|
||||
icon.startsWith("https:")
|
||||
) {
|
||||
return icon
|
||||
}
|
||||
const color = new TagRenderingConfig(<TagRenderingConfigJson>iconSpec.color)
|
||||
.render.txt
|
||||
return icon + ":" + color
|
||||
})
|
||||
).join(";")
|
||||
|
||||
json = {
|
||||
id: json.id,
|
||||
|
|
|
@ -11,14 +11,17 @@ import { FeatureSource } from "../FeatureSource"
|
|||
* Highly specialized feature source.
|
||||
* Based on a lon/lat UIEVentSource, will generate the corresponding feature with the correct properties
|
||||
*/
|
||||
export class LastClickFeatureSource implements FeatureSource{
|
||||
export class LastClickFeatureSource implements FeatureSource {
|
||||
public readonly renderings: string[]
|
||||
private i: number = 0
|
||||
private readonly hasPresets: boolean
|
||||
private readonly hasNoteLayer: boolean
|
||||
public static readonly newPointElementId = "new_point_dialog"
|
||||
public readonly features: Store<Feature[]>
|
||||
constructor(layout: LayoutConfig, clickSource: Store<{lon:number,lat:number,mode:"left"|"right"|"middle"}> ) {
|
||||
constructor(
|
||||
layout: LayoutConfig,
|
||||
clickSource: Store<{ lon: number; lat: number; mode: "left" | "right" | "middle" }>
|
||||
) {
|
||||
this.hasNoteLayer = layout.hasNoteLayer()
|
||||
this.hasPresets = layout.hasPresets()
|
||||
const allPresets: BaseUIElement[] = []
|
||||
|
@ -33,7 +36,7 @@ export class LastClickFeatureSource implements FeatureSource{
|
|||
}
|
||||
const { html } = rendering.RenderIcon(tags, {
|
||||
noSize: true,
|
||||
includeBadges: false
|
||||
includeBadges: false,
|
||||
})
|
||||
allPresets.push(html)
|
||||
}
|
||||
|
@ -44,12 +47,16 @@ export class LastClickFeatureSource implements FeatureSource{
|
|||
)
|
||||
)
|
||||
|
||||
this.features = clickSource.mapD(({lon, lat,mode}) =>
|
||||
[this.createFeature(lon, lat, mode)])
|
||||
|
||||
this.features = clickSource.mapD(({ lon, lat, mode }) => [
|
||||
this.createFeature(lon, lat, mode),
|
||||
])
|
||||
}
|
||||
|
||||
public createFeature(lon: number, lat: number, mode?: "left" | "right" | "middle"): Feature<Point, OsmTags> {
|
||||
public createFeature(
|
||||
lon: number,
|
||||
lat: number,
|
||||
mode?: "left" | "right" | "middle"
|
||||
): Feature<Point, OsmTags> {
|
||||
const properties: OsmTags = {
|
||||
id: LastClickFeatureSource.newPointElementId + "_" + this.i,
|
||||
has_note_layer: this.hasNoteLayer ? "yes" : "no",
|
||||
|
@ -57,7 +64,7 @@ export class LastClickFeatureSource implements FeatureSource{
|
|||
renderings: this.renderings.join(""),
|
||||
number_of_presets: "" + this.renderings.length,
|
||||
first_preset: this.renderings[0],
|
||||
mouse_button: mode ?? "none"
|
||||
mouse_button: mode ?? "none",
|
||||
}
|
||||
this.i++
|
||||
|
||||
|
@ -66,8 +73,8 @@ export class LastClickFeatureSource implements FeatureSource{
|
|||
properties,
|
||||
geometry: {
|
||||
type: "Point",
|
||||
coordinates: [lon, lat]
|
||||
}
|
||||
coordinates: [lon, lat],
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,16 +85,19 @@ export default class MetaTagging {
|
|||
console.log("Binding an updater to", feature)
|
||||
let updateCount = 0
|
||||
tags?.addCallbackD(() => {
|
||||
console.log("Received an update! Re-calculating the metatags, timediff:", new Date().getTime() - lastUpdateMoment.getTime())
|
||||
console.log(
|
||||
"Received an update! Re-calculating the metatags, timediff:",
|
||||
new Date().getTime() - lastUpdateMoment.getTime()
|
||||
)
|
||||
|
||||
if (feature !== state.selectedElement.data) {
|
||||
return true // Unregister, we are not the selected element anymore
|
||||
}
|
||||
if (new Date().getTime() - lastUpdateMoment.getTime() < (250 + updateCount * 50)) {
|
||||
if (new Date().getTime() - lastUpdateMoment.getTime() < 250 + updateCount * 50) {
|
||||
return
|
||||
}
|
||||
|
||||
updateCount ++
|
||||
updateCount++
|
||||
lastUpdateMoment = new Date()
|
||||
window.requestIdleCallback(() => {
|
||||
this.updateCurrentSelectedElement()
|
||||
|
|
|
@ -1,14 +1,42 @@
|
|||
import { Utils } from "../../Utils"
|
||||
/** This code is autogenerated - do not edit. Edit ./assets/layers/usersettings/usersettings.json instead */
|
||||
export class ThemeMetaTagging {
|
||||
public static readonly themeName = "usersettings"
|
||||
public static readonly themeName = "usersettings"
|
||||
|
||||
public metaTaggging_for_usersettings(feat: {properties: Record<string, string>}) {
|
||||
Utils.AddLazyProperty(feat.properties, '_mastodon_candidate_md', () => feat.properties._description.match(/\[[^\]]*\]\((.*(mastodon|en.osm.town).*)\).*/)?.at(1) )
|
||||
Utils.AddLazyProperty(feat.properties, '_d', () => feat.properties._description?.replace(/</g,'<')?.replace(/>/g,'>') ?? '' )
|
||||
Utils.AddLazyProperty(feat.properties, '_mastodon_candidate_a', () => (feat => {const e = document.createElement('div');e.innerHTML = feat.properties._d;return Array.from(e.getElementsByTagName("a")).filter(a => a.href.match(/mastodon|en.osm.town/) !== null)[0]?.href }) (feat) )
|
||||
Utils.AddLazyProperty(feat.properties, '_mastodon_link', () => (feat => {const e = document.createElement('div');e.innerHTML = feat.properties._d;return Array.from(e.getElementsByTagName("a")).filter(a => a.getAttribute("rel")?.indexOf('me') >= 0)[0]?.href})(feat) )
|
||||
Utils.AddLazyProperty(feat.properties, '_mastodon_candidate', () => feat.properties._mastodon_candidate_md ?? feat.properties._mastodon_candidate_a )
|
||||
feat.properties['__current_backgroun'] = 'initial_value'
|
||||
}
|
||||
}
|
||||
public metaTaggging_for_usersettings(feat: { properties: Record<string, string> }) {
|
||||
Utils.AddLazyProperty(feat.properties, "_mastodon_candidate_md", () =>
|
||||
feat.properties._description
|
||||
.match(/\[[^\]]*\]\((.*(mastodon|en.osm.town).*)\).*/)
|
||||
?.at(1)
|
||||
)
|
||||
Utils.AddLazyProperty(
|
||||
feat.properties,
|
||||
"_d",
|
||||
() => feat.properties._description?.replace(/</g, "<")?.replace(/>/g, ">") ?? ""
|
||||
)
|
||||
Utils.AddLazyProperty(feat.properties, "_mastodon_candidate_a", () =>
|
||||
((feat) => {
|
||||
const e = document.createElement("div")
|
||||
e.innerHTML = feat.properties._d
|
||||
return Array.from(e.getElementsByTagName("a")).filter(
|
||||
(a) => a.href.match(/mastodon|en.osm.town/) !== null
|
||||
)[0]?.href
|
||||
})(feat)
|
||||
)
|
||||
Utils.AddLazyProperty(feat.properties, "_mastodon_link", () =>
|
||||
((feat) => {
|
||||
const e = document.createElement("div")
|
||||
e.innerHTML = feat.properties._d
|
||||
return Array.from(e.getElementsByTagName("a")).filter(
|
||||
(a) => a.getAttribute("rel")?.indexOf("me") >= 0
|
||||
)[0]?.href
|
||||
})(feat)
|
||||
)
|
||||
Utils.AddLazyProperty(
|
||||
feat.properties,
|
||||
"_mastodon_candidate",
|
||||
() => feat.properties._mastodon_candidate_md ?? feat.properties._mastodon_candidate_a
|
||||
)
|
||||
feat.properties["__current_backgroun"] = "initial_value"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,23 +27,23 @@ export default class LinkedDataLoader {
|
|||
opening_hours: { "@id": "http://schema.org/openingHoursSpecification" },
|
||||
openingHours: { "@id": "http://schema.org/openingHours", "@container": "@set" },
|
||||
geo: { "@id": "http://schema.org/geo" },
|
||||
alt_name: { "@id": "http://schema.org/alternateName" }
|
||||
alt_name: { "@id": "http://schema.org/alternateName" },
|
||||
}
|
||||
private static COMPACTING_CONTEXT_OH = {
|
||||
dayOfWeek: { "@id": "http://schema.org/dayOfWeek", "@container": "@set" },
|
||||
closes: {
|
||||
"@id": "http://schema.org/closes",
|
||||
"@type": "http://www.w3.org/2001/XMLSchema#time"
|
||||
"@type": "http://www.w3.org/2001/XMLSchema#time",
|
||||
},
|
||||
opens: {
|
||||
"@id": "http://schema.org/opens",
|
||||
"@type": "http://www.w3.org/2001/XMLSchema#time"
|
||||
}
|
||||
"@type": "http://www.w3.org/2001/XMLSchema#time",
|
||||
},
|
||||
}
|
||||
private static formatters: Record<"phone" | "email" | "website", Validator> = {
|
||||
phone: new PhoneValidator(),
|
||||
email: new EmailValidator(),
|
||||
website: new UrlValidator(undefined, undefined, true)
|
||||
website: new UrlValidator(undefined, undefined, true),
|
||||
}
|
||||
private static ignoreKeys = [
|
||||
"http://schema.org/logo",
|
||||
|
@ -56,7 +56,7 @@ export default class LinkedDataLoader {
|
|||
"http://schema.org/description",
|
||||
"http://schema.org/hasMap",
|
||||
"http://schema.org/priceRange",
|
||||
"http://schema.org/contactPoint"
|
||||
"http://schema.org/contactPoint",
|
||||
]
|
||||
|
||||
private static shapeToPolygon(str: string): Polygon {
|
||||
|
@ -69,8 +69,8 @@ export default class LinkedDataLoader {
|
|||
.trim()
|
||||
.split(" ")
|
||||
.map((n) => Number(n))
|
||||
)
|
||||
]
|
||||
),
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,18 +92,18 @@ export default class LinkedDataLoader {
|
|||
const context = {
|
||||
lat: {
|
||||
"@id": "http://schema.org/latitude",
|
||||
"@type": "http://www.w3.org/2001/XMLSchema#double"
|
||||
"@type": "http://www.w3.org/2001/XMLSchema#double",
|
||||
},
|
||||
lon: {
|
||||
"@id": "http://schema.org/longitude",
|
||||
"@type": "http://www.w3.org/2001/XMLSchema#double"
|
||||
}
|
||||
"@type": "http://www.w3.org/2001/XMLSchema#double",
|
||||
},
|
||||
}
|
||||
const flattened = await jsonld.compact(geo, context)
|
||||
|
||||
return {
|
||||
type: "Point",
|
||||
coordinates: [Number(flattened.lon), Number(flattened.lat)]
|
||||
coordinates: [Number(flattened.lon), Number(flattened.lat)],
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ export default class LinkedDataLoader {
|
|||
Looking at you, C&A!
|
||||
view-source:https://www.c-and-a.com/stores/be-en/oost-vlaanderen/sint-niklaas/stationsstraat-100.html
|
||||
* */
|
||||
parts = parts.filter(p => !p.match(/.. 00:00-00:00/))
|
||||
parts = parts.filter((p) => !p.match(/.. 00:00-00:00/))
|
||||
// actually the same as OSM-oh
|
||||
return OH.simplify(parts.join(";"))
|
||||
}
|
||||
|
@ -247,18 +247,16 @@ export default class LinkedDataLoader {
|
|||
return await LinkedDataLoader.compact(data, options)
|
||||
}
|
||||
|
||||
|
||||
let htmlContent = await Utils.download(url)
|
||||
const div = document.createElement("div")
|
||||
div.innerHTML = htmlContent
|
||||
const script = Array.from(div.getElementsByTagName("script"))
|
||||
.find(script => script.type === "application/ld+json")
|
||||
|
||||
const script = Array.from(div.getElementsByTagName("script")).find(
|
||||
(script) => script.type === "application/ld+json"
|
||||
)
|
||||
|
||||
const snippet = JSON.parse(script.textContent)
|
||||
snippet["@base"] = url
|
||||
return await LinkedDataLoader.compact(snippet, options)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -309,7 +307,7 @@ export default class LinkedDataLoader {
|
|||
if (properties["latitude"] && properties["longitude"]) {
|
||||
geometry = {
|
||||
type: "Point",
|
||||
coordinates: [Number(properties["longitude"]), Number(properties["latitude"])]
|
||||
coordinates: [Number(properties["longitude"]), Number(properties["latitude"])],
|
||||
}
|
||||
delete properties["latitude"]
|
||||
delete properties["longitude"]
|
||||
|
@ -321,7 +319,7 @@ export default class LinkedDataLoader {
|
|||
const geo: GeoJSON = {
|
||||
type: "Feature",
|
||||
properties,
|
||||
geometry
|
||||
geometry,
|
||||
}
|
||||
delete linkedData.geo
|
||||
delete properties.shape
|
||||
|
@ -439,7 +437,7 @@ export default class LinkedDataLoader {
|
|||
"brede publiek",
|
||||
"iedereen",
|
||||
"bezoekers",
|
||||
"iedereen - vooral bezoekers gemeentehuis of bibliotheek."
|
||||
"iedereen - vooral bezoekers gemeentehuis of bibliotheek.",
|
||||
].indexOf(audience.toLowerCase()) >= 0
|
||||
) {
|
||||
return "yes"
|
||||
|
@ -522,7 +520,7 @@ export default class LinkedDataLoader {
|
|||
mv: "http://schema.mobivoc.org/",
|
||||
gr: "http://purl.org/goodrelations/v1#",
|
||||
vp: "https://data.velopark.be/openvelopark/vocabulary#",
|
||||
vpt: "https://data.velopark.be/openvelopark/terms#"
|
||||
vpt: "https://data.velopark.be/openvelopark/terms#",
|
||||
},
|
||||
[url],
|
||||
undefined,
|
||||
|
@ -543,7 +541,7 @@ export default class LinkedDataLoader {
|
|||
mv: "http://schema.mobivoc.org/",
|
||||
gr: "http://purl.org/goodrelations/v1#",
|
||||
vp: "https://data.velopark.be/openvelopark/vocabulary#",
|
||||
vpt: "https://data.velopark.be/openvelopark/terms#"
|
||||
vpt: "https://data.velopark.be/openvelopark/terms#",
|
||||
},
|
||||
[url],
|
||||
"g",
|
||||
|
@ -686,20 +684,20 @@ export default class LinkedDataLoader {
|
|||
const withProxyUrl = Constants.linkedDataProxy.replace("{url}", encodeURIComponent(url))
|
||||
const optionalPaths: Record<string, string | Record<string, string>> = {
|
||||
"schema:interactionService": {
|
||||
"schema:url": "website"
|
||||
"schema:url": "website",
|
||||
},
|
||||
"mv:operatedBy": {
|
||||
"gr:legalName": "operator"
|
||||
"gr:legalName": "operator",
|
||||
},
|
||||
"schema:contactPoint": {
|
||||
"schema:email": "email",
|
||||
"schema:telephone": "phone"
|
||||
"schema:telephone": "phone",
|
||||
},
|
||||
"schema:dateModified": "_last_edit_timestamp"
|
||||
"schema:dateModified": "_last_edit_timestamp",
|
||||
}
|
||||
if (includeExtras) {
|
||||
optionalPaths["schema:address"] = {
|
||||
"schema:streetAddress": "addr"
|
||||
"schema:streetAddress": "addr",
|
||||
}
|
||||
optionalPaths["schema:name"] = "name"
|
||||
optionalPaths["schema:description"] = "description"
|
||||
|
@ -717,19 +715,19 @@ export default class LinkedDataLoader {
|
|||
"schema:geo": {
|
||||
"schema:latitude": "latitude",
|
||||
"schema:longitude": "longitude",
|
||||
"schema:polygon": "shape"
|
||||
"schema:polygon": "shape",
|
||||
},
|
||||
"schema:priceSpecification": {
|
||||
"mv:freeOfCharge": "fee",
|
||||
"schema:price": "charge"
|
||||
}
|
||||
"schema:price": "charge",
|
||||
},
|
||||
}
|
||||
|
||||
const extra = [
|
||||
"schema:priceSpecification [ mv:dueForTime [ mv:timeStartValue ?chargeStart; mv:timeEndValue ?chargeEnd; mv:timeUnit ?timeUnit ] ]",
|
||||
"vp:allows [vp:bicycleType <https://data.velopark.be/openvelopark/terms#CargoBicycle>; vp:bicyclesAmount ?capacityCargobike; vp:bicycleType ?cargoBikeType]",
|
||||
"vp:allows [vp:bicycleType <https://data.velopark.be/openvelopark/terms#ElectricBicycle>; vp:bicyclesAmount ?capacityElectric; vp:bicycleType ?electricBikeType]",
|
||||
"vp:allows [vp:bicycleType <https://data.velopark.be/openvelopark/terms#TandemBicycle>; vp:bicyclesAmount ?capacityTandem; vp:bicycleType ?tandemBikeType]"
|
||||
"vp:allows [vp:bicycleType <https://data.velopark.be/openvelopark/terms#TandemBicycle>; vp:bicyclesAmount ?capacityTandem; vp:bicycleType ?tandemBikeType]",
|
||||
]
|
||||
|
||||
const unpatched = await this.fetchEntry(
|
||||
|
|
|
@ -206,23 +206,29 @@ export default class FeatureReviews {
|
|||
|
||||
this.subjectUri = this.ConstructSubjectUri()
|
||||
|
||||
this.subjectUri.addCallbackAndRunD(async (sub) => {
|
||||
const reviews = await MangroveReviews.getReviews({ sub })
|
||||
console.log("Got reviews for", feature, reviews, sub)
|
||||
this.addReviews(reviews.reviews, this._name.data)
|
||||
}, [this._name])
|
||||
this.subjectUri.addCallbackAndRunD(
|
||||
async (sub) => {
|
||||
const reviews = await MangroveReviews.getReviews({ sub })
|
||||
console.log("Got reviews for", feature, reviews, sub)
|
||||
this.addReviews(reviews.reviews, this._name.data)
|
||||
},
|
||||
[this._name]
|
||||
)
|
||||
/* We also construct all subject queries _without_ encoding the name to work around a previous bug
|
||||
* See https://github.com/giggls/opencampsitemap/issues/30
|
||||
*/
|
||||
this.ConstructSubjectUri(true).mapD(async (sub) => {
|
||||
try {
|
||||
const reviews = await MangroveReviews.getReviews({ sub })
|
||||
console.log("Got reviews (no-encode) for", feature, reviews, sub)
|
||||
this.addReviews(reviews.reviews, this._name.data)
|
||||
} catch (e) {
|
||||
console.log("Could not fetch reviews for partially incorrect query ", sub)
|
||||
}
|
||||
}, [this._name])
|
||||
this.ConstructSubjectUri(true).mapD(
|
||||
async (sub) => {
|
||||
try {
|
||||
const reviews = await MangroveReviews.getReviews({ sub })
|
||||
console.log("Got reviews (no-encode) for", feature, reviews, sub)
|
||||
this.addReviews(reviews.reviews, this._name.data)
|
||||
} catch (e) {
|
||||
console.log("Could not fetch reviews for partially incorrect query ", sub)
|
||||
}
|
||||
},
|
||||
[this._name]
|
||||
)
|
||||
this.average = this._reviews.map((reviews) => {
|
||||
if (!reviews) {
|
||||
return null
|
||||
|
@ -321,7 +327,10 @@ export default class FeatureReviews {
|
|||
* @param reviews
|
||||
* @private
|
||||
*/
|
||||
private addReviews(reviews: { payload: Review; kid: string; signature: string }[], expectedName: string) {
|
||||
private addReviews(
|
||||
reviews: { payload: Review; kid: string; signature: string }[],
|
||||
expectedName: string
|
||||
) {
|
||||
const alreadyKnown = new Set(this._reviews.data.map((r) => r.rating + " " + r.opinion))
|
||||
|
||||
let hasNew = false
|
||||
|
@ -333,20 +342,17 @@ export default class FeatureReviews {
|
|||
if (url.protocol !== "geo:") {
|
||||
continue
|
||||
}
|
||||
const coordinate = <[number, number]>(
|
||||
url.pathname.split(",").map((n) => Number(n))
|
||||
)
|
||||
const distance = GeoOperations.distanceBetween(
|
||||
[this._lat, this._lon],
|
||||
coordinate
|
||||
)
|
||||
const coordinate = <[number, number]>url.pathname.split(",").map((n) => Number(n))
|
||||
const distance = GeoOperations.distanceBetween([this._lat, this._lon], coordinate)
|
||||
if (distance > this._uncertainty) {
|
||||
continue
|
||||
}
|
||||
const nameUrl = url.searchParams.get("q")
|
||||
const distanceName = Utils.levenshteinDistance(nameUrl.toLowerCase(), expectedName.toLowerCase()) / expectedName.length
|
||||
const nameUrl = url.searchParams.get("q")
|
||||
const distanceName =
|
||||
Utils.levenshteinDistance(nameUrl.toLowerCase(), expectedName.toLowerCase()) /
|
||||
expectedName.length
|
||||
|
||||
if(distanceName > 0.25){
|
||||
if (distanceName > 0.25) {
|
||||
// Then name is wildly different
|
||||
continue
|
||||
}
|
||||
|
@ -356,7 +362,6 @@ export default class FeatureReviews {
|
|||
continue
|
||||
}
|
||||
|
||||
|
||||
const key = review.rating + " " + review.opinion
|
||||
if (alreadyKnown.has(key)) {
|
||||
continue
|
||||
|
|
|
@ -7,12 +7,12 @@ import {
|
|||
FirstOf,
|
||||
Fuse,
|
||||
On,
|
||||
SetDefault
|
||||
SetDefault,
|
||||
} from "./Conversion"
|
||||
import { LayerConfigJson } from "../Json/LayerConfigJson"
|
||||
import {
|
||||
MinimalTagRenderingConfigJson,
|
||||
TagRenderingConfigJson
|
||||
TagRenderingConfigJson,
|
||||
} from "../Json/TagRenderingConfigJson"
|
||||
import { Utils } from "../../../Utils"
|
||||
import RewritableConfigJson from "../Json/RewritableConfigJson"
|
||||
|
@ -85,17 +85,17 @@ class ExpandFilter extends DesugaringStep<LayerConfigJson> {
|
|||
}
|
||||
const options = matchingTr.mappings.map((mapping) => ({
|
||||
question: mapping.then,
|
||||
osmTags: mapping.if
|
||||
osmTags: mapping.if,
|
||||
}))
|
||||
options.unshift({
|
||||
question: {
|
||||
en: "All types"
|
||||
en: "All types",
|
||||
},
|
||||
osmTags: undefined
|
||||
osmTags: undefined,
|
||||
})
|
||||
newFilters.push({
|
||||
id: filter,
|
||||
options
|
||||
options,
|
||||
})
|
||||
continue
|
||||
}
|
||||
|
@ -134,9 +134,9 @@ class ExpandFilter extends DesugaringStep<LayerConfigJson> {
|
|||
.enter(filter)
|
||||
.err(
|
||||
"While searching for predefined filter " +
|
||||
filter +
|
||||
": this filter is not found. Perhaps you meant one of: " +
|
||||
suggestions
|
||||
filter +
|
||||
": this filter is not found. Perhaps you meant one of: " +
|
||||
suggestions
|
||||
)
|
||||
}
|
||||
newFilters.push(found)
|
||||
|
@ -149,9 +149,9 @@ class ExpandTagRendering extends Conversion<
|
|||
| string
|
||||
| TagRenderingConfigJson
|
||||
| {
|
||||
builtin: string | string[]
|
||||
override: any
|
||||
},
|
||||
builtin: string | string[]
|
||||
override: any
|
||||
},
|
||||
TagRenderingConfigJson[]
|
||||
> {
|
||||
private readonly _state: DesugaringContext
|
||||
|
@ -340,25 +340,25 @@ class ExpandTagRendering extends Conversion<
|
|||
ctx.warn(
|
||||
`A literal rendering was detected: ${tr}
|
||||
Did you perhaps forgot to add a layer name as 'layername.${tr}'? ` +
|
||||
Array.from(state.sharedLayers.keys()).join(", ")
|
||||
Array.from(state.sharedLayers.keys()).join(", ")
|
||||
)
|
||||
}
|
||||
|
||||
if (this._options?.noHardcodedStrings && this._state?.sharedLayers?.size > 0) {
|
||||
ctx.err(
|
||||
"Detected an invocation to a builtin tagRendering, but this tagrendering was not found: " +
|
||||
tr +
|
||||
" \n Did you perhaps forget to add the layer as prefix, such as `icons." +
|
||||
tr +
|
||||
"`? "
|
||||
tr +
|
||||
" \n Did you perhaps forget to add the layer as prefix, such as `icons." +
|
||||
tr +
|
||||
"`? "
|
||||
)
|
||||
}
|
||||
|
||||
return [
|
||||
<any>{
|
||||
render: tr,
|
||||
id: tr.replace(/[^a-zA-Z0-9]/g, "")
|
||||
}
|
||||
id: tr.replace(/[^a-zA-Z0-9]/g, ""),
|
||||
},
|
||||
]
|
||||
}
|
||||
return lookup
|
||||
|
@ -385,9 +385,9 @@ class ExpandTagRendering extends Conversion<
|
|||
}
|
||||
ctx.err(
|
||||
"An object calling a builtin can only have keys `builtin` or `override`, but a key with name `" +
|
||||
key +
|
||||
"` was found. This won't be picked up! The full object is: " +
|
||||
JSON.stringify(tr)
|
||||
key +
|
||||
"` was found. This won't be picked up! The full object is: " +
|
||||
JSON.stringify(tr)
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -411,19 +411,19 @@ class ExpandTagRendering extends Conversion<
|
|||
if (state.sharedLayers.size === 0) {
|
||||
ctx.warn(
|
||||
"BOOTSTRAPPING. Rerun generate layeroverview. While reusing tagrendering: " +
|
||||
name +
|
||||
": layer " +
|
||||
layerName +
|
||||
" not found for now, but ignoring as this is a bootstrapping run. "
|
||||
name +
|
||||
": layer " +
|
||||
layerName +
|
||||
" not found for now, but ignoring as this is a bootstrapping run. "
|
||||
)
|
||||
} else {
|
||||
ctx.err(
|
||||
": While reusing tagrendering: " +
|
||||
name +
|
||||
": layer " +
|
||||
layerName +
|
||||
" not found. Maybe you meant one of " +
|
||||
candidates.slice(0, 3).join(", ")
|
||||
name +
|
||||
": layer " +
|
||||
layerName +
|
||||
" not found. Maybe you meant one of " +
|
||||
candidates.slice(0, 3).join(", ")
|
||||
)
|
||||
}
|
||||
continue
|
||||
|
@ -435,10 +435,10 @@ class ExpandTagRendering extends Conversion<
|
|||
candidates = Utils.sortedByLevenshteinDistance(name, candidates, (i) => i)
|
||||
ctx.err(
|
||||
"The tagRendering with identifier " +
|
||||
name +
|
||||
" was not found.\n\tDid you mean one of " +
|
||||
candidates.join(", ") +
|
||||
"?\n(Hint: did you add a new label and are you trying to use this label at the same time? Run 'reset:layeroverview' first"
|
||||
name +
|
||||
" was not found.\n\tDid you mean one of " +
|
||||
candidates.join(", ") +
|
||||
"?\n(Hint: did you add a new label and are you trying to use this label at the same time? Run 'reset:layeroverview' first"
|
||||
)
|
||||
continue
|
||||
}
|
||||
|
@ -492,7 +492,7 @@ class DetectInline extends DesugaringStep<QuestionableTagRenderingConfigJson> {
|
|||
if (json.freeform.inline === true) {
|
||||
context.err(
|
||||
"'inline' is set, but the rendering contains a special visualisation...\n " +
|
||||
spec[key]
|
||||
spec[key]
|
||||
)
|
||||
}
|
||||
json = JSON.parse(JSON.stringify(json))
|
||||
|
@ -578,20 +578,20 @@ export class AddQuestionBox extends DesugaringStep<LayerConfigJson> {
|
|||
if (blacklisted?.length > 0 && used?.length > 0) {
|
||||
context.err(
|
||||
"The {questions()}-special rendering only supports either a blacklist OR a whitelist, but not both." +
|
||||
"\n Whitelisted: " +
|
||||
used.join(", ") +
|
||||
"\n Blacklisted: " +
|
||||
blacklisted.join(", ")
|
||||
"\n Whitelisted: " +
|
||||
used.join(", ") +
|
||||
"\n Blacklisted: " +
|
||||
blacklisted.join(", ")
|
||||
)
|
||||
}
|
||||
for (const usedLabel of used) {
|
||||
if (!allLabels.has(usedLabel)) {
|
||||
context.err(
|
||||
"This layers specifies a special question element for label `" +
|
||||
usedLabel +
|
||||
"`, but this label doesn't exist.\n" +
|
||||
" Available labels are " +
|
||||
Array.from(allLabels).join(", ")
|
||||
usedLabel +
|
||||
"`, but this label doesn't exist.\n" +
|
||||
" Available labels are " +
|
||||
Array.from(allLabels).join(", ")
|
||||
)
|
||||
}
|
||||
seen.add(usedLabel)
|
||||
|
@ -605,8 +605,8 @@ export class AddQuestionBox extends DesugaringStep<LayerConfigJson> {
|
|||
const question: QuestionableTagRenderingConfigJson = {
|
||||
id: "leftover-questions",
|
||||
render: {
|
||||
"*": `{questions( ,${Array.from(seen).join(";")})}`
|
||||
}
|
||||
"*": `{questions( ,${Array.from(seen).join(";")})}`,
|
||||
},
|
||||
}
|
||||
json.tagRenderings.push(question)
|
||||
}
|
||||
|
@ -626,11 +626,11 @@ export class AddEditingElements extends DesugaringStep<LayerConfigJson> {
|
|||
"all_tags",
|
||||
"qr_code",
|
||||
"nearby_images",
|
||||
"linked_open_data"
|
||||
"linked_open_data",
|
||||
]
|
||||
|
||||
private readonly _desugaring: DesugaringContext
|
||||
private readonly _addedByDefaultAtTop : QuestionableTagRenderingConfigJson[]
|
||||
private readonly _addedByDefaultAtTop: QuestionableTagRenderingConfigJson[]
|
||||
private readonly _addedByDefault: QuestionableTagRenderingConfigJson[]
|
||||
constructor(desugaring: DesugaringContext) {
|
||||
super(
|
||||
|
@ -643,17 +643,14 @@ export class AddEditingElements extends DesugaringStep<LayerConfigJson> {
|
|||
const builtinQuestions = Array.from(this._desugaring.tagRenderings?.values() ?? [])
|
||||
|
||||
function getAddedByDefaultIds(key: string): QuestionableTagRenderingConfigJson[] {
|
||||
const addByDefault = builtinQuestions.filter(tr => tr.labels?.indexOf(key) >= 0)
|
||||
const ids = new Set(addByDefault.map(tr => tr.id))
|
||||
const idsInOrder = desugaring.tagRenderingOrder?.filter(id => ids.has(id)) ?? []
|
||||
return Utils.NoNull(idsInOrder.map(id => desugaring.tagRenderings.get(id)))
|
||||
const addByDefault = builtinQuestions.filter((tr) => tr.labels?.indexOf(key) >= 0)
|
||||
const ids = new Set(addByDefault.map((tr) => tr.id))
|
||||
const idsInOrder = desugaring.tagRenderingOrder?.filter((id) => ids.has(id)) ?? []
|
||||
return Utils.NoNull(idsInOrder.map((id) => desugaring.tagRenderings.get(id)))
|
||||
}
|
||||
|
||||
this._addedByDefaultAtTop = getAddedByDefaultIds("added_by_default_top")
|
||||
this._addedByDefault = getAddedByDefaultIds("added_by_default")
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
convert(json: LayerConfigJson, _: ConversionContext): LayerConfigJson {
|
||||
|
@ -681,7 +678,7 @@ export class AddEditingElements extends DesugaringStep<LayerConfigJson> {
|
|||
|
||||
/***** ADD TO TOP ****/
|
||||
|
||||
json.tagRenderings.unshift(...this._addedByDefaultAtTop.filter(tr => !allIds.has(tr.id)))
|
||||
json.tagRenderings.unshift(...this._addedByDefaultAtTop.filter((tr) => !allIds.has(tr.id)))
|
||||
|
||||
/***** ADD TO BOTTOM ****/
|
||||
|
||||
|
@ -689,10 +686,11 @@ export class AddEditingElements extends DesugaringStep<LayerConfigJson> {
|
|||
json.tagRenderings.push(this._desugaring.tagRenderings.get("minimap"))
|
||||
}
|
||||
|
||||
if(usedSpecialFunctions.has("image_upload") &&
|
||||
!usedSpecialFunctions.has("nearby_images")){
|
||||
if (
|
||||
usedSpecialFunctions.has("image_upload") &&
|
||||
!usedSpecialFunctions.has("nearby_images")
|
||||
) {
|
||||
json.tagRenderings.push(this._desugaring.tagRenderings.get("nearby_images"))
|
||||
|
||||
}
|
||||
|
||||
if (json.allowSplit && !usedSpecialFunctions.has("split_button")) {
|
||||
|
@ -703,18 +701,17 @@ export class AddEditingElements extends DesugaringStep<LayerConfigJson> {
|
|||
if (json.allowMove && !usedSpecialFunctions.has("move_button")) {
|
||||
json.tagRenderings.push({
|
||||
id: "move-button",
|
||||
render: { "*": "{move_button()}" }
|
||||
render: { "*": "{move_button()}" },
|
||||
})
|
||||
}
|
||||
if (json.deletion && !usedSpecialFunctions.has("delete_button")) {
|
||||
json.tagRenderings.push({
|
||||
id: "delete-button",
|
||||
render: { "*": "{delete_button()}" }
|
||||
render: { "*": "{delete_button()}" },
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
json.tagRenderings.push(...this._addedByDefault.filter(tr => !allIds.has(tr.id)))
|
||||
json.tagRenderings.push(...this._addedByDefault.filter((tr) => !allIds.has(tr.id)))
|
||||
|
||||
if (!usedSpecialFunctions.has("all_tags")) {
|
||||
const trc: QuestionableTagRenderingConfigJson = {
|
||||
|
@ -725,9 +722,9 @@ export class AddEditingElements extends DesugaringStep<LayerConfigJson> {
|
|||
or: [
|
||||
"__featureSwitchIsDebugging=true",
|
||||
"mapcomplete-show_tags=full",
|
||||
"mapcomplete-show_debug=yes"
|
||||
]
|
||||
}
|
||||
"mapcomplete-show_debug=yes",
|
||||
],
|
||||
},
|
||||
}
|
||||
json.tagRenderings?.push(trc)
|
||||
}
|
||||
|
@ -749,9 +746,9 @@ export class RewriteSpecial extends DesugaringStep<TagRenderingConfigJson> {
|
|||
}
|
||||
|
||||
private static escapeStr(v: string, context: ConversionContext): string {
|
||||
if(typeof v !== "string"){
|
||||
context.err("Detected a non-string value where one expected a string: "+v)
|
||||
return RewriteSpecial.escapeStr(""+v, context)
|
||||
if (typeof v !== "string") {
|
||||
context.err("Detected a non-string value where one expected a string: " + v)
|
||||
return RewriteSpecial.escapeStr("" + v, context)
|
||||
}
|
||||
return v
|
||||
.replace(/,/g, "&COMMA")
|
||||
|
@ -835,10 +832,10 @@ export class RewriteSpecial extends DesugaringStep<TagRenderingConfigJson> {
|
|||
private static convertIfNeeded(
|
||||
input:
|
||||
| (object & {
|
||||
special: {
|
||||
type: string
|
||||
}
|
||||
})
|
||||
special: {
|
||||
type: string
|
||||
}
|
||||
})
|
||||
| any,
|
||||
context: ConversionContext
|
||||
): any {
|
||||
|
@ -924,7 +921,6 @@ export class RewriteSpecial extends DesugaringStep<TagRenderingConfigJson> {
|
|||
const after = Translations.T(input.after)
|
||||
const clss: string = input.class !== undefined ? ":" + input.class : ""
|
||||
|
||||
|
||||
for (const ln of Object.keys(before?.translations ?? {})) {
|
||||
foundLanguages.add(ln)
|
||||
}
|
||||
|
@ -937,7 +933,7 @@ export class RewriteSpecial extends DesugaringStep<TagRenderingConfigJson> {
|
|||
.map((nm) => RewriteSpecial.escapeStr(special[nm] ?? "", context))
|
||||
.join(",")
|
||||
return {
|
||||
"*": `{${type}(${args})${clss}}`
|
||||
"*": `{${type}(${args})${clss}}`,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -962,7 +958,9 @@ export class RewriteSpecial extends DesugaringStep<TagRenderingConfigJson> {
|
|||
}
|
||||
const beforeText = before?.textFor(ln) ?? ""
|
||||
const afterText = after?.textFor(ln) ?? ""
|
||||
result[ln] = `${beforeText}{${type}(${args.map((a) => a).join(",")})${clss}}${afterText}`
|
||||
result[ln] = `${beforeText}{${type}(${args
|
||||
.map((a) => a)
|
||||
.join(",")})${clss}}${afterText}`
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
@ -1049,7 +1047,7 @@ class ExpandIconBadges extends DesugaringStep<PointRenderingConfigJson> {
|
|||
iconBadges.push(
|
||||
...expanded.map((resolved) => ({
|
||||
if: iconBadge.if,
|
||||
then: <MinimalTagRenderingConfigJson>resolved
|
||||
then: <MinimalTagRenderingConfigJson>resolved,
|
||||
}))
|
||||
)
|
||||
}
|
||||
|
@ -1186,7 +1184,7 @@ export class AddRatingBadge extends DesugaringStep<LayerConfigJson> {
|
|||
|
||||
const specialVis: Exclude<RenderingSpecification, string>[] = <
|
||||
Exclude<RenderingSpecification, string>[]
|
||||
>ValidationUtils.getAllSpecialVisualisations(<any>json.tagRenderings).filter(
|
||||
>ValidationUtils.getAllSpecialVisualisations(<any>json.tagRenderings).filter(
|
||||
(rs) => typeof rs !== "string"
|
||||
)
|
||||
const funcs = new Set<string>(specialVis.map((rs) => rs.func.funcName))
|
||||
|
@ -1222,7 +1220,7 @@ export class AutoTitleIcon extends DesugaringStep<LayerConfigJson> {
|
|||
}
|
||||
return <TagRenderingConfigJson>{
|
||||
id: "title_icon_auto_" + tr.id,
|
||||
mappings
|
||||
mappings,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1267,8 +1265,8 @@ export class AutoTitleIcon extends DesugaringStep<LayerConfigJson> {
|
|||
.enters("titleIcons", i)
|
||||
.warn(
|
||||
"TagRendering with id " +
|
||||
trId +
|
||||
" does not have any icons, not generating an icon for this"
|
||||
trId +
|
||||
" does not have any icons, not generating an icon for this"
|
||||
)
|
||||
continue
|
||||
}
|
||||
|
@ -1292,7 +1290,7 @@ export class PrepareLayer extends Fuse<LayerConfigJson> {
|
|||
(layer) =>
|
||||
new Concat(
|
||||
new ExpandTagRendering(state, layer, {
|
||||
addToContext: options?.addTagRenderingsToContext ?? false
|
||||
addToContext: options?.addTagRenderingsToContext ?? false,
|
||||
})
|
||||
)
|
||||
),
|
||||
|
|
|
@ -278,8 +278,7 @@ export default class LayerConfig extends WithContextLoader {
|
|||
)
|
||||
}
|
||||
this.units = (json.units ?? []).flatMap((unitJson, i) =>
|
||||
Unit.fromJson(unitJson, this.tagRenderings, `${context}.unit[${i}]`)
|
||||
|
||||
Unit.fromJson(unitJson, this.tagRenderings, `${context}.unit[${i}]`)
|
||||
)
|
||||
|
||||
if (
|
||||
|
|
|
@ -205,7 +205,7 @@ export default class PointRenderingConfig extends WithContextLoader {
|
|||
marker: this.marker,
|
||||
rotation: this.rotation,
|
||||
tags,
|
||||
emojiHeight: iconH
|
||||
emojiHeight: iconH,
|
||||
}).SetClass("w-full h-full")
|
||||
: undefined
|
||||
let badges = undefined
|
||||
|
|
|
@ -8,7 +8,7 @@ import { Tag } from "../../Logic/Tags/Tag"
|
|||
import Link from "../../UI/Base/Link"
|
||||
import {
|
||||
MappingConfigJson,
|
||||
QuestionableTagRenderingConfigJson
|
||||
QuestionableTagRenderingConfigJson,
|
||||
} from "./Json/QuestionableTagRenderingConfigJson"
|
||||
import Validators, { ValidatorType } from "../../UI/InputElement/Validators"
|
||||
import { TagRenderingConfigJson } from "./Json/TagRenderingConfigJson"
|
||||
|
@ -202,7 +202,7 @@ export default class TagRenderingConfig {
|
|||
) ?? [],
|
||||
inline: json.freeform.inline ?? false,
|
||||
default: json.freeform.default,
|
||||
postfixDistinguished: json.freeform.postfixDistinguished?.trim()
|
||||
postfixDistinguished: json.freeform.postfixDistinguished?.trim(),
|
||||
}
|
||||
if (json.freeform["extraTags"] !== undefined) {
|
||||
throw `Freeform.extraTags is defined. This should probably be 'freeform.addExtraTag' (at ${context})`
|
||||
|
@ -414,7 +414,7 @@ export default class TagRenderingConfig {
|
|||
iconClass,
|
||||
addExtraTags,
|
||||
searchTerms: mapping.searchTerms,
|
||||
priorityIf: prioritySearch
|
||||
priorityIf: prioritySearch,
|
||||
}
|
||||
if (isQuestionable) {
|
||||
if (hideInAnswer !== true && mp.if !== undefined && !mp.if.isUsableAsAnswer()) {
|
||||
|
@ -515,7 +515,7 @@ export default class TagRenderingConfig {
|
|||
then: new TypedTranslation<object>(
|
||||
this.render.replace("{" + this.freeform.key + "}", leftover).translations,
|
||||
this.render.context
|
||||
)
|
||||
),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -565,7 +565,7 @@ export default class TagRenderingConfig {
|
|||
return {
|
||||
then: this.render.PartialSubs({ [this.freeform.key]: v.trim() }),
|
||||
icon: this.renderIcon,
|
||||
iconClass: this.renderIconClass
|
||||
iconClass: this.renderIconClass,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -620,7 +620,7 @@ export default class TagRenderingConfig {
|
|||
key: commonKey,
|
||||
values: Utils.NoNull(
|
||||
values.map((arr) => arr.filter((item) => item.k === commonKey)[0]?.v)
|
||||
)
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -635,7 +635,7 @@ export default class TagRenderingConfig {
|
|||
return {
|
||||
key,
|
||||
type: this.freeform.type,
|
||||
values
|
||||
values,
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Could not create FreeformValues for tagrendering", this.id)
|
||||
|
@ -741,7 +741,7 @@ export default class TagRenderingConfig {
|
|||
// Either no mappings, or this is a radio-button selected freeform value
|
||||
const tag = new And([
|
||||
new Tag(this.freeform.key, freeformValue),
|
||||
...(this.freeform.addExtraTags ?? [])
|
||||
...(this.freeform.addExtraTags ?? []),
|
||||
])
|
||||
const newProperties = tag.applyOn(currentProperties)
|
||||
if (this.invalidValues?.matchesProperties(newProperties)) {
|
||||
|
@ -765,7 +765,7 @@ export default class TagRenderingConfig {
|
|||
selectedMappings.push(
|
||||
new And([
|
||||
new Tag(this.freeform.key, freeformValue),
|
||||
...(this.freeform.addExtraTags ?? [])
|
||||
...(this.freeform.addExtraTags ?? []),
|
||||
])
|
||||
)
|
||||
}
|
||||
|
@ -793,12 +793,12 @@ export default class TagRenderingConfig {
|
|||
if (useFreeform) {
|
||||
return new And([
|
||||
new Tag(this.freeform.key, freeformValue),
|
||||
...(this.freeform.addExtraTags ?? [])
|
||||
...(this.freeform.addExtraTags ?? []),
|
||||
])
|
||||
} else if (singleSelectedMapping !== undefined) {
|
||||
return new And([
|
||||
this.mappings[singleSelectedMapping].if,
|
||||
...(this.mappings[singleSelectedMapping].addExtraTags ?? [])
|
||||
...(this.mappings[singleSelectedMapping].addExtraTags ?? []),
|
||||
])
|
||||
} else {
|
||||
console.error("TagRenderingConfig.ConstructSpecification has a weird fallback for", {
|
||||
|
@ -806,7 +806,7 @@ export default class TagRenderingConfig {
|
|||
singleSelectedMapping,
|
||||
multiSelectedMapping,
|
||||
currentProperties,
|
||||
useFreeform
|
||||
useFreeform,
|
||||
})
|
||||
|
||||
return undefined
|
||||
|
@ -819,7 +819,7 @@ export default class TagRenderingConfig {
|
|||
withRender = [
|
||||
`This rendering asks information about the property `,
|
||||
Link.OsmWiki(this.freeform.key).AsMarkdown(),
|
||||
"This is rendered with `" + this.render.txt + "`"
|
||||
"This is rendered with `" + this.render.txt + "`",
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -829,14 +829,18 @@ export default class TagRenderingConfig {
|
|||
this.mappings.flatMap((m) => {
|
||||
let icon = ""
|
||||
if (m.icon?.indexOf(";") < 0) {
|
||||
icon = "<img src='https://raw.githubusercontent.com/pietervdvn/MapComplete/develop/" + m.icon + "' style='width: 3rem; height: 3rem'>"
|
||||
icon =
|
||||
"<img src='https://raw.githubusercontent.com/pietervdvn/MapComplete/develop/" +
|
||||
m.icon +
|
||||
"' style='width: 3rem; height: 3rem'>"
|
||||
}
|
||||
const msgs: string[] = [
|
||||
icon + " " +
|
||||
"*" +
|
||||
m.then.txt +
|
||||
"* corresponds with " +
|
||||
m.if.asHumanString(true, false, {})
|
||||
icon +
|
||||
" " +
|
||||
"*" +
|
||||
m.then.txt +
|
||||
"* corresponds with " +
|
||||
m.if.asHumanString(true, false, {}),
|
||||
]
|
||||
|
||||
if (m.hideInAnswer === true) {
|
||||
|
@ -845,7 +849,7 @@ export default class TagRenderingConfig {
|
|||
if (m.ifnot !== undefined) {
|
||||
msgs.push(
|
||||
"Unselecting this answer will add " +
|
||||
m.ifnot.asHumanString(true, false, {})
|
||||
m.ifnot.asHumanString(true, false, {})
|
||||
)
|
||||
}
|
||||
return msgs
|
||||
|
@ -869,7 +873,7 @@ export default class TagRenderingConfig {
|
|||
if (this.labels?.length > 0) {
|
||||
labels = [
|
||||
"This tagrendering has labels ",
|
||||
...this.labels.map((label) => "`" + label + "`")
|
||||
...this.labels.map((label) => "`" + label + "`"),
|
||||
].join("\n")
|
||||
}
|
||||
|
||||
|
@ -882,7 +886,7 @@ export default class TagRenderingConfig {
|
|||
withRender.join("\n"),
|
||||
mappings,
|
||||
condition,
|
||||
labels
|
||||
labels,
|
||||
].join("\n")
|
||||
}
|
||||
|
||||
|
@ -942,7 +946,7 @@ export class TagRenderingConfigUtils {
|
|||
const oldMappingsCloned =
|
||||
clone.mappings?.map((m) => ({
|
||||
...m,
|
||||
priorityIf: m.priorityIf ?? TagUtils.Tag("id~*")
|
||||
priorityIf: m.priorityIf ?? TagUtils.Tag("id~*"),
|
||||
})) ?? []
|
||||
clone.mappings = [...oldMappingsCloned, ...extraMappings]
|
||||
return clone
|
||||
|
|
|
@ -5,7 +5,7 @@ import { Store, UIEventSource } from "../Logic/UIEventSource"
|
|||
import {
|
||||
FeatureSource,
|
||||
IndexedFeatureSource,
|
||||
WritableFeatureSource
|
||||
WritableFeatureSource,
|
||||
} from "../Logic/FeatureSource/FeatureSource"
|
||||
import { OsmConnection } from "../Logic/Osm/OsmConnection"
|
||||
import { ExportableMap, MapProperties } from "./MapProperties"
|
||||
|
@ -51,7 +51,7 @@ import SaveFeatureSourceToLocalStorage from "../Logic/FeatureSource/Actors/SaveF
|
|||
import BBoxFeatureSource from "../Logic/FeatureSource/Sources/TouchesBboxFeatureSource"
|
||||
import ThemeViewStateHashActor from "../Logic/Web/ThemeViewStateHashActor"
|
||||
import NoElementsInViewDetector, {
|
||||
FeatureViewState
|
||||
FeatureViewState,
|
||||
} from "../Logic/Actors/NoElementsInViewDetector"
|
||||
import FilteredLayer from "./FilteredLayer"
|
||||
import { PreferredRasterLayerSelector } from "../Logic/Actors/PreferredRasterLayerSelector"
|
||||
|
@ -64,7 +64,7 @@ import { GeolocationControlState } from "../UI/BigComponents/GeolocationControl"
|
|||
import Zoomcontrol from "../UI/Zoomcontrol"
|
||||
import {
|
||||
SummaryTileSource,
|
||||
SummaryTileSourceRewriter
|
||||
SummaryTileSourceRewriter,
|
||||
} from "../Logic/FeatureSource/TiledFeatureSource/SummaryTileSource"
|
||||
import summaryLayer from "../assets/generated/layers/summary.json"
|
||||
import last_click_layerconfig from "../assets/generated/layers/last_click.json"
|
||||
|
@ -165,7 +165,6 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
const initial = new InitialMapPositioning(layout, geolocationState)
|
||||
this.mapProperties = new MapLibreAdaptor(this.map, initial)
|
||||
|
||||
|
||||
this.featureSwitchIsTesting = this.featureSwitches.featureSwitchIsTesting
|
||||
this.featureSwitchUserbadge = this.featureSwitches.featureSwitchEnableLogin
|
||||
|
||||
|
@ -176,7 +175,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
"oauth_token",
|
||||
undefined,
|
||||
"Used to complete the login"
|
||||
)
|
||||
),
|
||||
})
|
||||
this.userRelatedState = new UserRelatedState(
|
||||
this.osmConnection,
|
||||
|
@ -251,8 +250,8 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
bbox.asGeoJson({
|
||||
zoom: this.mapProperties.zoom.data,
|
||||
...this.mapProperties.location.data,
|
||||
id: "current_view_" + currentViewIndex
|
||||
})
|
||||
id: "current_view_" + currentViewIndex,
|
||||
}),
|
||||
]
|
||||
})
|
||||
)
|
||||
|
@ -269,7 +268,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
featurePropertiesStore: this.featureProperties,
|
||||
osmConnection: this.osmConnection,
|
||||
historicalUserLocations: this.geolocation.historicalUserLocations,
|
||||
featureSwitches: this.featureSwitches
|
||||
featureSwitches: this.featureSwitches,
|
||||
},
|
||||
layout?.isLeftRightSensitive() ?? false
|
||||
)
|
||||
|
@ -296,7 +295,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
"leftover features, such as",
|
||||
features[0].properties
|
||||
)
|
||||
}
|
||||
},
|
||||
}
|
||||
)
|
||||
this.perLayer = perLayer.perLayer
|
||||
|
@ -334,7 +333,10 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
return sorted
|
||||
})
|
||||
|
||||
this.lastClickObject = new LastClickFeatureSource(this.layout, this.mapProperties.lastClickLocation)
|
||||
this.lastClickObject = new LastClickFeatureSource(
|
||||
this.layout,
|
||||
this.mapProperties.lastClickLocation
|
||||
)
|
||||
|
||||
this.osmObjectDownloader = new OsmObjectDownloader(
|
||||
this.osmConnection.Backend(),
|
||||
|
@ -348,7 +350,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
{
|
||||
currentZoom: this.mapProperties.zoom,
|
||||
layerState: this.layerState,
|
||||
bounds: this.visualFeedbackViewportBounds
|
||||
bounds: this.visualFeedbackViewportBounds,
|
||||
}
|
||||
)
|
||||
this.hasDataInView = new NoElementsInViewDetector(this).hasFeatureInView
|
||||
|
@ -440,7 +442,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
doShowLayer,
|
||||
metaTags: this.userRelatedState.preferencesAsTags,
|
||||
selectedElement: this.selectedElement,
|
||||
fetchStore: (id) => this.featureProperties.getStore(id)
|
||||
fetchStore: (id) => this.featureProperties.getStore(id),
|
||||
})
|
||||
})
|
||||
return filteringFeatureSource
|
||||
|
@ -464,7 +466,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
doShowLayer: flayerGps.isDisplayed,
|
||||
layer: flayerGps.layerDef,
|
||||
metaTags: this.userRelatedState.preferencesAsTags,
|
||||
selectedElement: this.selectedElement
|
||||
selectedElement: this.selectedElement,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -556,7 +558,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
Hotkeys.RegisterHotkey(
|
||||
{
|
||||
nomod: " ",
|
||||
onUp: true
|
||||
onUp: true,
|
||||
},
|
||||
docs.selectItem,
|
||||
() => {
|
||||
|
@ -586,7 +588,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
Hotkeys.RegisterHotkey(
|
||||
{
|
||||
nomod: "" + i,
|
||||
onUp: true
|
||||
onUp: true,
|
||||
},
|
||||
doc,
|
||||
() => this.selectClosestAtCenter(i - 1)
|
||||
|
@ -599,7 +601,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
}
|
||||
Hotkeys.RegisterHotkey(
|
||||
{
|
||||
nomod: "b"
|
||||
nomod: "b",
|
||||
},
|
||||
docs.openLayersPanel,
|
||||
() => {
|
||||
|
@ -610,7 +612,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
)
|
||||
Hotkeys.RegisterHotkey(
|
||||
{
|
||||
nomod: "s"
|
||||
nomod: "s",
|
||||
},
|
||||
Translations.t.hotkeyDocumentation.openFilterPanel,
|
||||
() => {
|
||||
|
@ -668,7 +670,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
|
||||
Hotkeys.RegisterHotkey(
|
||||
{
|
||||
shift: "T"
|
||||
shift: "T",
|
||||
},
|
||||
Translations.t.hotkeyDocumentation.translationMode,
|
||||
() => {
|
||||
|
@ -700,7 +702,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
this.mapProperties.zoom.map((z) => Math.max(Math.floor(z), 0)),
|
||||
this.mapProperties,
|
||||
{
|
||||
isActive: this.mapProperties.zoom.map((z) => z <= maxzoom)
|
||||
isActive: this.mapProperties.zoom.map((z) => z <= maxzoom),
|
||||
}
|
||||
)
|
||||
return new SummaryTileSourceRewriter(summaryTileSource, this.layerState.filteredLayers)
|
||||
|
@ -715,10 +717,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
/**
|
||||
* A listing which maps the layerId onto the featureSource
|
||||
*/
|
||||
const specialLayers: Record<
|
||||
AddedByDefaultTypes | "current_view",
|
||||
FeatureSource
|
||||
> = {
|
||||
const specialLayers: Record<AddedByDefaultTypes | "current_view", FeatureSource> = {
|
||||
home_location: this.userRelatedState.homeLocation,
|
||||
gps_location: this.geolocation.currentUserLocation,
|
||||
gps_location_history: this.geolocation.historicalUserLocations,
|
||||
|
@ -734,7 +733,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
current_view: this.currentView,
|
||||
favourite: this.favourites,
|
||||
summary: this.featureSummary,
|
||||
last_click: this.lastClickObject
|
||||
last_click: this.lastClickObject,
|
||||
}
|
||||
|
||||
this.closestFeatures.registerSource(specialLayers.favourite, "favourite")
|
||||
|
@ -789,7 +788,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
doShowLayer: flayer.isDisplayed,
|
||||
layer: flayer.layerDef,
|
||||
metaTags: this.userRelatedState.preferencesAsTags,
|
||||
selectedElement: this.selectedElement
|
||||
selectedElement: this.selectedElement,
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -797,23 +796,29 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
features: specialLayers.summary,
|
||||
layer: new LayerConfig(<LayerConfigJson>summaryLayer, "summaryLayer"),
|
||||
// doShowLayer: this.mapProperties.zoom.map((z) => z < maxzoom),
|
||||
selectedElement: this.selectedElement
|
||||
selectedElement: this.selectedElement,
|
||||
})
|
||||
|
||||
const lastClickLayerConfig = new LayerConfig(<LayerConfigJson>last_click_layerconfig, "last_click")
|
||||
const lastClickLayerConfig = new LayerConfig(
|
||||
<LayerConfigJson>last_click_layerconfig,
|
||||
"last_click"
|
||||
)
|
||||
const lastClickFiltered =
|
||||
lastClickLayerConfig.isShown === undefined ? specialLayers.last_click :
|
||||
specialLayers.last_click.features.mapD(fs =>
|
||||
fs.filter(
|
||||
f => {
|
||||
const matches = lastClickLayerConfig.isShown.matchesProperties(f.properties)
|
||||
console.log("LastClick ",f,"matches",matches)
|
||||
return matches
|
||||
}))
|
||||
lastClickLayerConfig.isShown === undefined
|
||||
? specialLayers.last_click
|
||||
: specialLayers.last_click.features.mapD((fs) =>
|
||||
fs.filter((f) => {
|
||||
const matches = lastClickLayerConfig.isShown.matchesProperties(
|
||||
f.properties
|
||||
)
|
||||
console.log("LastClick ", f, "matches", matches)
|
||||
return matches
|
||||
})
|
||||
)
|
||||
new ShowDataLayer(this.map, {
|
||||
features: new StaticFeatureSource(lastClickFiltered),
|
||||
layer: lastClickLayerConfig,
|
||||
onClick: feature => {
|
||||
onClick: (feature) => {
|
||||
console.log("Last click was clicked", feature)
|
||||
if (this.mapProperties.zoom.data >= Constants.minZoomLevelToAddNewPoint) {
|
||||
this.selectedElement.setData(feature)
|
||||
|
@ -821,9 +826,9 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
}
|
||||
this.map.data.flyTo({
|
||||
zoom: Constants.minZoomLevelToAddNewPoint,
|
||||
center: GeoOperations.centerpointCoordinates(feature)
|
||||
center: GeoOperations.centerpointCoordinates(feature),
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -27,9 +27,19 @@ export class Unit {
|
|||
) {
|
||||
this.quantity = quantity
|
||||
this._validator = validator
|
||||
if(!inverted && ["string","text","key","icon","translation","fediverse","id"].indexOf(validator.name) >= 0){
|
||||
if (
|
||||
!inverted &&
|
||||
["string", "text", "key", "icon", "translation", "fediverse", "id"].indexOf(
|
||||
validator.name
|
||||
) >= 0
|
||||
) {
|
||||
console.trace("Unit error")
|
||||
throw "Invalid unit configuration. The validator is of a forbidden type: "+validator.name+"; set a (number) type to your freeform key or set inverted. Hint: this unit is applied onto keys: "+appliesToKeys.join("; ")
|
||||
throw (
|
||||
"Invalid unit configuration. The validator is of a forbidden type: " +
|
||||
validator.name +
|
||||
"; set a (number) type to your freeform key or set inverted. Hint: this unit is applied onto keys: " +
|
||||
appliesToKeys.join("; ")
|
||||
)
|
||||
}
|
||||
this.inverted = inverted
|
||||
this.appliesToKeys = new Set(appliesToKeys)
|
||||
|
|
|
@ -84,18 +84,18 @@
|
|||
<Logo alt="MapComplete Logo" class="h-12 w-12 sm:h-24 sm:w-24" />
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col link-underline">
|
||||
<div class="link-underline flex flex-col">
|
||||
<h1 class="m-0 font-extrabold tracking-tight md:text-6xl">
|
||||
<Tr t={t.title} />
|
||||
</h1>
|
||||
<Tr
|
||||
cls="mr-4 text-base font-semibold sm:text-lg md:mt-5 md:text-xl lg:mx-0"
|
||||
t={Translations.t.index.intro}
|
||||
/>
|
||||
<a href="#about">
|
||||
<Tr t={Translations.t.index.learnMore} />
|
||||
<ChevronDoubleRight class="inline h-4 w-4" />
|
||||
</a>
|
||||
<Tr
|
||||
cls="mr-4 text-base font-semibold sm:text-lg md:mt-5 md:text-xl lg:mx-0"
|
||||
t={Translations.t.index.intro}
|
||||
/>
|
||||
<a href="#about">
|
||||
<Tr t={Translations.t.index.learnMore} />
|
||||
<ChevronDoubleRight class="inline h-4 w-4" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -146,48 +146,47 @@
|
|||
<UnofficialThemeList search={themeSearchText} {state} />
|
||||
</LoginToggle>
|
||||
|
||||
<h3 id="about">
|
||||
<Tr t={Translations.t.index.about} />
|
||||
</h3>
|
||||
<Tr cls="link-underline" t={Translations.t.general.aboutMapComplete.intro} />
|
||||
<h3 id="about">
|
||||
<Tr t={Translations.t.index.about} />
|
||||
</h3>
|
||||
<Tr cls="link-underline" t={Translations.t.general.aboutMapComplete.intro} />
|
||||
|
||||
<span class="link-underline flex flex-col gap-y-1">
|
||||
<a class="flex" href="https://github.com/pietervdvn/MapComplete/" target="_blank">
|
||||
<Github class="mr-2 h-6 w-6" />
|
||||
<Tr t={Translations.t.general.attribution.gotoSourceCode} />
|
||||
</a>
|
||||
<a class="flex" href="https://github.com/pietervdvn/MapComplete/issues" target="_blank">
|
||||
<Bug class="mr-2 h-6 w-6" />
|
||||
<Tr t={Translations.t.general.attribution.openIssueTracker} />
|
||||
</a>
|
||||
<span class="link-underline flex flex-col gap-y-1">
|
||||
<a class="flex" href="https://github.com/pietervdvn/MapComplete/" target="_blank">
|
||||
<Github class="mr-2 h-6 w-6" />
|
||||
<Tr t={Translations.t.general.attribution.gotoSourceCode} />
|
||||
</a>
|
||||
<a class="flex" href="https://github.com/pietervdvn/MapComplete/issues" target="_blank">
|
||||
<Bug class="mr-2 h-6 w-6" />
|
||||
<Tr t={Translations.t.general.attribution.openIssueTracker} />
|
||||
</a>
|
||||
|
||||
<a class="flex" href="https://en.osm.town/@MapComplete" target="_blank">
|
||||
<Mastodon class="mr-2 h-6 w-6" />
|
||||
<Tr t={Translations.t.general.attribution.followOnMastodon} />
|
||||
</a>
|
||||
<a class="flex" href="https://en.osm.town/@MapComplete" target="_blank">
|
||||
<Mastodon class="mr-2 h-6 w-6" />
|
||||
<Tr t={Translations.t.general.attribution.followOnMastodon} />
|
||||
</a>
|
||||
|
||||
<a class="flex" href="https://liberapay.com/pietervdvn/" target="_blank">
|
||||
<Liberapay class="mr-2 h-6 w-6" />
|
||||
<Tr t={Translations.t.general.attribution.donate} />
|
||||
</a>
|
||||
<a class="flex" href="https://liberapay.com/pietervdvn/" target="_blank">
|
||||
<Liberapay class="mr-2 h-6 w-6" />
|
||||
<Tr t={Translations.t.general.attribution.donate} />
|
||||
</a>
|
||||
|
||||
<a
|
||||
class="flex"
|
||||
href={window.location.protocol + "//" + window.location.host + "/studio.html"}
|
||||
>
|
||||
<Pencil class="mr-2 h-6 w-6" />
|
||||
<Tr t={Translations.t.general.morescreen.createYourOwnTheme} />
|
||||
</a>
|
||||
|
||||
<a
|
||||
class="flex"
|
||||
href={window.location.protocol + "//" + window.location.host + "/privacy.html"}
|
||||
>
|
||||
<Eye class="mr-2 h-6 w-6" />
|
||||
<Tr t={Translations.t.privacy.title} />
|
||||
</a>
|
||||
</span>
|
||||
<a
|
||||
class="flex"
|
||||
href={window.location.protocol + "//" + window.location.host + "/studio.html"}
|
||||
>
|
||||
<Pencil class="mr-2 h-6 w-6" />
|
||||
<Tr t={Translations.t.general.morescreen.createYourOwnTheme} />
|
||||
</a>
|
||||
|
||||
<a
|
||||
class="flex"
|
||||
href={window.location.protocol + "//" + window.location.host + "/privacy.html"}
|
||||
>
|
||||
<Eye class="mr-2 h-6 w-6" />
|
||||
<Tr t={Translations.t.privacy.title} />
|
||||
</a>
|
||||
</span>
|
||||
|
||||
<Tr t={tr.streetcomplete} />
|
||||
|
||||
|
|
|
@ -20,10 +20,18 @@
|
|||
style="background-color: #00000088; z-index: 20"
|
||||
/>
|
||||
<!-- draw a _second_ absolute div, placed using 'bottom' which will be above the navigation bar on mobile browsers -->
|
||||
<div class="absolute bottom-0 right-0 h-full w-screen p-4 md:p-6 pointer-events-none" style="z-index: 21" on:click={() =>{
|
||||
console.log("Closing...")
|
||||
dispatch("close")}}>
|
||||
<div class="content normal-background h-full pointer-events-auto" on:click|stopPropagation={() => {}}>
|
||||
<div
|
||||
class="pointer-events-none absolute bottom-0 right-0 h-full w-screen p-4 md:p-6"
|
||||
style="z-index: 21"
|
||||
on:click={() => {
|
||||
console.log("Closing...")
|
||||
dispatch("close")
|
||||
}}
|
||||
>
|
||||
<div
|
||||
class="content normal-background pointer-events-auto h-full"
|
||||
on:click|stopPropagation={() => {}}
|
||||
>
|
||||
<div class="h-full rounded-xl">
|
||||
<slot />
|
||||
</div>
|
||||
|
|
|
@ -38,8 +38,6 @@
|
|||
function getStateFor(option: FilterConfig): UIEventSource<number | string> {
|
||||
return filteredLayer.appliedFilters.get(option.id)
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
{#if filteredLayer.layerDef.name}
|
||||
|
|
|
@ -27,9 +27,8 @@ export default class MoreScreen {
|
|||
if (searchTerm === "osmcha" || searchTerm === "stats") {
|
||||
window.location.href = Utils.OsmChaLinkFor(7)
|
||||
}
|
||||
if (searchTerm === "studio" ) {
|
||||
if (searchTerm === "studio") {
|
||||
window.location.href = "./studio.html"
|
||||
|
||||
}
|
||||
// Enter pressed -> search the first _official_ matchin theme and open it
|
||||
const publicTheme = MoreScreen.officialThemes.find(
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
selectedElement.properties.id
|
||||
)
|
||||
|
||||
function getLayer(properties: Record<string, string>){
|
||||
if(properties.id === "settings"){
|
||||
return UserRelatedState.usersettingsConfig
|
||||
function getLayer(properties: Record<string, string>) {
|
||||
if (properties.id === "settings") {
|
||||
return UserRelatedState.usersettingsConfig
|
||||
}
|
||||
if (properties.id === "new_point_dialog") {
|
||||
return state.layout.layers.find((l) => l.id === "last_click")
|
||||
|
@ -36,7 +36,6 @@
|
|||
|
||||
let layer: LayerConfig = getLayer(selectedElement.properties)
|
||||
|
||||
|
||||
let stillMatches = tags.map(
|
||||
(tags) => !layer?.source?.osmTags || layer.source.osmTags?.matchesProperties(tags)
|
||||
)
|
||||
|
|
|
@ -86,12 +86,12 @@
|
|||
</script>
|
||||
|
||||
{#if theme.id !== personal.id || $unlockedPersonal}
|
||||
<a class={"flex w-full items-center text-ellipsis rounded my-2"} href={$href}>
|
||||
<Marker icons={theme.icon} size="m-1 block h-11 w-11 sm:mr-2 shrink-0"/>
|
||||
<a class={"my-2 flex w-full items-center text-ellipsis rounded"} href={$href}>
|
||||
<Marker icons={theme.icon} size="m-1 block h-11 w-11 sm:mr-2 shrink-0" />
|
||||
|
||||
<span class="flex flex-col overflow-hidden text-ellipsis font-bold text-xl">
|
||||
<span class="flex flex-col overflow-hidden text-ellipsis text-xl font-bold">
|
||||
<Tr cls="underline" t={title} />
|
||||
<Tr cls="subtle text-base" t={description}/>
|
||||
<Tr cls="subtle text-base" t={description} />
|
||||
|
||||
{#if selected}
|
||||
<span class="thanks hidden-on-mobile" aria-hidden="true">
|
||||
|
|
|
@ -150,13 +150,12 @@
|
|||
</div>
|
||||
|
||||
<If condition={state.featureSwitches.featureSwitchBackToThemeOverview}>
|
||||
|
||||
<div class="link-underline w-full m-2 mx-4 flex">
|
||||
<!-- bottom buttons, a bit hidden away: switch layout -->
|
||||
<a class="flex justify-end items-center w-fit" href={Utils.HomepageLink()}>
|
||||
<ChevronDoubleLeft class="w-4 h-4" />
|
||||
<Tr t={Translations.t.general.backToIndex} />
|
||||
</a>
|
||||
</div>
|
||||
<div class="link-underline m-2 mx-4 flex w-full">
|
||||
<!-- bottom buttons, a bit hidden away: switch layout -->
|
||||
<a class="flex w-fit items-center justify-end" href={Utils.HomepageLink()}>
|
||||
<ChevronDoubleLeft class="h-4 w-4" />
|
||||
<Tr t={Translations.t.general.backToIndex} />
|
||||
</a>
|
||||
</div>
|
||||
</If>
|
||||
</div>
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
|
||||
<div>
|
||||
<div class:interactive={!readonly} class="flex flex-col items-end py-1 px-2">
|
||||
<div class="flex flex-col w-full">
|
||||
<div class="flex w-full flex-col">
|
||||
{#if renderingExternal}
|
||||
<TagRenderingAnswer
|
||||
tags={new UIEventSource(mockPropertiesExternal)}
|
||||
|
|
|
@ -11,7 +11,6 @@ export class ComparisonState {
|
|||
public readonly knownImages: Store<Set<string>>
|
||||
|
||||
constructor(tags: UIEventSource<OsmTags>, externalProperties: Record<string, string>) {
|
||||
|
||||
externalProperties = { ...externalProperties }
|
||||
delete externalProperties["@context"]
|
||||
|
||||
|
@ -74,7 +73,7 @@ export class ComparisonState {
|
|||
)
|
||||
|
||||
this.hasDifferencesAtStart =
|
||||
this. different.data.length + this.missing.data.length + this.unknownImages.data.length > 0
|
||||
|
||||
this.different.data.length + this.missing.data.length + this.unknownImages.data.length >
|
||||
0
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,11 +27,11 @@
|
|||
|
||||
export let readonly = false
|
||||
|
||||
export let comparisonState : ComparisonState
|
||||
export let comparisonState: ComparisonState
|
||||
let missing = comparisonState.missing
|
||||
let unknownImages = comparisonState.unknownImages
|
||||
let knownImages = comparisonState.knownImages
|
||||
let different =comparisonState.different
|
||||
let different = comparisonState.different
|
||||
|
||||
const t = Translations.t.external
|
||||
|
||||
|
@ -50,27 +50,50 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
|
||||
{#if $unknownImages.length === 0 && $missing.length === 0 && $different.length === 0}
|
||||
<div class="thanks m-0 flex items-center gap-x-2 px-2">
|
||||
<Party class="h-8 w-8 shrink-0" />
|
||||
<Tr t={t.allIncluded.Subs({ source: sourceUrl })} />
|
||||
</div>
|
||||
{:else}
|
||||
{#if !readonly}
|
||||
<Tr t={t.loadedFrom.Subs({ url: sourceUrl, source: sourceUrl })} />
|
||||
{#if !readonly}
|
||||
<Tr t={t.loadedFrom.Subs({ url: sourceUrl, source: sourceUrl })} />
|
||||
{/if}
|
||||
|
||||
<div class="flex flex-col" class:gap-y-8={!readonly}>
|
||||
{#if $different.length > 0}
|
||||
{#if !readonly}
|
||||
<h3>
|
||||
<Tr t={t.conflicting.title} />
|
||||
</h3>
|
||||
<Tr t={t.conflicting.intro} />
|
||||
{/if}
|
||||
{#each $different as key (key)}
|
||||
<div class="mx-2 rounded-2xl">
|
||||
<ComparisonAction
|
||||
{key}
|
||||
{state}
|
||||
{tags}
|
||||
{externalProperties}
|
||||
{layer}
|
||||
{feature}
|
||||
{readonly}
|
||||
/>
|
||||
</div>
|
||||
{/each}
|
||||
{/if}
|
||||
|
||||
<div class="flex flex-col" class:gap-y-8={!readonly}>
|
||||
{#if $different.length > 0}
|
||||
{#if !readonly}
|
||||
<h3>
|
||||
<Tr t={t.conflicting.title} />
|
||||
</h3>
|
||||
<Tr t={t.conflicting.intro} />
|
||||
{/if}
|
||||
{#each $different as key (key)}
|
||||
<div class="mx-2 rounded-2xl">
|
||||
{#if $missing.length > 0}
|
||||
{#if !readonly}
|
||||
<h3 class="m-0">
|
||||
<Tr t={t.missing.title} />
|
||||
</h3>
|
||||
|
||||
<Tr t={t.missing.intro} />
|
||||
{/if}
|
||||
{#if currentStep === "init"}
|
||||
{#each $missing as key (key)}
|
||||
<div class:focus={applyAllHovered} class="mx-2 rounded-2xl">
|
||||
<ComparisonAction
|
||||
{key}
|
||||
{state}
|
||||
|
@ -82,86 +105,66 @@
|
|||
/>
|
||||
</div>
|
||||
{/each}
|
||||
{/if}
|
||||
|
||||
{#if $missing.length > 0}
|
||||
{#if !readonly}
|
||||
<h3 class="m-0">
|
||||
<Tr t={t.missing.title} />
|
||||
</h3>
|
||||
|
||||
<Tr t={t.missing.intro} />
|
||||
{#if !readonly && $missing.length > 1}
|
||||
<button
|
||||
on:click={() => applyAllMissing()}
|
||||
on:mouseover={() => (applyAllHovered = true)}
|
||||
on:focus={() => (applyAllHovered = true)}
|
||||
on:blur={() => (applyAllHovered = false)}
|
||||
on:mouseout={() => (applyAllHovered = false)}
|
||||
>
|
||||
<Tr t={t.applyAll} />
|
||||
</button>
|
||||
{/if}
|
||||
{#if currentStep === "init"}
|
||||
{#each $missing as key (key)}
|
||||
<div class:focus={applyAllHovered} class="mx-2 rounded-2xl">
|
||||
<ComparisonAction
|
||||
{key}
|
||||
{state}
|
||||
{tags}
|
||||
{externalProperties}
|
||||
{layer}
|
||||
{feature}
|
||||
{readonly}
|
||||
/>
|
||||
</div>
|
||||
{/each}
|
||||
{#if !readonly && $missing.length > 1}
|
||||
<button
|
||||
on:click={() => applyAllMissing()}
|
||||
on:mouseover={() => (applyAllHovered = true)}
|
||||
on:focus={() => (applyAllHovered = true)}
|
||||
on:blur={() => (applyAllHovered = false)}
|
||||
on:mouseout={() => (applyAllHovered = false)}
|
||||
>
|
||||
<Tr t={t.applyAll} />
|
||||
</button>
|
||||
{/if}
|
||||
{:else if currentStep === "applying_all"}
|
||||
<Loading />
|
||||
{:else if currentStep === "all_applied"}
|
||||
<div class="thanks">
|
||||
<Tr t={t.allAreApplied} />
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if $unknownImages.length > 0}
|
||||
{#if readonly}
|
||||
<div class="w-full overflow-x-auto">
|
||||
<div class="flex h-32 w-max gap-x-2">
|
||||
{#each $unknownImages as image (image)}
|
||||
<AttributedImage
|
||||
imgClass="h-32 w-max shrink-0"
|
||||
image={{ url: image }}
|
||||
previewedImage={state.previewedImage}
|
||||
/>
|
||||
{/each}
|
||||
</div>
|
||||
{:else if currentStep === "applying_all"}
|
||||
<Loading />
|
||||
{:else if currentStep === "all_applied"}
|
||||
<div class="thanks">
|
||||
<Tr t={t.allAreApplied} />
|
||||
</div>
|
||||
{:else}
|
||||
{#each $unknownImages as image (image)}
|
||||
<LinkableImage
|
||||
{tags}
|
||||
{state}
|
||||
image={{
|
||||
pictureUrl: image,
|
||||
provider: "Velopark",
|
||||
thumbUrl: image,
|
||||
details: undefined,
|
||||
coordinates: undefined,
|
||||
osmTags: { image },
|
||||
}}
|
||||
{feature}
|
||||
{layer}
|
||||
/>
|
||||
{/each}
|
||||
{/if}
|
||||
{/if}
|
||||
{#if externalProperties["_last_edit_timestamp"] !== undefined}
|
||||
<span class="subtle text-sm flex flex-end justify-end mt-2 mr-4">
|
||||
<Tr t={t.lastModified.Subs({date: new Date(externalProperties["_last_edit_timestamp"]).toLocaleString() })}/>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{#if $unknownImages.length > 0}
|
||||
{#if readonly}
|
||||
<div class="w-full overflow-x-auto">
|
||||
<div class="flex h-32 w-max gap-x-2">
|
||||
{#each $unknownImages as image (image)}
|
||||
<AttributedImage
|
||||
imgClass="h-32 w-max shrink-0"
|
||||
image={{ url: image }}
|
||||
previewedImage={state.previewedImage}
|
||||
/>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
{#each $unknownImages as image (image)}
|
||||
<LinkableImage
|
||||
{tags}
|
||||
{state}
|
||||
image={{
|
||||
pictureUrl: image,
|
||||
provider: "Velopark",
|
||||
thumbUrl: image,
|
||||
details: undefined,
|
||||
coordinates: undefined,
|
||||
osmTags: { image },
|
||||
}}
|
||||
{feature}
|
||||
{layer}
|
||||
/>
|
||||
{/each}
|
||||
{/if}
|
||||
{/if}
|
||||
{#if externalProperties["_last_edit_timestamp"] !== undefined}
|
||||
<span class="subtle flex-end mt-2 mr-4 flex justify-end text-sm">
|
||||
<Tr
|
||||
t={t.lastModified.Subs({
|
||||
date: new Date(externalProperties["_last_edit_timestamp"]).toLocaleString(),
|
||||
})}
|
||||
/>
|
||||
</span>
|
||||
{/if}
|
||||
{/if}
|
||||
|
|
|
@ -32,17 +32,16 @@
|
|||
export let collapsed: boolean
|
||||
const t = Translations.t.external
|
||||
|
||||
let comparisonState: Store<ComparisonState | undefined> = externalData.mapD(external => {
|
||||
let comparisonState: Store<ComparisonState | undefined> = externalData.mapD((external) => {
|
||||
if (external["success"]) {
|
||||
return new ComparisonState(tags, external["success"])
|
||||
}
|
||||
return undefined
|
||||
})
|
||||
let unknownImages = comparisonState.bindD(ct => ct.unknownImages)
|
||||
let knownImages = comparisonState.bindD(ct => ct.knownImages)
|
||||
let propertyKeysExternal = comparisonState.mapD(ct => ct.propertyKeysExternal)
|
||||
let hasDifferencesAtStart = comparisonState.mapD(ct => ct.hasDifferencesAtStart)
|
||||
|
||||
let unknownImages = comparisonState.bindD((ct) => ct.unknownImages)
|
||||
let knownImages = comparisonState.bindD((ct) => ct.knownImages)
|
||||
let propertyKeysExternal = comparisonState.mapD((ct) => ct.propertyKeysExternal)
|
||||
let hasDifferencesAtStart = comparisonState.mapD((ct) => ct.hasDifferencesAtStart)
|
||||
</script>
|
||||
|
||||
{#if !$sourceUrl}
|
||||
|
@ -50,7 +49,7 @@
|
|||
{:else if $externalData === undefined}
|
||||
<Loading />
|
||||
{:else if $externalData["error"] !== undefined}
|
||||
<div class="subtle italic low-interaction p-2 px-4 rounded">
|
||||
<div class="subtle low-interaction rounded p-2 px-4 italic">
|
||||
<Tr t={Translations.t.external.error} />
|
||||
</div>
|
||||
{:else if $propertyKeysExternal.length === 0 && $knownImages.size + $unknownImages.length === 0}
|
||||
|
@ -62,7 +61,7 @@
|
|||
{:else if $comparisonState !== undefined}
|
||||
<AccordionSingle expanded={!collapsed}>
|
||||
<span slot="header" class="flex">
|
||||
<GlobeAlt class="w-6 h-6" />
|
||||
<GlobeAlt class="h-6 w-6" />
|
||||
<Tr t={Translations.t.external.title} />
|
||||
</span>
|
||||
<ComparisonTable
|
||||
|
|
|
@ -6,12 +6,11 @@
|
|||
|
||||
<Accordion>
|
||||
<AccordionItem open={expanded} paddingDefault="p-0" inactiveClass="text-black">
|
||||
<span slot="header" class="text-base p-2 ">
|
||||
<span slot="header" class="p-2 text-base">
|
||||
<slot name="header" />
|
||||
</span>
|
||||
<div class="low-interaction p-2 rounded-b">
|
||||
<div class="low-interaction rounded-b p-2">
|
||||
<slot />
|
||||
</div>
|
||||
</AccordionItem>
|
||||
</Accordion>
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
lon,
|
||||
lat,
|
||||
allowSpherical: new UIEventSource<boolean>(false),
|
||||
blacklist: AllImageProviders.LoadImagesFor(tags)
|
||||
blacklist: AllImageProviders.LoadImagesFor(tags),
|
||||
},
|
||||
state.indexedFeatures
|
||||
)
|
||||
|
@ -39,7 +39,6 @@
|
|||
let allDone = imagesProvider.allDone
|
||||
</script>
|
||||
|
||||
|
||||
<div class="flex justify-between">
|
||||
<h4>
|
||||
<Tr t={Translations.t.image.nearby.title} />
|
||||
|
@ -53,9 +52,9 @@
|
|||
{:else}
|
||||
<div class="flex w-full space-x-1 overflow-x-auto" style="scroll-snap-type: x proximity">
|
||||
{#each $images as image (image.pictureUrl)}
|
||||
<span class="w-fit shrink-0" style="scroll-snap-align: start">
|
||||
<LinkableImage {tags} {image} {state} {feature} {layer} {linkable} />
|
||||
</span>
|
||||
<span class="w-fit shrink-0" style="scroll-snap-align: start">
|
||||
<LinkableImage {tags} {image} {state} {feature} {layer} {linkable} />
|
||||
</span>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
|
|
|
@ -28,9 +28,8 @@
|
|||
</script>
|
||||
|
||||
<AccordionSingle>
|
||||
<span slot="header" class="text-base p-2">
|
||||
<Tr t={t.seeNearby} />
|
||||
</span>
|
||||
<span slot="header" class="p-2 text-base">
|
||||
<Tr t={t.seeNearby} />
|
||||
</span>
|
||||
<NearbyImages {tags} {state} {lon} {lat} {feature} {linkable} {layer} />
|
||||
</AccordionSingle>
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ export default class IconValidator extends Validator {
|
|||
}
|
||||
|
||||
getFeedback(s: string, getCountry, sloppy?: boolean): Translation | undefined {
|
||||
if(Utils.isEmoji(s)){
|
||||
if (Utils.isEmoji(s)) {
|
||||
return undefined
|
||||
}
|
||||
s = this.reformat(s)
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
$: iconItem = icon.icon?.GetRenderValue($tags)?.Subs($tags)?.txt
|
||||
let color = icon.color?.GetRenderValue($tags)?.txt ?? "#000000"
|
||||
$: color = icon.color?.GetRenderValue($tags)?.txt ?? "#000000"
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
{#if iconItem?.startsWith("<")}
|
||||
|
|
|
@ -39,7 +39,9 @@ export class MapLibreAdaptor implements MapProperties, ExportableMap {
|
|||
readonly allowMoving: UIEventSource<true | boolean | undefined>
|
||||
readonly allowRotating: UIEventSource<true | boolean | undefined>
|
||||
readonly allowZooming: UIEventSource<true | boolean | undefined>
|
||||
readonly lastClickLocation: Store<undefined | { lon: number; lat: number, mode : "left" | "right" | "middle" }>
|
||||
readonly lastClickLocation: Store<
|
||||
undefined | { lon: number; lat: number; mode: "left" | "right" | "middle" }
|
||||
>
|
||||
readonly minzoom: UIEventSource<number>
|
||||
readonly maxzoom: UIEventSource<number>
|
||||
readonly rotation: UIEventSource<number>
|
||||
|
@ -70,7 +72,7 @@ export class MapLibreAdaptor implements MapProperties, ExportableMap {
|
|||
this.location.setData({ ...this.location.data })
|
||||
}
|
||||
this.zoom = state?.zoom ?? new UIEventSource(1)
|
||||
this.minzoom = state?.minzoom ?? new UIEventSource(0.5)// 0.5 is the maplibre minzoom
|
||||
this.minzoom = state?.minzoom ?? new UIEventSource(0.5) // 0.5 is the maplibre minzoom
|
||||
this.maxzoom = state?.maxzoom ?? new UIEventSource(24)
|
||||
this.zoom.addCallbackAndRunD((z) => {
|
||||
if (z < this.minzoom.data) {
|
||||
|
@ -92,13 +94,17 @@ export class MapLibreAdaptor implements MapProperties, ExportableMap {
|
|||
this.rasterLayer =
|
||||
state?.rasterLayer ?? new UIEventSource<RasterLayerPolygon | undefined>(undefined)
|
||||
|
||||
const lastClickLocation = new UIEventSource<{lat:number,lon:number,mode: "left" | "right" | "middle"}>(undefined)
|
||||
const lastClickLocation = new UIEventSource<{
|
||||
lat: number
|
||||
lon: number
|
||||
mode: "left" | "right" | "middle"
|
||||
}>(undefined)
|
||||
this.lastClickLocation = lastClickLocation
|
||||
const self = this
|
||||
|
||||
new RasterLayerHandler(this._maplibreMap, this.rasterLayer)
|
||||
|
||||
const clickmodes = ["left" , "middle", "right"] as const
|
||||
const clickmodes = ["left", "middle", "right"] as const
|
||||
function handleClick(e: maplibregl.MapMouseEvent, mode?: "left" | "right" | "middle") {
|
||||
if (e.originalEvent["consumed"]) {
|
||||
// Workaround, 'ShowPointLayer' sets this flag
|
||||
|
@ -148,8 +154,8 @@ export class MapLibreAdaptor implements MapProperties, ExportableMap {
|
|||
})
|
||||
|
||||
map._container.addEventListener("contextmenu", (e) => {
|
||||
const lngLat = map.unproject([e.x, e.y])
|
||||
lastClickLocation.setData({lon: lngLat.lng, lat: lngLat.lat, mode: "right"})
|
||||
const lngLat = map.unproject([e.x, e.y])
|
||||
lastClickLocation.setData({ lon: lngLat.lng, lat: lngLat.lat, mode: "right" })
|
||||
})
|
||||
map.on("dblclick", (e) => {
|
||||
handleClick(e, "left")
|
||||
|
@ -675,5 +681,4 @@ export class MapLibreAdaptor implements MapProperties, ExportableMap {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
|
||||
let _map: Map
|
||||
onMount(() => {
|
||||
|
||||
const { lon, lat } = mapProperties?.location?.data ?? { lon: 0, lat: 0 }
|
||||
|
||||
const rasterLayer: RasterLayerProperties = mapProperties?.rasterLayer?.data?.properties
|
||||
|
@ -73,11 +72,10 @@
|
|||
})
|
||||
onDestroy(async () => {
|
||||
await Utils.waitFor(250)
|
||||
try{
|
||||
|
||||
if (_map) _map.remove()
|
||||
map = null
|
||||
}catch (e) {
|
||||
try {
|
||||
if (_map) _map.remove()
|
||||
map = null
|
||||
} catch (e) {
|
||||
console.error("Could not destroy map")
|
||||
}
|
||||
})
|
||||
|
|
|
@ -8,19 +8,21 @@
|
|||
export let icons: string | { icon: string; color: string }[]
|
||||
|
||||
let iconsParsed: { icon: string; color: string }[]
|
||||
if(typeof icons === "string") {
|
||||
iconsParsed = icons.split(";").map(subspec => {
|
||||
if(subspec.startsWith("http://") || subspec.startsWith("https://")){
|
||||
if (typeof icons === "string") {
|
||||
iconsParsed = icons.split(";").map((subspec) => {
|
||||
if (subspec.startsWith("http://") || subspec.startsWith("https://")) {
|
||||
return {
|
||||
icon: subspec, color: "black"
|
||||
icon: subspec,
|
||||
color: "black",
|
||||
}
|
||||
}
|
||||
const [icon, color] = subspec.split(":")
|
||||
return {
|
||||
icon, color: color ?? "black"
|
||||
icon,
|
||||
color: color ?? "black",
|
||||
}
|
||||
})
|
||||
}else{
|
||||
} else {
|
||||
iconsParsed = icons
|
||||
}
|
||||
|
||||
|
|
|
@ -97,10 +97,10 @@ class SingleBackgroundHandler {
|
|||
}
|
||||
}
|
||||
|
||||
private tryEnableSafe(): boolean{
|
||||
private tryEnableSafe(): boolean {
|
||||
try {
|
||||
return this.tryEnable()
|
||||
}catch (e) {
|
||||
} catch (e) {
|
||||
console.log("Error: could not enable due to error", e)
|
||||
return false
|
||||
}
|
||||
|
@ -119,11 +119,7 @@ class SingleBackgroundHandler {
|
|||
console.debug("Enabling", background.id)
|
||||
let addLayerBeforeId = "transit_pier" // this is the first non-landuse item in the stylesheet, we add the raster layer before the roads but above the landuse
|
||||
if (!map.getLayer(addLayerBeforeId)) {
|
||||
console.warn(
|
||||
"Layer",
|
||||
addLayerBeforeId,
|
||||
"not found"
|
||||
)
|
||||
console.warn("Layer", addLayerBeforeId, "not found")
|
||||
addLayerBeforeId = undefined
|
||||
}
|
||||
if (background.category === "osmbasedmap" || background.category === "map") {
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
deleteConfig.softDeletionTags,
|
||||
{
|
||||
theme: state?.layout?.id ?? "unknown",
|
||||
specialMotivation: deleteReason
|
||||
specialMotivation: deleteReason,
|
||||
},
|
||||
canBeDeleted.data
|
||||
)
|
||||
|
@ -74,7 +74,7 @@
|
|||
// no _delete_reason is given, which implies that this is _not_ a deletion but merely a retagging via a nonDeleteMapping
|
||||
actionToTake = new ChangeTagAction(featureId, selectedTags, tags.data, {
|
||||
theme: state?.layout?.id ?? "unkown",
|
||||
changeType: "special-delete"
|
||||
changeType: "special-delete",
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -87,81 +87,74 @@
|
|||
|
||||
<LoginToggle ignoreLoading={true} {state}>
|
||||
{#if $canBeDeleted === false && !hasSoftDeletion}
|
||||
<div class="low-interaction rounded text-sm flex p-2 italic subtle gap-x-1">
|
||||
<div class="low-interaction subtle flex gap-x-1 rounded p-2 text-sm italic">
|
||||
<div class="relative h-fit">
|
||||
<Trash class="w-8 h-8 pb-1" />
|
||||
<Invalid class="absolute bottom-0 right-0 w-5 h-5"/>
|
||||
<Trash class="h-8 w-8 pb-1" />
|
||||
<Invalid class="absolute bottom-0 right-0 h-5 w-5" />
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
|
||||
<Tr t={t.cannotBeDeleted} />
|
||||
<Tr t={$canBeDeletedReason} />
|
||||
<Tr t={t.useSomethingElse} />
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
|
||||
|
||||
<AccordionSingle>
|
||||
<span slot="header" class="flex">
|
||||
|
||||
<TrashIcon class="h-6 w-6" />
|
||||
<Tr t={t.delete} />
|
||||
<TrashIcon class="h-6 w-6" />
|
||||
<Tr t={t.delete} />
|
||||
</span>
|
||||
<span>
|
||||
{#if currentState === "confirm"}
|
||||
<TagRenderingQuestion
|
||||
bind:selectedTags
|
||||
clss=""
|
||||
{tags}
|
||||
config={deleteConfig.constructTagRendering()}
|
||||
{state}
|
||||
selectedElement={feature}
|
||||
{layer}
|
||||
>
|
||||
<button
|
||||
slot="save-button"
|
||||
on:click={onDelete}
|
||||
class={twJoin(
|
||||
selectedTags === undefined && "disabled",
|
||||
"primary flex items-center bg-red-600"
|
||||
)}
|
||||
>
|
||||
<TrashIcon
|
||||
class={twJoin(
|
||||
"ml-1 mr-2 h-6 w-6 rounded-full p-1",
|
||||
selectedTags !== undefined && "bg-red-600"
|
||||
)}
|
||||
/>
|
||||
<Tr t={t.delete} />
|
||||
</button>
|
||||
{#if currentState === "confirm"}
|
||||
<TagRenderingQuestion
|
||||
bind:selectedTags
|
||||
clss=""
|
||||
{tags}
|
||||
config={deleteConfig.constructTagRendering()}
|
||||
{state}
|
||||
selectedElement={feature}
|
||||
{layer}
|
||||
>
|
||||
<button
|
||||
slot="save-button"
|
||||
on:click={onDelete}
|
||||
class={twJoin(
|
||||
selectedTags === undefined && "disabled",
|
||||
"primary flex items-center bg-red-600"
|
||||
)}
|
||||
>
|
||||
<TrashIcon
|
||||
class={twJoin(
|
||||
"ml-1 mr-2 h-6 w-6 rounded-full p-1",
|
||||
selectedTags !== undefined && "bg-red-600"
|
||||
)}
|
||||
/>
|
||||
<Tr t={t.delete} />
|
||||
</button>
|
||||
|
||||
<div slot="under-buttons" class="subtle italic">
|
||||
{#if selectedTags !== undefined}
|
||||
{#if canBeDeleted && isHardDelete}
|
||||
<!-- This is a hard delete - explain that this is a hard delete...-->
|
||||
<Tr t={t.explanations.hardDelete} />
|
||||
{:else}
|
||||
<!-- This is a soft deletion: we explain _why_ the deletion is soft -->
|
||||
<Tr t={t.explanations.softDelete.Subs({ reason: $canBeDeletedReason })} />
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
</TagRenderingQuestion>
|
||||
{:else if currentState === "applying"}
|
||||
<Loading />
|
||||
{:else}
|
||||
<!-- currentState === 'deleted' -->
|
||||
|
||||
<div slot="under-buttons" class="italic subtle">
|
||||
{#if selectedTags !== undefined}
|
||||
{#if canBeDeleted && isHardDelete}
|
||||
<!-- This is a hard delete - explain that this is a hard delete...-->
|
||||
<Tr t={t.explanations.hardDelete} />
|
||||
{:else}
|
||||
<!-- This is a soft deletion: we explain _why_ the deletion is soft -->
|
||||
<Tr t={t.explanations.softDelete.Subs({ reason: $canBeDeletedReason })} />
|
||||
{/if}
|
||||
<div class="low-interaction flex">
|
||||
<TrashIcon class="h-6 w-6" />
|
||||
<Tr t={t.isDeleted} />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</TagRenderingQuestion>
|
||||
{:else if currentState === "applying"}
|
||||
<Loading />
|
||||
{:else}
|
||||
<!-- currentState === 'deleted' -->
|
||||
|
||||
<div class="low-interaction flex">
|
||||
<TrashIcon class="h-6 w-6" />
|
||||
<Tr t={t.isDeleted} />
|
||||
</div>
|
||||
{/if}
|
||||
</span>
|
||||
</AccordionSingle>
|
||||
|
||||
{/if}
|
||||
|
||||
</LoginToggle>
|
||||
|
|
|
@ -26,23 +26,22 @@
|
|||
<LoginToggle ignoreLoading={true} {state}>
|
||||
{#if $isFavourite}
|
||||
<div class="flex h-fit items-start">
|
||||
<button class="w-full" on:click={() => markFavourite(false)}>
|
||||
<HeartSolidIcon class="mr-2 w-16 shrink-0" on:click={() => markFavourite(false)} />
|
||||
<div class="flex flex-col items-start">
|
||||
<button class="w-full" on:click={() => markFavourite(false)}>
|
||||
<HeartSolidIcon class="mr-2 w-16 shrink-0" on:click={() => markFavourite(false)} />
|
||||
<div class="flex flex-col items-start">
|
||||
<Tr t={t.button.unmark} />
|
||||
<Tr cls="normal-font subtle" t={t.button.unmarkNotDeleted} />
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
<Tr cls="font-bold thanks m-2 p-2 block" t={t.button.isFavourite} />
|
||||
{:else}
|
||||
<button class="w-full" on:click={() => markFavourite(true)}>
|
||||
<HeartOutlineIcon class="mr-2 w-16 shrink-0" on:click={() => markFavourite(true)} />
|
||||
<div class="flex w-full flex-col items-start">
|
||||
|
||||
<Tr t={t.button.markAsFavouriteTitle} />
|
||||
<Tr cls="normal-font subtle" t={t.button.markDescription} />
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
<Tr cls="font-bold thanks m-2 p-2 block" t={t.button.isFavourite} />
|
||||
{:else}
|
||||
<button class="w-full" on:click={() => markFavourite(true)}>
|
||||
<HeartOutlineIcon class="mr-2 w-16 shrink-0" on:click={() => markFavourite(true)} />
|
||||
<div class="flex w-full flex-col items-start">
|
||||
<Tr t={t.button.markAsFavouriteTitle} />
|
||||
<Tr cls="normal-font subtle" t={t.button.markDescription} />
|
||||
</div>
|
||||
</button>
|
||||
{/if}
|
||||
</LoginToggle>
|
||||
|
|
|
@ -47,12 +47,12 @@
|
|||
location: new UIEventSource({ lon, lat }),
|
||||
minzoom: new UIEventSource($reason.minZoom),
|
||||
rasterLayer: state.mapProperties.rasterLayer,
|
||||
zoom: new UIEventSource($reason?.startZoom ?? 16)
|
||||
zoom: new UIEventSource($reason?.startZoom ?? 16),
|
||||
}
|
||||
}
|
||||
|
||||
let moveWizardState = new MoveWizardState(id, layer.allowMove, state)
|
||||
if(moveWizardState.reasons.length === 1){
|
||||
if (moveWizardState.reasons.length === 1) {
|
||||
reason.setData(moveWizardState.reasons[0])
|
||||
}
|
||||
let notAllowed = moveWizardState.moveDisallowedReason
|
||||
|
@ -78,8 +78,8 @@
|
|||
/>
|
||||
<Tr t={Translations.T(moveWizardState.reasons[0].invitingText)} />
|
||||
{:else}
|
||||
<Move class="h-6 w-6" />
|
||||
<Tr t={t.inviteToMove.generic} />
|
||||
<Move class="h-6 w-6" />
|
||||
<Tr t={t.inviteToMove.generic} />
|
||||
{/if}
|
||||
</span>
|
||||
<span class="flex flex-col p-2">
|
||||
|
@ -88,9 +88,9 @@
|
|||
{#each moveWizardState.reasons as reasonSpec}
|
||||
<button
|
||||
on:click={() => {
|
||||
reason.setData(reasonSpec)
|
||||
currentStep = "pick_location"
|
||||
}}
|
||||
reason.setData(reasonSpec)
|
||||
currentStep = "pick_location"
|
||||
}}
|
||||
>
|
||||
<ToSvelte construct={reasonSpec.icon.SetClass("w-16 h-16 pr-2")} />
|
||||
<Tr t={Translations.T(reasonSpec.text)} />
|
||||
|
@ -115,15 +115,15 @@
|
|||
<div class="flex flex-wrap">
|
||||
<If
|
||||
condition={currentMapProperties.zoom.mapD(
|
||||
(zoom) => zoom >= Constants.minZoomLevelToAddNewPoint
|
||||
)}
|
||||
(zoom) => zoom >= Constants.minZoomLevelToAddNewPoint
|
||||
)}
|
||||
>
|
||||
<button
|
||||
class="primary w-full"
|
||||
class="primary w-full"
|
||||
on:click={() => {
|
||||
moveWizardState.moveFeature(newLocation.data, reason.data, featureToMove)
|
||||
currentStep = "moved"
|
||||
}}
|
||||
moveWizardState.moveFeature(newLocation.data, reason.data, featureToMove)
|
||||
currentStep = "moved"
|
||||
}}
|
||||
>
|
||||
<Tr t={t.confirmMove} />
|
||||
</button>
|
||||
|
@ -133,19 +133,24 @@
|
|||
</div>
|
||||
</If>
|
||||
{#if moveWizardState.reasons.length > 1}
|
||||
<button class="w-full" on:click={() => {currentStep = "reason"}}>
|
||||
<ChevronLeft class="w-6 h-6" />
|
||||
<button
|
||||
class="w-full"
|
||||
on:click={() => {
|
||||
currentStep = "reason"
|
||||
}}
|
||||
>
|
||||
<ChevronLeft class="h-6 w-6" />
|
||||
<Tr t={t.cancel} />
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{:else if currentStep === "moved"}
|
||||
<div class="flex flex-col">
|
||||
<Tr cls="thanks" t={t.pointIsMoved} />
|
||||
<button
|
||||
on:click={() => {
|
||||
currentStep = "reason"
|
||||
}}
|
||||
currentStep = "reason"
|
||||
}}
|
||||
>
|
||||
<Move class="h-6 w-6 pr-2" />
|
||||
<Tr t={t.inviteToMoveAgain} />
|
||||
|
|
|
@ -134,16 +134,15 @@ export class MoveWizardState {
|
|||
// This is a new point. Check if it was snapped to an existing way due to the '_referencing_ways'-tag
|
||||
const store = this._state.featureProperties.getStore(id)
|
||||
store?.addCallbackAndRunD((tags) => {
|
||||
try{
|
||||
|
||||
try {
|
||||
if (tags._referencing_ways !== undefined && tags._referencing_ways !== "[]") {
|
||||
console.log("Got referencing ways according to the tags")
|
||||
this.moveDisallowedReason.setData(t.partOfAWay)
|
||||
return true // unregister
|
||||
}
|
||||
}catch (e) {
|
||||
console.error("Could not get '_referencing_ways'-attribute of tags due to", e)
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Could not get '_referencing_ways'-attribute of tags due to", e)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,13 +11,12 @@
|
|||
export let layer: LayerConfig
|
||||
export let text: string
|
||||
export let cssClasses: string = ""
|
||||
let knowableRenderings = layer.tagRenderings.filter(tr => tr.question !== undefined)
|
||||
let hasKnownQuestion = tags.mapD(t => knowableRenderings.some(tr => tr.IsKnown(t)))
|
||||
|
||||
let knowableRenderings = layer.tagRenderings.filter((tr) => tr.question !== undefined)
|
||||
let hasKnownQuestion = tags.mapD((t) => knowableRenderings.some((tr) => tr.IsKnown(t)))
|
||||
</script>
|
||||
|
||||
{#if !$hasKnownQuestion}
|
||||
<span class={cssClasses}>
|
||||
{text}
|
||||
{text}
|
||||
</span>
|
||||
{/if}
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
|
||||
<button
|
||||
on:click
|
||||
class="h-8 w-8 shrink-0 self-start rounded-full p-1 as-link"
|
||||
class="as-link h-8 w-8 shrink-0 self-start rounded-full p-1"
|
||||
aria-labelledby={arialabel === undefined ? ariaLabelledBy : undefined}
|
||||
use:ariaLabel={arialabel}
|
||||
>
|
||||
<Pencil class="h-4 w-4 hover-alert" />
|
||||
<Pencil class="hover-alert h-4 w-4" />
|
||||
</button>
|
||||
|
|
|
@ -49,7 +49,9 @@
|
|||
function createVisualisation(specpart: Exclude<RenderingSpecification, string>): BaseUIElement {
|
||||
{
|
||||
try {
|
||||
return specpart.func.constr(state, tags, specpart.args, feature, layer)?.SetClass(specpart.style)
|
||||
return specpart.func
|
||||
.constr(state, tags, specpart.args, feature, layer)
|
||||
?.SetClass(specpart.style)
|
||||
} catch (e) {
|
||||
console.error(
|
||||
"Could not construct a special visualisation with specification",
|
||||
|
|
|
@ -28,12 +28,18 @@
|
|||
</script>
|
||||
|
||||
{#if config !== undefined && (config?.condition === undefined || config.condition.matchesProperties($tags))}
|
||||
<div {id} class={twMerge("link-underline flex flex-col w-full", extraClasses)}>
|
||||
<div {id} class={twMerge("link-underline flex w-full flex-col", extraClasses)}>
|
||||
{#if $trs.length === 1}
|
||||
<TagRenderingMapping mapping={$trs[0]} {tags} {state} {selectedElement} {layer}
|
||||
clss={config?.classes?.join(" ") ?? ""} />
|
||||
<TagRenderingMapping
|
||||
mapping={$trs[0]}
|
||||
{tags}
|
||||
{state}
|
||||
{selectedElement}
|
||||
{layer}
|
||||
clss={config?.classes?.join(" ") ?? ""}
|
||||
/>
|
||||
{/if}
|
||||
{#if $trs.length > 1}
|
||||
{#if $trs.length > 1}
|
||||
<ul>
|
||||
{#each $trs as mapping}
|
||||
<li>
|
||||
|
|
|
@ -66,7 +66,6 @@
|
|||
Utils.focusOnFocusableChild(htmlElem)
|
||||
} else {
|
||||
htmlElem.classList.remove("focus")
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,14 +31,19 @@
|
|||
| "large-height"
|
||||
| string
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
{#if mapping.icon !== undefined}
|
||||
<div class="inline-flex items-center">
|
||||
<Marker
|
||||
icons={mapping.icon}
|
||||
size={twJoin(`mapping-icon-${mapping.iconClass ?? "small"}-height mapping-icon-${mapping.iconClass ?? "small"}-width`, "mr-2", "shrink-0 mx-2")}
|
||||
size={twJoin(
|
||||
`mapping-icon-${mapping.iconClass ?? "small"}-height mapping-icon-${
|
||||
mapping.iconClass ?? "small"
|
||||
}-width`,
|
||||
"mr-2",
|
||||
"shrink-0 mx-2"
|
||||
)}
|
||||
clss={`mapping-icon-${mapping.iconClass ?? "small"}`}
|
||||
/>
|
||||
<SpecialTranslation t={mapping.then} {tags} {state} {layer} feature={selectedElement} {clss} />
|
||||
|
|
|
@ -310,7 +310,7 @@
|
|||
</script>
|
||||
|
||||
{#if question !== undefined}
|
||||
<div class={clss} >
|
||||
<div class={clss}>
|
||||
<form
|
||||
class="relative flex flex-col overflow-y-auto px-2"
|
||||
style="max-height: 75vh"
|
||||
|
@ -326,20 +326,19 @@
|
|||
|
||||
{#if config.questionhint}
|
||||
<span class="italic">
|
||||
|
||||
{#if config.questionHintIsMd}
|
||||
<Markdown srcWritable={config.questionhint.current} />
|
||||
{:else}
|
||||
<div class="max-h-60 overflow-y-auto">
|
||||
<SpecialTranslation
|
||||
t={config.questionhint}
|
||||
{tags}
|
||||
{state}
|
||||
{layer}
|
||||
feature={selectedElement}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
{#if config.questionHintIsMd}
|
||||
<Markdown srcWritable={config.questionhint.current} />
|
||||
{:else}
|
||||
<div class="max-h-60 overflow-y-auto">
|
||||
<SpecialTranslation
|
||||
t={config.questionhint}
|
||||
{tags}
|
||||
{state}
|
||||
{layer}
|
||||
feature={selectedElement}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
</span>
|
||||
{/if}
|
||||
</legend>
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
<SingleReview {review} />
|
||||
{/each}
|
||||
{:else}
|
||||
<div class="subtle italic m-2">
|
||||
<Tr t={Translations.t.reviews.no_reviews_yet} />
|
||||
<div class="subtle m-2 italic">
|
||||
<Tr t={Translations.t.reviews.no_reviews_yet} />
|
||||
</div>
|
||||
{/if}
|
||||
<div class="flex justify-end">
|
||||
|
|
|
@ -80,7 +80,12 @@
|
|||
|
||||
<LoginToggle {state}>
|
||||
<div class="m-1 flex flex-col">
|
||||
<FileSelector cls="button w-fit" accept="application/json" multiple={false} on:submit={(e) => onImport(e.detail)}>
|
||||
<FileSelector
|
||||
cls="button w-fit"
|
||||
accept="application/json"
|
||||
multiple={false}
|
||||
on:submit={(e) => onImport(e.detail)}
|
||||
>
|
||||
{text}
|
||||
</FileSelector>
|
||||
{#if error}
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
{:else}
|
||||
<button
|
||||
use:ariaLabel={Translations.t.reviews.rate.Subs({ n: i + 1 })}
|
||||
class="rounded-full as-link"
|
||||
class="as-link rounded-full"
|
||||
style="padding: 0; border: none;"
|
||||
bind:this={container}
|
||||
on:click={(e) => {
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -27,13 +27,13 @@
|
|||
Bug: Region received empty list as configuration at {path.join(".")}
|
||||
{:else if title}
|
||||
<AccordionSingle>
|
||||
<div slot="header">{title}</div>
|
||||
<div class="flex w-full flex-col gap-y-1 border border-black pl-2">
|
||||
<slot name="description" />
|
||||
{#each configsFiltered as config}
|
||||
<SchemaBasedInput {state} path={config.path} schema={config} />
|
||||
{/each}
|
||||
</div>
|
||||
<div slot="header">{title}</div>
|
||||
<div class="flex w-full flex-col gap-y-1 border border-black pl-2">
|
||||
<slot name="description" />
|
||||
{#each configsFiltered as config}
|
||||
<SchemaBasedInput {state} path={config.path} schema={config} />
|
||||
{/each}
|
||||
</div>
|
||||
</AccordionSingle>
|
||||
{:else}
|
||||
<div class="flex w-full flex-col gap-y-1 pl-2">
|
||||
|
|
|
@ -143,63 +143,64 @@
|
|||
{/if}
|
||||
</span>
|
||||
<div class="normal-background p-2">
|
||||
|
||||
{#if isTagRenderingBlock}
|
||||
<QuestionPreview {state} path={fusePath(i, [])} {schema}>
|
||||
<button
|
||||
on:click={() => {
|
||||
del(i)
|
||||
}}
|
||||
>
|
||||
<TrashIcon class="h-4 w-4" />
|
||||
Delete this question
|
||||
</button>
|
||||
|
||||
{#if i > 0}
|
||||
{#if isTagRenderingBlock}
|
||||
<QuestionPreview {state} path={fusePath(i, [])} {schema}>
|
||||
<button
|
||||
on:click={() => {
|
||||
moveTo(i, 0)
|
||||
del(i)
|
||||
}}
|
||||
>
|
||||
Move to front
|
||||
<TrashIcon class="h-4 w-4" />
|
||||
Delete this question
|
||||
</button>
|
||||
|
||||
<button
|
||||
on:click={() => {
|
||||
swap(i, i - 1)
|
||||
}}
|
||||
>
|
||||
Move up
|
||||
</button>
|
||||
{/if}
|
||||
{#if i + 1 < $currentValue.length}
|
||||
<button
|
||||
on:click={() => {
|
||||
swap(i, i + 1)
|
||||
}}
|
||||
>
|
||||
Move down
|
||||
</button>
|
||||
<button
|
||||
on:click={() => {
|
||||
moveTo(i, $currentValue.length - 1)
|
||||
}}
|
||||
>
|
||||
Move to back
|
||||
</button>
|
||||
{/if}
|
||||
</QuestionPreview>
|
||||
{:else if schema.hints.types}
|
||||
<SchemaBasedMultiType {state} path={fusePath(i, [])} schema={schemaForMultitype()} />
|
||||
{:else}
|
||||
{#each subparts as subpart}
|
||||
<SchemaBasedInput {state} path={fusePath(i, [subpart.path.at(-1)])} schema={subpart} />
|
||||
{/each}
|
||||
{/if}
|
||||
{#if i > 0}
|
||||
<button
|
||||
on:click={() => {
|
||||
moveTo(i, 0)
|
||||
}}
|
||||
>
|
||||
Move to front
|
||||
</button>
|
||||
|
||||
<button
|
||||
on:click={() => {
|
||||
swap(i, i - 1)
|
||||
}}
|
||||
>
|
||||
Move up
|
||||
</button>
|
||||
{/if}
|
||||
{#if i + 1 < $currentValue.length}
|
||||
<button
|
||||
on:click={() => {
|
||||
swap(i, i + 1)
|
||||
}}
|
||||
>
|
||||
Move down
|
||||
</button>
|
||||
<button
|
||||
on:click={() => {
|
||||
moveTo(i, $currentValue.length - 1)
|
||||
}}
|
||||
>
|
||||
Move to back
|
||||
</button>
|
||||
{/if}
|
||||
</QuestionPreview>
|
||||
{:else if schema.hints.types}
|
||||
<SchemaBasedMultiType {state} path={fusePath(i, [])} schema={schemaForMultitype()} />
|
||||
{:else}
|
||||
{#each subparts as subpart}
|
||||
<SchemaBasedInput
|
||||
{state}
|
||||
path={fusePath(i, [subpart.path.at(-1)])}
|
||||
schema={subpart}
|
||||
/>
|
||||
{/each}
|
||||
{/if}
|
||||
</div>
|
||||
</AccordionSingle>
|
||||
|
||||
{/each}
|
||||
{/if}
|
||||
<div class="flex">
|
||||
|
|
|
@ -3,11 +3,9 @@ import StudioGUI from "./StudioGUI.svelte"
|
|||
|
||||
export default class StudioGui {
|
||||
public setup() {
|
||||
new StudioGUI(
|
||||
{
|
||||
target: document.getElementById("main")
|
||||
}
|
||||
)
|
||||
new StudioGUI({
|
||||
target: document.getElementById("main"),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
</script>
|
||||
|
||||
<main>
|
||||
<div class="flex-col flex gap-y-2">
|
||||
<div class="flex flex-col gap-y-2">
|
||||
<h1>Stylesheet testing grounds</h1>
|
||||
|
||||
This document exists to explore the style hierarchy.
|
||||
|
@ -65,9 +65,7 @@
|
|||
<Community class="h-6 w-6" />
|
||||
Secondary action (disabled)
|
||||
</button>
|
||||
<button class="as-link">
|
||||
Mimick link
|
||||
</button>
|
||||
<button class="as-link">Mimick link</button>
|
||||
</div>
|
||||
<input type="text" />
|
||||
|
||||
|
|
|
@ -255,11 +255,11 @@
|
|||
htmlElem={openMapButton}
|
||||
>
|
||||
<div class="m-0.5 mx-1 flex cursor-pointer items-center max-[480px]:w-full sm:mx-1 md:mx-2">
|
||||
<Marker icons={layout.icon} size="h-4 w-4 md:h-8 md:w-8 mr-0.5 sm:mr-1 md:mr-2" ></Marker>
|
||||
<Marker icons={layout.icon} size="h-4 w-4 md:h-8 md:w-8 mr-0.5 sm:mr-1 md:mr-2" />
|
||||
<b class="mr-1">
|
||||
<Tr t={layout.title} />
|
||||
</b>
|
||||
<ChevronRight class="w-4 h-4"/>
|
||||
<ChevronRight class="h-4 w-4" />
|
||||
</div>
|
||||
</MapControlButton>
|
||||
<MapControlButton
|
||||
|
@ -347,13 +347,16 @@
|
|||
/>
|
||||
</If>
|
||||
<a
|
||||
class="self-center bg-black-transparent pointer-events-auto h-fit max-h-12 cursor-pointer self-end overflow-hidden rounded-2xl px-1 ml-1 text-white opacity-50 hover:opacity-100"
|
||||
class="bg-black-transparent pointer-events-auto ml-1 h-fit max-h-12 cursor-pointer self-end self-center overflow-hidden rounded-2xl px-1 text-white opacity-50 hover:opacity-100"
|
||||
on:click={() => {
|
||||
state.guistate.themeViewTab.setData("copyright")
|
||||
state.guistate.themeIsOpened.setData(true)
|
||||
}}
|
||||
>
|
||||
© <span class="hidden sm:inline sm:pr-2 "> OpenStreetMap<span class="hidden md:inline md:pr-2 w-24">, {rasterLayerName}</span></span>
|
||||
© <span class="hidden sm:inline sm:pr-2">
|
||||
OpenStreetMap
|
||||
<span class="hidden w-24 md:inline md:pr-2">, {rasterLayerName}</span>
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -485,7 +488,7 @@
|
|||
</div>
|
||||
|
||||
<div class="flex" slot="title0">
|
||||
<Marker icons={layout.icon} size="h-4 w-4"/>
|
||||
<Marker icons={layout.icon} size="h-4 w-4" />
|
||||
|
||||
<Tr t={layout.title} />
|
||||
</div>
|
||||
|
@ -583,9 +586,19 @@
|
|||
<Tr t={Translations.t.general.attribution.openIssueTracker} />
|
||||
</a>
|
||||
|
||||
<a class="flex" href={"https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Themes/"+layout.id+".md"} target="_blank">
|
||||
<DocumentChartBar class="h-6 w-6"/>
|
||||
<Tr t={Translations.t.general.attribution.openThemeDocumentation.Subs({name: layout.title})}/>
|
||||
<a
|
||||
class="flex"
|
||||
href={"https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Themes/" +
|
||||
layout.id +
|
||||
".md"}
|
||||
target="_blank"
|
||||
>
|
||||
<DocumentChartBar class="h-6 w-6" />
|
||||
<Tr
|
||||
t={Translations.t.general.attribution.openThemeDocumentation.Subs({
|
||||
name: layout.title,
|
||||
})}
|
||||
/>
|
||||
</a>
|
||||
|
||||
<a class="flex" href="https://en.osm.town/@MapComplete" target="_blank">
|
||||
|
|
|
@ -1660,13 +1660,13 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
|
|||
}
|
||||
}
|
||||
|
||||
private static emojiRegex = /^\p{Extended_Pictographic}+$/u
|
||||
private static emojiRegex = /^\p{Extended_Pictographic}+$/u
|
||||
|
||||
/**
|
||||
* Returns 'true' if the given string contains at least one and only emoji characters
|
||||
* @param string
|
||||
*/
|
||||
public static isEmoji(string: string){
|
||||
public static isEmoji(string: string) {
|
||||
return Utils.emojiRegex.test(string)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"contributors": [
|
||||
{
|
||||
"commits": 7549,
|
||||
"commits": 7596,
|
||||
"contributor": "Pieter Vander Vennet"
|
||||
},
|
||||
{
|
||||
|
@ -17,7 +17,7 @@
|
|||
"contributor": "Win Olario"
|
||||
},
|
||||
{
|
||||
"commits": 35,
|
||||
"commits": 36,
|
||||
"contributor": "dependabot[bot]"
|
||||
},
|
||||
{
|
||||
|
@ -128,6 +128,10 @@
|
|||
"commits": 9,
|
||||
"contributor": "Midgard"
|
||||
},
|
||||
{
|
||||
"commits": 8,
|
||||
"contributor": "Binnette"
|
||||
},
|
||||
{
|
||||
"commits": 8,
|
||||
"contributor": "pelderson"
|
||||
|
@ -144,10 +148,6 @@
|
|||
"commits": 7,
|
||||
"contributor": "OliNau"
|
||||
},
|
||||
{
|
||||
"commits": 7,
|
||||
"contributor": "Binnette"
|
||||
},
|
||||
{
|
||||
"commits": 6,
|
||||
"contributor": "David Haberthür"
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
"ca"
|
||||
],
|
||||
"AE": [
|
||||
"en",
|
||||
"ar"
|
||||
],
|
||||
"AF": [
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"ca": "català",
|
||||
"cs": "čeština",
|
||||
"da": "dansk",
|
||||
"de": "Deutsch",
|
||||
"en": "English",
|
||||
|
@ -11,7 +12,7 @@
|
|||
"gl": "lingua galega",
|
||||
"he": "עברית",
|
||||
"hu": "magyar",
|
||||
"id": "Indonesia",
|
||||
"id": "bahasa Indonesia",
|
||||
"it": "italiano",
|
||||
"ja": "日本語",
|
||||
"nb_NO": "bokmål",
|
||||
|
@ -22,7 +23,6 @@
|
|||
"ru": "русский язык",
|
||||
"sl": "slovenščina",
|
||||
"sv": "svenska",
|
||||
"zgh": "ⵜⴰⵎⴰⵣⵉⵖⵜ ⵜⴰⵏⴰⵡⴰⵢⵜ ⵜⴰⵎⵖⵔⵉⴱⵉⵜ",
|
||||
"zh_Hans": "简体中文",
|
||||
"zh_Hant": "繁體中文"
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
"contributors": [
|
||||
{
|
||||
"commits": 374,
|
||||
"commits": 378,
|
||||
"contributor": "Pieter Vander Vennet"
|
||||
},
|
||||
{
|
||||
"commits": 346,
|
||||
"commits": 347,
|
||||
"contributor": "kjon"
|
||||
},
|
||||
{
|
||||
|
@ -21,7 +21,7 @@
|
|||
"contributor": "Robin van der Linde"
|
||||
},
|
||||
{
|
||||
"commits": 65,
|
||||
"commits": 67,
|
||||
"contributor": "mcliquid"
|
||||
},
|
||||
{
|
||||
|
@ -184,6 +184,10 @@
|
|||
"commits": 9,
|
||||
"contributor": "Jacque Fresco"
|
||||
},
|
||||
{
|
||||
"commits": 8,
|
||||
"contributor": "Jeff Huang"
|
||||
},
|
||||
{
|
||||
"commits": 8,
|
||||
"contributor": "Krzysztof Chorzempa"
|
||||
|
@ -212,10 +216,6 @@
|
|||
"commits": 6,
|
||||
"contributor": "hugoalh"
|
||||
},
|
||||
{
|
||||
"commits": 6,
|
||||
"contributor": "Jeff Huang"
|
||||
},
|
||||
{
|
||||
"commits": 6,
|
||||
"contributor": "Juele juele"
|
||||
|
|
20
src/index.ts
20
src/index.ts
|
@ -52,13 +52,13 @@ async function main() {
|
|||
])
|
||||
console.log("The available layers on server are", Array.from(availableLayers))
|
||||
const state = new ThemeViewState(layout, availableLayers)
|
||||
const target = document.getElementById("maindiv")
|
||||
const target = document.getElementById("maindiv")
|
||||
const childs = Array.from(target.children)
|
||||
new ThemeViewGUI({
|
||||
target,
|
||||
props: { state },
|
||||
})
|
||||
childs.forEach(ch => target.removeChild(ch))
|
||||
childs.forEach((ch) => target.removeChild(ch))
|
||||
Array.from(document.getElementsByClassName("delete-on-load")).forEach((el) => {
|
||||
el.parentElement.removeChild(el)
|
||||
})
|
||||
|
@ -69,13 +69,15 @@ async function main() {
|
|||
new FixedUiElement(err.toString().split("\n").join("<br/>")).SetClass("block alert"),
|
||||
|
||||
customDefinition?.length > 0
|
||||
? new SubtleButton(new SvelteUIElement(ArrowDownTray), "Download the raw file").onClick(
|
||||
() =>
|
||||
Utils.offerContentsAsDownloadableFile(
|
||||
DetermineLayout.getCustomDefinition(),
|
||||
"mapcomplete-theme.json",
|
||||
{ mimetype: "application/json" }
|
||||
)
|
||||
? new SubtleButton(
|
||||
new SvelteUIElement(ArrowDownTray),
|
||||
"Download the raw file"
|
||||
).onClick(() =>
|
||||
Utils.offerContentsAsDownloadableFile(
|
||||
DetermineLayout.getCustomDefinition(),
|
||||
"mapcomplete-theme.json",
|
||||
{ mimetype: "application/json" }
|
||||
)
|
||||
)
|
||||
: undefined,
|
||||
]).AttachTo("maindiv")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue