2025-06-21 21:07:36 +02:00
|
|
|
<script lang="ts">
|
|
|
|
|
import { TrackPoint, Waypoint } from 'gpx';
|
|
|
|
|
import WaypointPopup from '$lib/components/map/gpx-layer/WaypointPopup.svelte';
|
|
|
|
|
import TrackpointPopup from '$lib/components/map/gpx-layer/TrackpointPopup.svelte';
|
|
|
|
|
import OverpassPopup from '$lib/components/map/layer-control/OverpassPopup.svelte';
|
2025-10-17 23:54:45 +02:00
|
|
|
import type { PopupItem } from '$lib/components/map/map-popup';
|
|
|
|
|
import type { Writable } from 'svelte/store';
|
2025-06-21 21:07:36 +02:00
|
|
|
|
2025-10-17 23:54:45 +02:00
|
|
|
let {
|
|
|
|
|
item,
|
|
|
|
|
onContainerReady,
|
|
|
|
|
}: { item: Writable<PopupItem | null>; onContainerReady: (div: HTMLDivElement) => void } =
|
2025-06-21 21:07:36 +02:00
|
|
|
$props();
|
2025-10-17 23:54:45 +02:00
|
|
|
|
|
|
|
|
let container: HTMLDivElement | null = $state(null);
|
|
|
|
|
|
|
|
|
|
$effect(() => {
|
|
|
|
|
if (container) {
|
|
|
|
|
onContainerReady(container);
|
|
|
|
|
}
|
|
|
|
|
});
|
2025-06-21 21:07:36 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<div bind:this={container}>
|
2025-10-17 23:54:45 +02:00
|
|
|
{#if $item}
|
|
|
|
|
{#if $item.item instanceof Waypoint}
|
|
|
|
|
<WaypointPopup waypoint={$item} />
|
|
|
|
|
{:else if $item.item instanceof TrackPoint}
|
|
|
|
|
<TrackpointPopup trackpoint={$item} />
|
2025-06-21 21:07:36 +02:00
|
|
|
{:else}
|
2025-10-17 23:54:45 +02:00
|
|
|
<OverpassPopup poi={$item} />
|
2025-06-21 21:07:36 +02:00
|
|
|
{/if}
|
|
|
|
|
{/if}
|
|
|
|
|
</div>
|