forked from MapComplete/MapComplete
Housekeeping
This commit is contained in:
parent
21c35fc2c5
commit
f7d19bcc02
216 changed files with 33997 additions and 1554 deletions
|
|
@ -1,84 +1,99 @@
|
|||
<script lang="ts">
|
||||
import { Store, UIEventSource } from "../../Logic/UIEventSource"
|
||||
import type { SpecialVisualizationState } from "../SpecialVisualization"
|
||||
import { Utils } from "../../Utils"
|
||||
import Loading from "../../assets/svg/Loading.svelte"
|
||||
|
||||
import { Store, UIEventSource } from "../../Logic/UIEventSource";
|
||||
import type { SpecialVisualizationState } from "../SpecialVisualization";
|
||||
import { Utils } from "../../Utils";
|
||||
import Loading from "../../assets/svg/Loading.svelte";
|
||||
export let tags: Store<Record<string, string>>
|
||||
export let giggityUrl: string
|
||||
export let state: SpecialVisualizationState
|
||||
|
||||
export let tags: Store<Record<string, string>>;
|
||||
export let giggityUrl: string;
|
||||
export let state: SpecialVisualizationState;
|
||||
|
||||
let name = $tags["name"];
|
||||
let events: UIEventSource<{
|
||||
date: Date,
|
||||
start: string,
|
||||
duration: string,
|
||||
room: string,
|
||||
slug: string,
|
||||
url: string,
|
||||
title: string,
|
||||
track: string,
|
||||
type: string,
|
||||
language: string,
|
||||
abstract: string,
|
||||
description: string,
|
||||
persons: string,
|
||||
} []> = new UIEventSource(undefined);
|
||||
let name = $tags["name"]
|
||||
let events: UIEventSource<
|
||||
{
|
||||
date: Date
|
||||
start: string
|
||||
duration: string
|
||||
room: string
|
||||
slug: string
|
||||
url: string
|
||||
title: string
|
||||
track: string
|
||||
type: string
|
||||
language: string
|
||||
abstract: string
|
||||
description: string
|
||||
persons: string
|
||||
}[]
|
||||
> = new UIEventSource(undefined)
|
||||
|
||||
async function loadXml() {
|
||||
if (!name) {
|
||||
console.log("Not fetching giggity events as name is", name, tags);
|
||||
return;
|
||||
console.log("Not fetching giggity events as name is", name, tags)
|
||||
return
|
||||
}
|
||||
const xmlStr = await Utils.downloadAdvanced(giggityUrl);
|
||||
console.log("Raw xml", xmlStr);
|
||||
const parser = new DOMParser();
|
||||
let doc = parser.parseFromString(xmlStr.content, "application/xml");
|
||||
let days = Array.from(doc.documentElement.getElementsByTagName("day"));
|
||||
let today = new Date().toISOString().split("T")[0];
|
||||
const eventsToday = days.find(day => day.getAttribute("date") === today);
|
||||
console.log("Events today", eventsToday);
|
||||
const childs = ["date", "start", "duration", "room", "slug", "url", "title", "track", "type", "language", "abstract", "description", "persons"];
|
||||
const xmlStr = await Utils.downloadAdvanced(giggityUrl)
|
||||
console.log("Raw xml", xmlStr)
|
||||
const parser = new DOMParser()
|
||||
let doc = parser.parseFromString(xmlStr.content, "application/xml")
|
||||
let days = Array.from(doc.documentElement.getElementsByTagName("day"))
|
||||
let today = new Date().toISOString().split("T")[0]
|
||||
const eventsToday = days.find((day) => day.getAttribute("date") === today)
|
||||
console.log("Events today", eventsToday)
|
||||
const childs = [
|
||||
"date",
|
||||
"start",
|
||||
"duration",
|
||||
"room",
|
||||
"slug",
|
||||
"url",
|
||||
"title",
|
||||
"track",
|
||||
"type",
|
||||
"language",
|
||||
"abstract",
|
||||
"description",
|
||||
"persons",
|
||||
]
|
||||
|
||||
const now = new Date().toISOString().split("T")[1].substring(0, 5)
|
||||
let eventsList = [];
|
||||
let eventsList = []
|
||||
for (const eventXml of Array.from(eventsToday.getElementsByTagName("event"))) {
|
||||
const event: Record<string, string> = {};
|
||||
const event: Record<string, string> = {}
|
||||
for (const child of childs) {
|
||||
const v = Array.from(eventXml.getElementsByTagName(child)).map(xml => xml.textContent).join("; ");
|
||||
event[child] = v;
|
||||
const v = Array.from(eventXml.getElementsByTagName(child))
|
||||
.map((xml) => xml.textContent)
|
||||
.join("; ")
|
||||
event[child] = v
|
||||
}
|
||||
if(!name.startsWith(event.room)){
|
||||
if (!name.startsWith(event.room)) {
|
||||
continue
|
||||
}
|
||||
if(now > event.start){
|
||||
if (now > event.start) {
|
||||
continue
|
||||
}
|
||||
eventsList.push(event);
|
||||
eventsList.push(event)
|
||||
}
|
||||
events.setData(eventsList);
|
||||
events.setData(eventsList)
|
||||
}
|
||||
|
||||
loadXml();
|
||||
|
||||
loadXml()
|
||||
</script>
|
||||
|
||||
{#if $events === undefined}
|
||||
<Loading class="h-4">Loading giggity events from {giggityUrl}</Loading>
|
||||
{:else if $events.length === 0}
|
||||
{:else if $events.length === 0}
|
||||
<i>No upcoming events in this room</i>
|
||||
{:else}
|
||||
<div>
|
||||
<h2>Upcoming events</h2>
|
||||
{#each $events as event}
|
||||
<div class="flex flex-col m-2 border border-gray-200 border-dotted">
|
||||
<div class="m-2 flex flex-col border border-dotted border-gray-200">
|
||||
{#if event.url}
|
||||
<h3><a href={event.url} target="_blank">{event.title}</a></h3>
|
||||
|
||||
{:else }
|
||||
<h3>{event.title}</h3>
|
||||
{/if}
|
||||
{:else}
|
||||
<h3>{event.title}</h3>
|
||||
{/if}
|
||||
<div><b>{event.start}</b></div>
|
||||
<i>By {event.persons}</i>
|
||||
<div>
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@
|
|||
<div class="flex flex-col">
|
||||
<!-- Title element-->
|
||||
<h3>
|
||||
|
||||
<TagRenderingAnswer config={layer.title} {selectedElement} {state} {tags} {layer} />
|
||||
</h3>
|
||||
<div
|
||||
|
|
|
|||
|
|
@ -20,15 +20,20 @@
|
|||
_metatags = tags
|
||||
})
|
||||
)
|
||||
|
||||
|
||||
let knownTagRenderings = layer.tagRenderings
|
||||
.filter(config => (config.condition?.matchesProperties($tags) ?? true) && (config.metacondition?.matchesProperties({ ...$tags, ..._metatags } ?? true)
|
||||
&& config.IsKnown($tags)))
|
||||
|
||||
let knownTagRenderings = layer.tagRenderings.filter(
|
||||
(config) =>
|
||||
(config.condition?.matchesProperties($tags) ?? true) &&
|
||||
config.metacondition?.matchesProperties({ ...$tags, ..._metatags } ?? true) &&
|
||||
config.IsKnown($tags)
|
||||
)
|
||||
$: {
|
||||
knownTagRenderings = layer.tagRenderings
|
||||
.filter(config => (config.condition?.matchesProperties($tags) ?? true) && (config.metacondition?.matchesProperties({ ...$tags, ..._metatags } ?? true)
|
||||
&& config.IsKnown($tags)))
|
||||
knownTagRenderings = layer.tagRenderings.filter(
|
||||
(config) =>
|
||||
(config.condition?.matchesProperties($tags) ?? true) &&
|
||||
config.metacondition?.matchesProperties({ ...$tags, ..._metatags } ?? true) &&
|
||||
config.IsKnown($tags)
|
||||
)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
@ -40,15 +45,15 @@
|
|||
{:else}
|
||||
<div class="flex h-full flex-col gap-y-2 overflow-y-auto p-1 px-2">
|
||||
{#each knownTagRenderings as config (config.id)}
|
||||
<TagRenderingEditable
|
||||
{tags}
|
||||
{config}
|
||||
{state}
|
||||
{selectedElement}
|
||||
{layer}
|
||||
{highlightedRendering}
|
||||
clss={knownTagRenderings.length === 1 ? "h-full" : "tr-length-"+knownTagRenderings.length}
|
||||
/>
|
||||
<TagRenderingEditable
|
||||
{tags}
|
||||
{config}
|
||||
{state}
|
||||
{selectedElement}
|
||||
{layer}
|
||||
{highlightedRendering}
|
||||
clss={knownTagRenderings.length === 1 ? "h-full" : "tr-length-" + knownTagRenderings.length}
|
||||
/>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,15 @@
|
|||
<script lang="ts">
|
||||
import type { Feature } from "geojson";
|
||||
import type { SpecialVisualizationState } from "../SpecialVisualization";
|
||||
import SelectedElementTitle from "./SelectedElementTitle.svelte";
|
||||
import LayerConfig from "../../Models/ThemeConfig/LayerConfig";
|
||||
import TagRenderingAnswer from "../Popup/TagRendering/TagRenderingAnswer.svelte";
|
||||
import type { Feature } from "geojson"
|
||||
import type { SpecialVisualizationState } from "../SpecialVisualization"
|
||||
import SelectedElementTitle from "./SelectedElementTitle.svelte"
|
||||
import LayerConfig from "../../Models/ThemeConfig/LayerConfig"
|
||||
import TagRenderingAnswer from "../Popup/TagRendering/TagRenderingAnswer.svelte"
|
||||
|
||||
export let state: SpecialVisualizationState;
|
||||
export let state: SpecialVisualizationState
|
||||
export let feature: Feature
|
||||
let id = feature.properties.id
|
||||
let tags = state.featureProperties.getStore(id);
|
||||
let tags = state.featureProperties.getStore(id)
|
||||
let layer: LayerConfig = state.layout.getMatchingLayer(tags.data)
|
||||
|
||||
</script>
|
||||
<TagRenderingAnswer config={layer.title} selectedElement={feature} {state} {tags} {layer} />
|
||||
|
||||
<TagRenderingAnswer config={layer.title} selectedElement={feature} {state} {tags} {layer} />
|
||||
|
|
|
|||
|
|
@ -87,10 +87,10 @@
|
|||
|
||||
{#if theme.id !== personal.id || $unlockedPersonal}
|
||||
<SubtleLink href={$href} options={{ extraClasses: "w-full" }}>
|
||||
<img slot="image" src={theme.icon} class="mr-2 m-1 sm:mr-4 sm:m-2 block h-11 w-11" alt="" />
|
||||
<img slot="image" src={theme.icon} class="m-1 mr-2 block h-11 w-11 sm:m-2 sm:mr-4" alt="" />
|
||||
<span class="flex flex-col overflow-hidden text-ellipsis">
|
||||
<Tr t={title} />
|
||||
|
||||
|
||||
{#if selected}
|
||||
<span class="alert">
|
||||
<Tr t={Translations.t.general.morescreen.enterToOpen} />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue