diff --git a/src/UI/Comparison/ComparisonAction.svelte b/src/UI/Comparison/ComparisonAction.svelte index c44e0dd7c..e1b55235b 100644 --- a/src/UI/Comparison/ComparisonAction.svelte +++ b/src/UI/Comparison/ComparisonAction.svelte @@ -6,7 +6,10 @@ import LayerConfig from "../../Models/ThemeConfig/LayerConfig" import ChangeTagAction from "../../Logic/Osm/Actions/ChangeTagAction" import { Tag } from "../../Logic/Tags/Tag" + import TagRenderingAnswer from "../Popup/TagRendering/TagRenderingAnswer.svelte" import Loading from "../Base/Loading.svelte" + import Tr from "../Base/Tr.svelte" + import Translations from "../i18n/Translations" export let key: string export let externalProperties: Record @@ -38,34 +41,77 @@ await state.changes.applyChanges(await change.CreateChangeDescriptions()) currentStep = "done" } + + let _country = $tags["_country"] + let mockPropertiesOsm = { id: feature.properties.id, [key]: $tags[key], _country } + let mockPropertiesExternal = { id: feature.properties.id, [key]: externalProperties[key], _country } + let trsWithKeys = layer.tagRenderings.filter(tr => { + const keys: string[] = [].concat(...tr.usedTags().map(t => t.usedKeys())) + return keys.indexOf(key) >= 0 + }) + let renderingBoth = undefined // trsWithKeys.find(tr => tr.IsKnown(mockPropertiesOsm) && tr.IsKnown(mockPropertiesExternal)) + let renderingExternal = undefined // renderingBoth ?? trsWithKeys.find(tr => tr.IsKnown(mockPropertiesExternal)) + let onOverwrite = false + const t = Translations.t.external - - {key} +
+ +
+ {#if renderingExternal} + + {:else} +
+ {key}{externalProperties[key]} +
- {#if $tags[key]} - {$tags[key]} {/if} - - {#if externalProperties[key].startsWith("http")} - - {externalProperties[key]} - - {:else} - {externalProperties[key]} - {/if} - {#if !readonly} - - {#if currentStep === "init"} - - {:else if currentStep === "applying"} - - {:else if currentStep === "done"} -
Done
- {:else} -
Error
- {/if} - + {#if currentStep === "init"} + + {:else if currentStep === "applying"} + + {:else if currentStep === "done"} +
+ + +
+ {:else} +
+ +
+ {/if} {/if} - + +
+{#if $tags[key]} +
+ + + + {#if renderingBoth} + + {:else} +
+ {key} {$tags[key]} +
+ {/if} +
+{/if} +
diff --git a/src/UI/Comparison/ComparisonTable.svelte b/src/UI/Comparison/ComparisonTable.svelte index c806e2953..3fcf27f52 100644 --- a/src/UI/Comparison/ComparisonTable.svelte +++ b/src/UI/Comparison/ComparisonTable.svelte @@ -1,124 +1,136 @@ - -{#if different.length > 0} -

Conflicting items

- - - - - - - {#each different as key} - - {/each} -
KeyOSMExternal
-{/if} - -{#if missing.length > 0} - {#if currentStep === "init"} - - - - - - - {#each missing as key} - - {/each} -
KeyExternal
- {#if !readonly} - - {/if} - {:else if currentStep === "applying_all"} - Applying all missing values - {:else if currentStep === "all_applied"} -
All values are applied
- {/if} -{/if} - {#if unknownImages.length === 0 && missing.length === 0 && different.length === 0}
- All data from Velopark is also included into OpenStreetMap +
-{/if} - -{#if unknownImages.length > 0} - {#if readonly} -
-
- {#each unknownImages as image} - +{:else} +
+ +

+ +

+
+ + {#if different.length > 0} + {#each different as key} +
+ +
{/each} -
+ {/if} + + {#if missing.length > 0} + {#if currentStep === "init"} + + {#each missing as key} +
+ +
+ {/each} + {#if !readonly && missing.length > 1} + + {/if} + {:else if currentStep === "applying_all"} + + {:else if currentStep === "all_applied"} +
+ +
+ {/if} + {/if} +
- {:else} - {#each unknownImages as image} - 0} + {#if readonly} +
+
+ {#each unknownImages as image} + + {/each} +
+
+ {:else} + {#each unknownImages as image} + - {/each} - {/if} + {feature} + {layer} + /> + {/each} + {/if} + {/if} +
+ {/if} diff --git a/src/UI/Comparison/ComparisonTool.svelte b/src/UI/Comparison/ComparisonTool.svelte index 7f96ced49..1bb7681cd 100644 --- a/src/UI/Comparison/ComparisonTool.svelte +++ b/src/UI/Comparison/ComparisonTool.svelte @@ -10,6 +10,8 @@ import LayerConfig from "../../Models/ThemeConfig/LayerConfig" import type { Feature } from "geojson" import type { OsmTags } from "../../Models/OsmFeature" + import Translations from "../i18n/Translations" + import Tr from "../Base/Tr.svelte" export let externalData: Store<{ success: {content: Record } } | { error: string } | undefined | null /* null if no URL is found, undefined if loading*/> export let state: SpecialVisualizationState @@ -17,14 +19,17 @@ export let layer: LayerConfig export let feature: Feature export let readonly = false + export let sourceUrl: Store + -{#if $externalData === null} +{#if !$sourceUrl} {:else if $externalData === undefined} - {$externalData} + {:else if $externalData["error"] !== undefined} -
- Something went wrong: {$externalData["error"]} +
+ + {$externalData["error"]}
{:else if $externalData["success"] !== undefined} {/if} diff --git a/src/UI/SpecialVisualizations.ts b/src/UI/SpecialVisualizations.ts index c7b28bc2e..2c287a704 100644 --- a/src/UI/SpecialVisualizations.ts +++ b/src/UI/SpecialVisualizations.ts @@ -1743,6 +1743,7 @@ export default class SpecialVisualizations { } return ({ url: tags[key], country: tags._country }) }) + const sourceUrl: Store = url.mapD(url => url.url) const externalData: Store<{ success: { content: any } } | { error: string } | undefined | null> = url.bindD(({ @@ -1759,6 +1760,7 @@ export default class SpecialVisualizations { tags, layer, externalData, + sourceUrl }), undefined, url.map(url => !!url), ) },