From f94edf3e3a45b382adfec14fefad0f332e85e8c7 Mon Sep 17 00:00:00 2001 From: vcoppe Date: Fri, 20 Sep 2024 10:15:28 +0200 Subject: [PATCH] fix urls --- .../lib/components/toolbar/tools/Clean.svelte | 6 +- .../components/toolbar/tools/Elevation.svelte | 57 +- .../components/toolbar/tools/Extract.svelte | 5 +- .../lib/components/toolbar/tools/Merge.svelte | 155 ++-- .../components/toolbar/tools/Reduce.svelte | 318 ++++---- .../lib/components/toolbar/tools/Time.svelte | 734 +++++++++--------- .../components/toolbar/tools/Waypoint.svelte | 494 ++++++------ .../toolbar/tools/routing/Routing.svelte | 6 +- .../toolbar/tools/scissors/Scissors.svelte | 5 +- website/src/lib/docs/en/files-and-stats.mdx | 2 +- 10 files changed, 884 insertions(+), 898 deletions(-) diff --git a/website/src/lib/components/toolbar/tools/Clean.svelte b/website/src/lib/components/toolbar/tools/Clean.svelte index 5c4ed5f6..04da25c5 100644 --- a/website/src/lib/components/toolbar/tools/Clean.svelte +++ b/website/src/lib/components/toolbar/tools/Clean.svelte @@ -11,9 +11,9 @@ import * as RadioGroup from '$lib/components/ui/radio-group'; import { Button } from '$lib/components/ui/button'; import Help from '$lib/components/Help.svelte'; - import { _ } from 'svelte-i18n'; + import { _, locale } from 'svelte-i18n'; import { onDestroy, onMount } from 'svelte'; - import { resetCursor, setCrosshairCursor } from '$lib/utils'; + import { getURLForLanguage, resetCursor, setCrosshairCursor } from '$lib/utils'; import { Trash2 } from 'lucide-svelte'; import { map } from '$lib/stores'; import { selection } from '$lib/components/file-list/Selection'; @@ -178,7 +178,7 @@ {$_('toolbar.clean.button')} - + {#if validSelection} {$_('toolbar.clean.help')} {:else} diff --git a/website/src/lib/components/toolbar/tools/Elevation.svelte b/website/src/lib/components/toolbar/tools/Elevation.svelte index de365be7..2c920e79 100644 --- a/website/src/lib/components/toolbar/tools/Elevation.svelte +++ b/website/src/lib/components/toolbar/tools/Elevation.svelte @@ -1,34 +1,35 @@
- - - {#if validSelection} - {$_('toolbar.elevation.help')} - {:else} - {$_('toolbar.elevation.help_no_selection')} - {/if} - + + + {#if validSelection} + {$_('toolbar.elevation.help')} + {:else} + {$_('toolbar.elevation.help_no_selection')} + {/if} +
diff --git a/website/src/lib/components/toolbar/tools/Extract.svelte b/website/src/lib/components/toolbar/tools/Extract.svelte index ce341993..c101be0f 100644 --- a/website/src/lib/components/toolbar/tools/Extract.svelte +++ b/website/src/lib/components/toolbar/tools/Extract.svelte @@ -11,7 +11,8 @@ } from '$lib/components/file-list/FileList'; import Help from '$lib/components/Help.svelte'; import { dbUtils, getFile } from '$lib/db'; - import { _ } from 'svelte-i18n'; + import { _, locale } from 'svelte-i18n'; + import { getURLForLanguage } from '$lib/utils'; $: validSelection = $selection.size > 0 && @@ -42,7 +43,7 @@ {$_('toolbar.extract.button')} - + {#if validSelection} {$_('toolbar.extract.help')} {:else} diff --git a/website/src/lib/components/toolbar/tools/Merge.svelte b/website/src/lib/components/toolbar/tools/Merge.svelte index aae32a47..5c2a0a70 100644 --- a/website/src/lib/components/toolbar/tools/Merge.svelte +++ b/website/src/lib/components/toolbar/tools/Merge.svelte @@ -1,89 +1,90 @@
- - - - - - - {#if mergeType === MergeType.TRACES && canMergeTraces} - {$_('toolbar.merge.help_merge_traces')} - {:else if mergeType === MergeType.TRACES && !canMergeTraces} - {$_('toolbar.merge.help_cannot_merge_traces')} - {:else if mergeType === MergeType.CONTENTS && canMergeContents} - {$_('toolbar.merge.help_merge_contents')} - {:else if mergeType === MergeType.CONTENTS && !canMergeContents} - {$_('toolbar.merge.help_cannot_merge_contents')} - {/if} - + + + + + + + {#if mergeType === MergeType.TRACES && canMergeTraces} + {$_('toolbar.merge.help_merge_traces')} + {:else if mergeType === MergeType.TRACES && !canMergeTraces} + {$_('toolbar.merge.help_cannot_merge_traces')} + {:else if mergeType === MergeType.CONTENTS && canMergeContents} + {$_('toolbar.merge.help_merge_contents')} + {:else if mergeType === MergeType.CONTENTS && !canMergeContents} + {$_('toolbar.merge.help_cannot_merge_contents')} + {/if} +
diff --git a/website/src/lib/components/toolbar/tools/Reduce.svelte b/website/src/lib/components/toolbar/tools/Reduce.svelte index cb06f91d..ef4210a6 100644 --- a/website/src/lib/components/toolbar/tools/Reduce.svelte +++ b/website/src/lib/components/toolbar/tools/Reduce.svelte @@ -1,183 +1,175 @@
-
- -
- - - +
+ +
+ + + - - {#if validSelection} - {$_('toolbar.reduce.help')} - {:else} - {$_('toolbar.reduce.help_no_selection')} - {/if} - + + {#if validSelection} + {$_('toolbar.reduce.help')} + {:else} + {$_('toolbar.reduce.help_no_selection')} + {/if} +
diff --git a/website/src/lib/components/toolbar/tools/Time.svelte b/website/src/lib/components/toolbar/tools/Time.svelte index bfea92fe..31ef6ed2 100644 --- a/website/src/lib/components/toolbar/tools/Time.svelte +++ b/website/src/lib/components/toolbar/tools/Time.svelte @@ -1,403 +1,393 @@
-
-
-
- -
- {#if $velocityUnits === 'speed'} - - - {#if $distanceUnits === 'imperial'} - {$_('units.miles_per_hour')} - {:else if $distanceUnits === 'metric'} - {$_('units.kilometers_per_hour')} - {:else if $distanceUnits === 'nautical'} - {$_('units.knots')} - {/if} - - {:else} - - - {#if $distanceUnits === 'imperial'} - {$_('units.minutes_per_mile')} - {:else if $distanceUnits === 'metric'} - {$_('units.minutes_per_kilometer')} - {:else if $distanceUnits === 'nautical'} - {$_('units.minutes_per_nautical_mile')} - {/if} - - {/if} -
-
-
- - -
-
- -
- { - await tick(); - updateEnd(); - }} - /> - -
- -
- { - await tick(); - updateStart(); - }} - /> - -
- {#if $gpxStatistics.global.time.moving === 0 || $gpxStatistics.global.time.moving === undefined} -
- - -
- {/if} -
-
- - -
- - {#if canUpdate} - {$_('toolbar.time.help')} - {:else} - {$_('toolbar.time.help_invalid_selection')} - {/if} - + let item = $selection.getSelected()[0]; + let fileId = item.getFileId(); + dbUtils.applyToFile(fileId, (file) => { + if (item instanceof ListFileItem) { + if (artificial) { + file.createArtificialTimestamps(getDate(startDate, startTime), movingTime); + } else { + file.changeTimestamps(getDate(startDate, startTime), effectiveSpeed, ratio); + } + } else if (item instanceof ListTrackItem) { + if (artificial) { + file.createArtificialTimestamps( + getDate(startDate, startTime), + movingTime, + item.getTrackIndex() + ); + } else { + file.changeTimestamps( + getDate(startDate, startTime), + effectiveSpeed, + ratio, + item.getTrackIndex() + ); + } + } else if (item instanceof ListTrackSegmentItem) { + if (artificial) { + file.createArtificialTimestamps( + getDate(startDate, startTime), + movingTime, + item.getTrackIndex(), + item.getSegmentIndex() + ); + } else { + file.changeTimestamps( + getDate(startDate, startTime), + effectiveSpeed, + ratio, + item.getTrackIndex(), + item.getSegmentIndex() + ); + } + } + }); + }} + > + + {$_('toolbar.time.update')} + + +
+ + {#if canUpdate} + {$_('toolbar.time.help')} + {:else} + {$_('toolbar.time.help_invalid_selection')} + {/if} + diff --git a/website/src/lib/components/toolbar/tools/Waypoint.svelte b/website/src/lib/components/toolbar/tools/Waypoint.svelte index 5dd62609..f9629c95 100644 --- a/website/src/lib/components/toolbar/tools/Waypoint.svelte +++ b/website/src/lib/components/toolbar/tools/Waypoint.svelte @@ -1,272 +1,272 @@
-
- - - -