forked from MapComplete/MapComplete
Refactoring: cleanup of no longer necessary code
This commit is contained in:
parent
afb94ecefb
commit
d7b83e0d88
8 changed files with 4 additions and 113 deletions
|
|
@ -22,8 +22,6 @@ import { And } from "../../Logic/Tags/And"
|
|||
import TagRenderingConfig from "../../Models/ThemeConfig/TagRenderingConfig"
|
||||
import TagRenderingEditable from "./TagRendering/TagRenderingEditable.svelte"
|
||||
import AllTagsPanel from "./AllTagsPanel/AllTagsPanel.svelte"
|
||||
import { FixedUiElement } from "../Base/FixedUiElement"
|
||||
import { TagUtils } from "../../Logic/Tags/TagUtils"
|
||||
import CollectionTimes from "../CollectionTimes/CollectionTimes.svelte"
|
||||
|
||||
class DirectionIndicatorVis extends SpecialVisualization {
|
||||
|
|
@ -293,47 +291,6 @@ class AllTagsVis extends SpecialVisualizationSvelte {
|
|||
}
|
||||
}
|
||||
|
||||
class TagsVis extends SpecialVisualization {
|
||||
funcName = "tags"
|
||||
docs = "Shows a (json of) tags in a human-readable way + links to the wiki"
|
||||
|
||||
args = [
|
||||
{
|
||||
name: "key",
|
||||
type: "key",
|
||||
defaultValue: "value",
|
||||
doc: "The key to look for the tags",
|
||||
},
|
||||
]
|
||||
|
||||
constr(
|
||||
state: SpecialVisualizationState,
|
||||
tagSource: UIEventSource<Record<string, string>>,
|
||||
argument: string[],
|
||||
): BaseUIElement {
|
||||
const key = argument[0] ?? "value"
|
||||
return new VariableUiElement(
|
||||
tagSource.map((tags) => {
|
||||
let value = tags[key]
|
||||
if (!value) {
|
||||
return new FixedUiElement("No tags found").SetClass("font-bold")
|
||||
}
|
||||
if (typeof value === "string" && value.startsWith("{")) {
|
||||
value = JSON.parse(value)
|
||||
}
|
||||
try {
|
||||
const parsed = TagUtils.Tag(value)
|
||||
return parsed.asHumanString(true, false, {})
|
||||
} catch (e) {
|
||||
return new FixedUiElement(
|
||||
"Could not parse this tag: " + JSON.stringify(value) + " due to " + e,
|
||||
).SetClass("alert")
|
||||
}
|
||||
}),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
class PointsInTimeVis extends SpecialVisualization {
|
||||
docs = "Creates a visualisation for 'points in time', e.g. collection times of a postbox"
|
||||
group = "data"
|
||||
|
|
@ -372,7 +329,6 @@ export class DataVisualisations {
|
|||
new PresetDescription(),
|
||||
new PresetTypeSelect(),
|
||||
new AllTagsVis(),
|
||||
new TagsVis(),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue