Files
gpx.studio/website/src/lib/components/toolbar/tools/Elevation.svelte

40 lines
1.2 KiB
Svelte
Raw Normal View History

2024-07-19 13:18:38 +02:00
<script lang="ts">
import { Button } from '$lib/components/ui/button';
import Help from '$lib/components/Help.svelte';
2025-06-21 21:07:36 +02:00
import { MountainSnow } from '@lucide/svelte';
2025-10-17 23:54:45 +02:00
import { map } from '$lib/components/map/map';
2025-06-21 21:07:36 +02:00
import { i18n } from '$lib/i18n.svelte';
import { getURLForLanguage } from '$lib/utils';
2025-10-17 23:54:45 +02:00
import { selection } from '$lib/logic/selection';
import { fileActions } from '$lib/logic/file-actions';
2024-07-19 13:18:38 +02:00
2025-06-21 21:07:36 +02:00
let props: {
class?: string;
} = $props();
2025-10-18 16:10:08 +02:00
let validSelection = $derived($selection.size > 0);
2024-07-19 13:18:38 +02:00
</script>
2025-06-21 21:07:36 +02:00
<div class="flex flex-col gap-3 w-full max-w-80 {props.class ?? ''}">
<Button
variant="outline"
class="whitespace-normal h-fit"
disabled={!validSelection}
2025-10-24 20:07:15 +02:00
onclick={() => {
2025-10-18 16:10:08 +02:00
if ($map) {
fileActions.addElevationToSelection($map);
}
}}
>
<MountainSnow size="16" class="mr-1 shrink-0" />
2025-06-21 21:07:36 +02:00
{i18n._('toolbar.elevation.button')}
</Button>
2025-06-21 21:07:36 +02:00
<Help link={getURLForLanguage(i18n.lang, '/help/toolbar/elevation')}>
{#if validSelection}
2025-06-21 21:07:36 +02:00
{i18n._('toolbar.elevation.help')}
{:else}
2025-06-21 21:07:36 +02:00
{i18n._('toolbar.elevation.help_no_selection')}
{/if}
</Help>
2024-07-19 13:18:38 +02:00
</div>