Files
gpx.studio/website/src/lib/components/map/gpx-layer/TrackpointPopup.svelte
T

38 lines
1.4 KiB
Svelte
Raw Normal View History

<script lang="ts">
import { Button } from '$lib/components/ui/button';
2025-06-21 21:07:36 +02:00
import CopyCoordinates from '$lib/components/map/gpx-layer/CopyCoordinates.svelte';
2025-02-02 11:17:22 +01:00
import * as Card from '$lib/components/ui/card';
2026-11-08 15:06:03 +01:00
import { Compass, Earth } from '@lucide/svelte';
2026-10-31 18:08:22 +01:00
import { i18n } from '$lib/i18n/i18n.svelte';
2025-10-23 19:07:32 +02:00
import type { PopupItem } from '$lib/components/map/map-popup';
2025-12-08 20:17:57 +01:00
import { map } from '$lib/components/map/map';
2026-10-31 18:08:22 +01:00
let {
trackpoint,
}: {
2026-11-08 15:06:03 +01:00
trackpoint: PopupItem<{ lng: number; lat: number }>;
2026-10-31 18:08:22 +01:00
} = $props();
</script>
<Card.Root class="border-none shadow-md text-base p-2">
2025-02-02 11:17:22 +01:00
<Card.Content class="flex flex-col p-0 text-xs gap-1">
<div class="flex flex-row items-center gap-1">
<Compass size="14" />
2026-10-31 18:08:22 +01:00
{trackpoint.item.lat.toFixed(6)}&deg; {trackpoint.item.lng.toFixed(6)}&deg;
2025-02-02 11:17:22 +01:00
</div>
<CopyCoordinates
2026-10-31 18:08:22 +01:00
coordinates={trackpoint.item}
onCopy={() => trackpoint.hide?.()}
class="mt-0.5"
/>
2026-11-08 15:06:03 +01:00
<Button
variant="outline"
class="justify-start"
href={`https://www.openstreetmap.org/edit?#map=${(($map?.getZoom() ?? 17) + 1).toFixed(0)}/${trackpoint.item.lat.toFixed(5)}/${trackpoint.item.lng.toFixed(5)}`}
target="_blank"
>
<Earth size="14" />
{i18n._('menu.edit_osm')}
</Button>
2025-02-02 11:17:22 +01:00
</Card.Content>
</Card.Root>