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-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-01-13 05:24:56 +01:00
< / script >
2024-02-26 02:24:46 +01:00
{ #if $externalData === null }
<!-- empty block -->
{ :else if $externalData === undefined }
< Loading > { $externalData } </ Loading >
{ :else if $externalData [ "error" ] !== undefined }
2024-01-13 05:24:56 +01:00
< div class = "alert" >
2024-02-26 02:24:46 +01:00
Something went wrong: { $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-01-13 05:24:56 +01:00
{ /if }