2024-02-20 13:33:38 +01:00
< script lang = "ts" >
2024-02-26 02:24:46 +01:00
/**
* The comparison tool loads json-data from a speficied URL, eventually post-processes it
* and compares it with the current object
*/
import Loading from "../Base/Loading.svelte"
import type { SpecialVisualizationState } from "../SpecialVisualization"
import { Store , UIEventSource } from "../../Logic/UIEventSource"
import ComparisonTable from "./ComparisonTable.svelte"
import LayerConfig from "../../Models/ThemeConfig/LayerConfig"
import type { Feature } from "geojson"
import type { OsmTags } from "../../Models/OsmFeature"
2024-03-01 00:50:19 +01:00
import Translations from "../i18n/Translations"
import Tr from "../Base/Tr.svelte"
2024-01-13 05:24:56 +01:00
2024-02-26 02:24:46 +01:00
export let externalData: Store< { success : { content : Record < string , string > } } | { error : string } | undefined | null /* null if no URL is found, undefined if loading*/>
export let state: SpecialVisualizationState
export let tags: UIEventSource< OsmTags >
export let layer: LayerConfig
export let feature: Feature
export let readonly = false
2024-03-01 00:50:19 +01:00
export let sourceUrl: Store< string >
2024-01-13 05:24:56 +01:00
< / script >
2024-03-01 00:50:19 +01:00
{ #if ! $sourceUrl }
2024-02-26 02:24:46 +01:00
<!-- empty block -->
{ :else if $externalData === undefined }
2024-03-01 00:50:19 +01:00
< Loading / >
2024-02-26 02:24:46 +01:00
{ :else if $externalData [ "error" ] !== undefined }
2024-03-01 00:50:19 +01:00
< div class = "alert flex" >
< Tr t = { Translations . t . general . error } / >
{ $externalData [ "error" ]}
2024-01-13 05:24:56 +01:00
< / div >
2024-02-26 02:24:46 +01:00
{ :else if $externalData [ "success" ] !== undefined }
2024-02-20 13:33:38 +01:00
< ComparisonTable
2024-02-26 02:24:46 +01:00
externalProperties={ $externalData [ "success" ]}
2024-02-20 13:33:38 +01:00
osmProperties={ $tags }
{ state }
{ feature }
{ layer }
{ tags }
{ readonly }
2024-03-01 00:50:19 +01:00
sourceUrl={ $sourceUrl }
2024-02-20 13:33:38 +01:00
/>
2024-01-13 05:24:56 +01:00
{ /if }