mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-08-31 23:53:25 +00:00
set POI name to category when absent, closes, #15
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { _ } from 'svelte-i18n';
|
import { _ } from 'svelte-i18n';
|
||||||
import { dbUtils } from '$lib/db';
|
import { dbUtils } from '$lib/db';
|
||||||
|
import { get } from 'svelte/store';
|
||||||
|
|
||||||
let popupElement: HTMLDivElement;
|
let popupElement: HTMLDivElement;
|
||||||
|
|
||||||
@@ -16,8 +17,14 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
let tags = {};
|
let tags = {};
|
||||||
|
let name = '';
|
||||||
$: if ($overpassPopupPOI) {
|
$: if ($overpassPopupPOI) {
|
||||||
tags = JSON.parse($overpassPopupPOI.tags);
|
tags = JSON.parse($overpassPopupPOI.tags);
|
||||||
|
if (tags.name !== undefined && tags.name !== '') {
|
||||||
|
name = tags.name;
|
||||||
|
} else {
|
||||||
|
name = $_(`layers.label.${$overpassPopupPOI.query}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -28,7 +35,7 @@
|
|||||||
<Card.Title class="text-md">
|
<Card.Title class="text-md">
|
||||||
<div class="flex flex-row gap-3">
|
<div class="flex flex-row gap-3">
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
{tags.name ?? ''}
|
{name}
|
||||||
<div class="text-muted-foreground text-sm font-normal">
|
<div class="text-muted-foreground text-sm font-normal">
|
||||||
{$overpassPopupPOI.lat.toFixed(6)}° {$overpassPopupPOI.lon.toFixed(6)}°
|
{$overpassPopupPOI.lat.toFixed(6)}° {$overpassPopupPOI.lon.toFixed(6)}°
|
||||||
</div>
|
</div>
|
||||||
@@ -46,6 +53,7 @@
|
|||||||
</Card.Header>
|
</Card.Header>
|
||||||
{#if tags.image || tags['image:0']}
|
{#if tags.image || tags['image:0']}
|
||||||
<div class="w-full rounded-md overflow-clip my-2 max-w-96 mx-auto">
|
<div class="w-full rounded-md overflow-clip my-2 max-w-96 mx-auto">
|
||||||
|
<!-- svelte-ignore a11y-missing-attribute -->
|
||||||
<img src={tags.image ?? tags['image:0']} />
|
<img src={tags.image ?? tags['image:0']} />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -79,7 +87,7 @@
|
|||||||
lat: $overpassPopupPOI.lat,
|
lat: $overpassPopupPOI.lat,
|
||||||
lon: $overpassPopupPOI.lon
|
lon: $overpassPopupPOI.lon
|
||||||
},
|
},
|
||||||
name: tags.name ?? '',
|
name: name,
|
||||||
desc: desc,
|
desc: desc,
|
||||||
cmt: desc
|
cmt: desc
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user