Fix: various small fixes

This commit is contained in:
Pieter Vander Vennet 2024-12-26 23:19:47 +01:00
parent e7f0291038
commit 5284d94427
6 changed files with 17 additions and 15 deletions

View file

@ -91,7 +91,6 @@ export default class AllImageProviders {
However, we override them if a custom image tag is set, e.g. 'image:menu' However, we override them if a custom image tag is set, e.g. 'image:menu'
*/ */
const prefixes = tagKey ?? imageProvider.defaultKeyPrefixes const prefixes = tagKey ?? imageProvider.defaultKeyPrefixes
console.log("Prefixes are", tagKey, prefixes)
const singleSource = tags.bindD((tags) => imageProvider.getRelevantUrls(tags, prefixes)) const singleSource = tags.bindD((tags) => imageProvider.getRelevantUrls(tags, prefixes))
allSources.push(singleSource) allSources.push(singleSource)
singleSource.addCallbackAndRunD((_) => { singleSource.addCallbackAndRunD((_) => {

View file

@ -312,8 +312,8 @@ export default class NameSuggestionIndex {
} }
const hasSpecial = const hasSpecial =
i.locationSet.include?.some((i) => i.endsWith(".geojson") || Array.isArray(i)) || i.locationSet.include?.some((i) => Array.isArray(i) || i.endsWith(".geojson")) ||
i.locationSet.exclude?.some((i) => i.endsWith(".geojson") || Array.isArray(i)) i.locationSet.exclude?.some((i) => Array.isArray(i) || i.endsWith(".geojson"))
if (!hasSpecial) { if (!hasSpecial) {
return false return false
} }

View file

@ -29,6 +29,7 @@
html?.remove() html?.remove()
uiElement?.Destroy() uiElement?.Destroy()
}) })
</script> </script>
{#if isSvelte} {#if isSvelte}
@ -42,6 +43,6 @@
{:else} {:else}
<svelte:component this={svelteElem?._svelteComponent} {...svelteElem._props} /> <svelte:component this={svelteElem?._svelteComponent} {...svelteElem._props} />
{/if} {/if}
{:else} {:else if elem !== undefined}
<span bind:this={elem} /> <span bind:this={elem} />
{/if} {/if}

View file

@ -43,14 +43,13 @@ export class DeleteFlowState {
console.log("Checking deleteability (internet?", useTheInternet, ")") console.log("Checking deleteability (internet?", useTheInternet, ")")
const t = Translations.t.delete const t = Translations.t.delete
const id = this._id const id = this._id
const self = this
if (!id.startsWith("node")) { if (!id.startsWith("node")) {
this.canBeDeleted.setData(false) this.canBeDeleted.setData(false)
this.canBeDeletedReason.setData(t.isntAPoint) this.canBeDeletedReason.setData(t.isntAPoint)
return return
} }
// Does the currently logged in user have enough experience to delete this point? // Does the currently logged-in user have enough experience to delete this point?
const deletingPointsOfOtherAllowed = this._osmConnection.userDetails.map((ud) => { const deletingPointsOfOtherAllowed = this._osmConnection.userDetails.map((ud) => {
if (ud === undefined) { if (ud === undefined) {
return undefined return undefined
@ -74,10 +73,10 @@ export class DeleteFlowState {
// Not yet downloaded // Not yet downloaded
return null return null
} }
const userId = self._osmConnection.userDetails.data.uid const userId = this._osmConnection.userDetails.data.uid
return !previous.some((editor) => editor !== userId) return !previous.some((editor) => editor !== userId)
}, },
[self._osmConnection.userDetails] [this._osmConnection.userDetails]
) )
// User allowed OR only edited by self? // User allowed OR only edited by self?
@ -96,14 +95,13 @@ export class DeleteFlowState {
if (allByMyself.data === null && useTheInternet) { if (allByMyself.data === null && useTheInternet) {
// We kickoff the download here as it hasn't yet been downloaded. Note that this is mapped onto 'all by myself' above // We kickoff the download here as it hasn't yet been downloaded. Note that this is mapped onto 'all by myself' above
const hist = this.objectDownloader UIEventSource.FromPromise(this.objectDownloader
.downloadHistory(id) .downloadHistory(id))
.map((versions) => .mapD((versions) =>
versions.map((version) => versions.map((version) =>
Number(version.tags["_last_edit:contributor:uid"]) Number(version.tags["_last_edit:contributor:uid"])
) )
) ).addCallbackAndRunD((hist) => previousEditors.setData(hist))
hist.addCallbackAndRunD((hist) => previousEditors.setData(hist))
} }
if (allByMyself.data === true) { if (allByMyself.data === true) {

View file

@ -12,7 +12,6 @@
import Translations from "../../i18n/Translations.js" import Translations from "../../i18n/Translations.js"
import { Utils } from "../../../Utils" import { Utils } from "../../../Utils"
import { onDestroy } from "svelte" import { onDestroy } from "svelte"
import TagRenderingQuestion from "./TagRenderingQuestion.svelte"
import TagRenderingQuestionDynamic from "./TagRenderingQuestionDynamic.svelte" import TagRenderingQuestionDynamic from "./TagRenderingQuestionDynamic.svelte"
export let layer: LayerConfig export let layer: LayerConfig
@ -54,6 +53,7 @@
let skippedQuestions = new UIEventSource<Set<string>>(new Set<string>()) let skippedQuestions = new UIEventSource<Set<string>>(new Set<string>())
let layerDisabledForTheme = state.userRelatedState.getThemeDisabled(state.theme.id, layer.id) let layerDisabledForTheme = state.userRelatedState.getThemeDisabled(state.theme.id, layer.id)
layerDisabledForTheme.addCallbackAndRunD((disabled) => { layerDisabledForTheme.addCallbackAndRunD((disabled) => {
console.log("Disabled questions are ", disabled)
skippedQuestions.set(new Set(disabled.concat(Array.from(skippedQuestions.data)))) skippedQuestions.set(new Set(disabled.concat(Array.from(skippedQuestions.data))))
}) })
let questionboxElem: HTMLDivElement let questionboxElem: HTMLDivElement

View file

@ -49,9 +49,13 @@
function createVisualisation(specpart: Exclude<RenderingSpecification, string>): BaseUIElement { function createVisualisation(specpart: Exclude<RenderingSpecification, string>): BaseUIElement {
{ {
try { try {
return specpart.func const uiEl = specpart.func
.constr(state, tags, specpart.args, feature, layer) .constr(state, tags, specpart.args, feature, layer)
?.SetClass(specpart.style) ?.SetClass(specpart.style)
if (uiEl === undefined) {
console.error("Invalid special translation")
}
return uiEl
} catch (e) { } catch (e) {
console.error( console.error(
"Could not construct a special visualisation with specification", "Could not construct a special visualisation with specification",