Favourites: tweaking overview; fix upload of properties
This commit is contained in:
parent
59090fdb39
commit
a350410520
6 changed files with 49 additions and 25 deletions
|
@ -1,2 +1,2 @@
|
||||||
SPDX-FileCopyrightText: Pieter Vander Vennet
|
SPDX-FileCopyrightText: Pieter Vander Vennet
|
||||||
SPDX-License-Identifier: CC0
|
SPDX-License-Identifier: CC0-1.0
|
|
@ -841,10 +841,6 @@ video {
|
||||||
margin-right: 3rem;
|
margin-right: 3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mb-4 {
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mt-4 {
|
.mt-4 {
|
||||||
margin-top: 1rem;
|
margin-top: 1rem;
|
||||||
}
|
}
|
||||||
|
@ -881,6 +877,10 @@ video {
|
||||||
margin-right: 0.25rem;
|
margin-right: 0.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mb-4 {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
.ml-1 {
|
.ml-1 {
|
||||||
margin-left: 0.25rem;
|
margin-left: 0.25rem;
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,7 @@ export default class FavouritesFeatureSource extends StaticFeatureSource {
|
||||||
if (!key.startsWith(FavouritesFeatureSource.prefix + id)) {
|
if (!key.startsWith(FavouritesFeatureSource.prefix + id)) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
const propertyName = key.substring(minLength)
|
const propertyName = key.substring(minLength).replaceAll("__", ":")
|
||||||
properties[propertyName] = prefs[key]
|
properties[propertyName] = prefs[key]
|
||||||
}
|
}
|
||||||
return properties
|
return properties
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
import { ImmutableStore } from "../../Logic/UIEventSource";
|
import { ImmutableStore } from "../../Logic/UIEventSource";
|
||||||
import { GeoOperations } from "../../Logic/GeoOperations";
|
import { GeoOperations } from "../../Logic/GeoOperations";
|
||||||
import Center from "../../assets/svg/Center.svelte";
|
import Center from "../../assets/svg/Center.svelte";
|
||||||
|
import { Utils } from "../../Utils";
|
||||||
|
|
||||||
export let feature: Feature;
|
export let feature: Feature;
|
||||||
let properties: Record<string, string> = feature.properties;
|
let properties: Record<string, string> = feature.properties;
|
||||||
|
@ -30,15 +31,31 @@
|
||||||
center()
|
center()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const coord = GeoOperations.centerpointCoordinates(feature)
|
||||||
|
const distance = state.mapProperties.location.stabilized(500).mapD(({lon, lat}) => {
|
||||||
|
let meters = Math.round(GeoOperations.distanceBetween(coord, [lon, lat]))
|
||||||
|
|
||||||
|
if(meters < 1000){
|
||||||
|
return meters +"m"
|
||||||
|
}
|
||||||
|
|
||||||
|
meters = Math.round(meters / 100)
|
||||||
|
const kmStr = ""+meters
|
||||||
|
|
||||||
|
|
||||||
|
return kmStr.substring(0, kmStr.length - 1)+"."+kmStr.substring(kmStr.length-1) +"km"
|
||||||
|
})
|
||||||
const titleIconBlacklist = ["osmlink","sharelink","favourite_title_icon"]
|
const titleIconBlacklist = ["osmlink","sharelink","favourite_title_icon"]
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="px-1 my-1 border-2 border-dashed border-gray-300 rounded flex justify-between items-center">
|
<div class="px-1 my-1 border-2 border-dashed border-gray-300 rounded flex justify-between items-center">
|
||||||
<h3 on:click={() => select()} class="cursor-pointer ml-1 m-0">
|
<h3 on:click={() => select()} class="cursor-pointer ml-1 m-0">
|
||||||
<TagRenderingAnswer config={titleConfig} layer={favConfig} selectedElement={feature} {tags} />
|
<TagRenderingAnswer extraClasses="underline" config={titleConfig} layer={favConfig} selectedElement={feature} {tags} />
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
|
{$distance}
|
||||||
|
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
{#each favConfig.titleIcons as titleIconConfig}
|
{#each favConfig.titleIcons as titleIconConfig}
|
||||||
{#if (titleIconBlacklist.indexOf(titleIconConfig.id) < 0) && (titleIconConfig.condition?.matchesProperties(properties) ?? true) && (titleIconConfig.metacondition?.matchesProperties( { ...properties, ...state.userRelatedState.preferencesAsTags.data } ) ?? true) && titleIconConfig.IsKnown(properties)}
|
{#if (titleIconBlacklist.indexOf(titleIconConfig.id) < 0) && (titleIconConfig.condition?.matchesProperties(properties) ?? true) && (titleIconConfig.metacondition?.matchesProperties( { ...properties, ...state.userRelatedState.preferencesAsTags.data } ) ?? true) && titleIconConfig.IsKnown(properties)}
|
||||||
|
|
|
@ -140,7 +140,7 @@
|
||||||
console.log("SelectedTags is undefined, ignoring 'onSave'-event")
|
console.log("SelectedTags is undefined, ignoring 'onSave'-event")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (layer === undefined || layer?.source === null) {
|
if (layer === undefined || (layer?.source === null && layer.id !== "favourite")) {
|
||||||
/**
|
/**
|
||||||
* This is a special, priviliged layer.
|
* This is a special, priviliged layer.
|
||||||
* We simply apply the tags onto the records
|
* We simply apply the tags onto the records
|
||||||
|
@ -159,7 +159,7 @@
|
||||||
|
|
||||||
dispatch("saved", { config, applied: selectedTags })
|
dispatch("saved", { config, applied: selectedTags })
|
||||||
const change = new ChangeTagAction(tags.data.id, selectedTags, tags.data, {
|
const change = new ChangeTagAction(tags.data.id, selectedTags, tags.data, {
|
||||||
theme: state.layout.id,
|
theme: tags.data["_orig_theme"] ?? state.layout.id,
|
||||||
changeType: "answer",
|
changeType: "answer",
|
||||||
})
|
})
|
||||||
freeformInput.setData(undefined)
|
freeformInput.setData(undefined)
|
||||||
|
|
|
@ -1,29 +1,30 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { UIEventSource } from "../../Logic/UIEventSource"
|
import { UIEventSource } from "../../Logic/UIEventSource";
|
||||||
import { OsmConnection } from "../../Logic/Osm/OsmConnection"
|
import { OsmConnection } from "../../Logic/Osm/OsmConnection";
|
||||||
import Marker from "../Map/Marker.svelte"
|
import Marker from "../Map/Marker.svelte";
|
||||||
import NextButton from "../Base/NextButton.svelte"
|
import NextButton from "../Base/NextButton.svelte";
|
||||||
import { AllKnownLayouts } from "../../Customizations/AllKnownLayouts"
|
import { AllKnownLayouts } from "../../Customizations/AllKnownLayouts";
|
||||||
import { AllSharedLayers } from "../../Customizations/AllSharedLayers"
|
import { AllSharedLayers } from "../../Customizations/AllSharedLayers";
|
||||||
import { createEventDispatcher } from "svelte"
|
import { createEventDispatcher } from "svelte";
|
||||||
|
|
||||||
export let info: { id: string; owner: number }
|
export let info: { id: string; owner: number };
|
||||||
export let category: "layers" | "themes"
|
export let category: "layers" | "themes";
|
||||||
export let osmConnection: OsmConnection
|
export let osmConnection: OsmConnection;
|
||||||
|
|
||||||
let displayName = UIEventSource.FromPromise(
|
let displayName = UIEventSource.FromPromise(
|
||||||
osmConnection.getInformationAboutUser(info.owner)
|
osmConnection.getInformationAboutUser(info.owner)
|
||||||
).mapD((response) => response.display_name)
|
).mapD((response) => response.display_name);
|
||||||
|
|
||||||
|
let selfId = osmConnection.userDetails.mapD((ud) => ud.uid);
|
||||||
|
|
||||||
let selfId = osmConnection.userDetails.mapD((ud) => ud.uid)
|
|
||||||
function fetchIconDescription(layerId): any {
|
function fetchIconDescription(layerId): any {
|
||||||
if (category === "themes") {
|
if (category === "themes") {
|
||||||
return AllKnownLayouts.allKnownLayouts.get(layerId).icon
|
return AllKnownLayouts.allKnownLayouts.get(layerId).icon;
|
||||||
}
|
}
|
||||||
return AllSharedLayers.getSharedLayersConfigs().get(layerId)?._layerIcon
|
return AllSharedLayers.getSharedLayersConfigs().get(layerId)?._layerIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
const dispatch = createEventDispatcher<{ layerSelected: string }>()
|
const dispatch = createEventDispatcher<{ layerSelected: string }>();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<NextButton clss="small" on:click={() => dispatch("layerSelected", info)}>
|
<NextButton clss="small" on:click={() => dispatch("layerSelected", info)}>
|
||||||
|
@ -32,6 +33,12 @@
|
||||||
</div>
|
</div>
|
||||||
<b class="px-1">{info.id}</b>
|
<b class="px-1">{info.id}</b>
|
||||||
{#if info.owner && info.owner !== $selfId}
|
{#if info.owner && info.owner !== $selfId}
|
||||||
(made by {$displayName ?? info.owner})
|
{#if displayName}
|
||||||
|
(made by {$displayName}
|
||||||
|
{#if window.location.host.startsWith("127.0.0.1")}
|
||||||
|
- {info.owner}
|
||||||
|
{/if}
|
||||||
|
)
|
||||||
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
</NextButton>
|
</NextButton>
|
||||||
|
|
Loading…
Reference in a new issue