forked from MapComplete/MapComplete
Merge develop
This commit is contained in:
commit
d959b6b40b
290 changed files with 37178 additions and 2200 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>
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
<script lang="ts">
|
||||
import Translations from "../i18n/Translations"
|
||||
import Svg from "../../Svg"
|
||||
import { Store } from "../../Logic/UIEventSource"
|
||||
import Tr from "../Base/Tr.svelte"
|
||||
import ToSvelte from "../Base/ToSvelte.svelte"
|
||||
import Mapillary_black from "../../assets/svg/Mapillary_black.svelte";
|
||||
import Translations from "../i18n/Translations"
|
||||
import { Store } from "../../Logic/UIEventSource"
|
||||
import Tr from "../Base/Tr.svelte"
|
||||
import Mapillary_black from "../../assets/svg/Mapillary_black.svelte"
|
||||
import { Mapillary } from "../../Logic/ImageProviders/Mapillary"
|
||||
|
||||
/*
|
||||
A subtleButton which opens mapillary in a new tab at the current location
|
||||
*/
|
||||
/*
|
||||
A subtleButton which opens mapillary in a new tab at the current location
|
||||
*/
|
||||
|
||||
export let mapProperties: {
|
||||
readonly zoom: Store<number>
|
||||
|
|
@ -16,13 +15,11 @@
|
|||
}
|
||||
let location = mapProperties.location
|
||||
let zoom = mapProperties.zoom
|
||||
let mapillaryLink = `https://www.mapillary.com/app/?focus=map&lat=${$location?.lat ?? 0}&lng=${
|
||||
$location?.lon ?? 0
|
||||
}&z=${Math.max(($zoom ?? 2) - 1, 1)}`
|
||||
let mapillaryLink = Mapillary.createLink($location, $zoom)
|
||||
</script>
|
||||
|
||||
<a class="button flex items-center" href={mapillaryLink} target="_blank">
|
||||
<Mapillary_black class="w-12 h-12 m-2 mr-4 shrink-0"/>
|
||||
<Mapillary_black class="m-2 mr-4 h-12 w-12 shrink-0" />
|
||||
<div class="flex flex-col">
|
||||
<Tr t={Translations.t.general.attribution.openMapillary} />
|
||||
<Tr cls="subtle" t={Translations.t.general.attribution.mapillaryHelp} />
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ export default class MoreScreen extends Combine {
|
|||
if (search === undefined) {
|
||||
return true
|
||||
}
|
||||
search = search.toLocaleLowerCase()
|
||||
search = Utils.RemoveDiacritics(search.toLocaleLowerCase())
|
||||
if (search.length > 3 && layout.id.toLowerCase().indexOf(search) >= 0) {
|
||||
return true
|
||||
}
|
||||
|
|
@ -131,7 +131,7 @@ export default class MoreScreen extends Combine {
|
|||
continue
|
||||
}
|
||||
const term = entity["*"] ?? entity[Locale.language.data]
|
||||
if (term?.toLowerCase()?.indexOf(search) >= 0) {
|
||||
if (Utils.RemoveDiacritics(term?.toLowerCase())?.indexOf(search) >= 0) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
import LayerConfig from "../../Models/ThemeConfig/LayerConfig"
|
||||
import { Utils } from "../../Utils"
|
||||
import { createEventDispatcher } from "svelte"
|
||||
import Move_arrows from "../../assets/svg/Move_arrows.svelte";
|
||||
import Move_arrows from "../../assets/svg/Move_arrows.svelte"
|
||||
|
||||
/**
|
||||
* An advanced location input, which has support to:
|
||||
|
|
@ -126,6 +126,6 @@
|
|||
maxDistanceInMeters="50"
|
||||
>
|
||||
<slot name="image" slot="image">
|
||||
<Move_arrows class="h-full max-h-24" />
|
||||
<Move_arrows class="h-full max-h-24" />
|
||||
</slot>
|
||||
</LocationInput>
|
||||
|
|
|
|||
|
|
@ -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} />
|
||||
|
|
|
|||
|
|
@ -1,21 +1,21 @@
|
|||
<script lang="ts">
|
||||
import Translations from "../i18n/Translations";
|
||||
import Tr from "../Base/Tr.svelte";
|
||||
import NextButton from "../Base/NextButton.svelte";
|
||||
import Geosearch from "./Geosearch.svelte";
|
||||
import ThemeViewState from "../../Models/ThemeViewState";
|
||||
import { UIEventSource } from "../../Logic/UIEventSource";
|
||||
import { SearchIcon } from "@rgossiaux/svelte-heroicons/solid";
|
||||
import { twJoin } from "tailwind-merge";
|
||||
import { Utils } from "../../Utils";
|
||||
import type { GeolocationPermissionState } from "../../Logic/State/GeoLocationState";
|
||||
import { GeoLocationState } from "../../Logic/State/GeoLocationState";
|
||||
import If from "../Base/If.svelte";
|
||||
import { ExclamationTriangleIcon } from "@babeard/svelte-heroicons/mini";
|
||||
import type { Readable } from "svelte/store";
|
||||
import Add from "../../assets/svg/Add.svelte";
|
||||
import Location_refused from "../../assets/svg/Location_refused.svelte";
|
||||
import Crosshair from "../../assets/svg/Crosshair.svelte";
|
||||
import Translations from "../i18n/Translations"
|
||||
import Tr from "../Base/Tr.svelte"
|
||||
import NextButton from "../Base/NextButton.svelte"
|
||||
import Geosearch from "./Geosearch.svelte"
|
||||
import ThemeViewState from "../../Models/ThemeViewState"
|
||||
import { UIEventSource } from "../../Logic/UIEventSource"
|
||||
import { SearchIcon } from "@rgossiaux/svelte-heroicons/solid"
|
||||
import { twJoin } from "tailwind-merge"
|
||||
import { Utils } from "../../Utils"
|
||||
import type { GeolocationPermissionState } from "../../Logic/State/GeoLocationState"
|
||||
import { GeoLocationState } from "../../Logic/State/GeoLocationState"
|
||||
import If from "../Base/If.svelte"
|
||||
import { ExclamationTriangleIcon } from "@babeard/svelte-heroicons/mini"
|
||||
import type { Readable } from "svelte/store"
|
||||
import Add from "../../assets/svg/Add.svelte"
|
||||
import Location_refused from "../../assets/svg/Location_refused.svelte"
|
||||
import Crosshair from "../../assets/svg/Crosshair.svelte"
|
||||
|
||||
/**
|
||||
* The theme introduction panel
|
||||
|
|
@ -71,7 +71,7 @@
|
|||
<If condition={state.featureSwitches.featureSwitchGeolocation}>
|
||||
{#if $currentGPSLocation !== undefined || $geopermission === "prompt"}
|
||||
<button class="flex w-full items-center gap-x-2" on:click={jumpToCurrentLocation}>
|
||||
<Crosshair class="w-8 h-8"/>
|
||||
<Crosshair class="h-8 w-8" />
|
||||
<Tr t={Translations.t.general.openTheMapAtGeolocation} />
|
||||
</button>
|
||||
<!-- No geolocation granted - we don't show the button -->
|
||||
|
|
@ -81,17 +81,23 @@
|
|||
on:click={jumpToCurrentLocation}
|
||||
>
|
||||
<!-- Even though disabled, when clicking we request the location again in case the contributor dismissed the location popup -->
|
||||
<Crosshair class="w-8 h-8" style="animation: 3s linear 0s infinite normal none running spin;" />
|
||||
<Crosshair
|
||||
class="h-8 w-8"
|
||||
style="animation: 3s linear 0s infinite normal none running spin;"
|
||||
/>
|
||||
<Tr t={Translations.t.general.waitingForGeopermission} />
|
||||
</button>
|
||||
{:else if $geopermission === "denied"}
|
||||
<button class="disabled flex w-full items-center gap-x-2">
|
||||
<Location_refused class="w-8 h-8"/>
|
||||
<Location_refused class="h-8 w-8" />
|
||||
<Tr t={Translations.t.general.geopermissionDenied} />
|
||||
</button>
|
||||
{:else}
|
||||
<button class="disabled flex w-full items-center gap-x-2">
|
||||
<Crosshair class="w-8 h-8" style="animation: 3s linear 0s infinite normal none running spin;" />
|
||||
<Crosshair
|
||||
class="h-8 w-8"
|
||||
style="animation: 3s linear 0s infinite normal none running spin;"
|
||||
/>
|
||||
<Tr t={Translations.t.general.waitingForLocation} />
|
||||
</button>
|
||||
{/if}
|
||||
|
|
@ -149,7 +155,7 @@
|
|||
<div class="links-as-button links-w-full m-2 flex flex-col gap-y-1">
|
||||
<!-- bottom buttons, a bit hidden away: switch layout -->
|
||||
<a class="flex" href={Utils.HomepageLink()}>
|
||||
<Add class="h-6 w-6"/>
|
||||
<Add class="h-6 w-6" />
|
||||
<Tr t={Translations.t.general.backToIndex} />
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue