adds filename fallback for trail upload

This commit is contained in:
Christian Beutel
2024-10-06 11:35:40 +02:00
parent efb411e5ff
commit d94758a886
6 changed files with 28 additions and 19 deletions

View File

@@ -2,7 +2,11 @@
import { page } from "$app/stores";
import { Settings } from "$lib/models/settings";
import type { Trail } from "$lib/models/trail";
import { createMarkerFromWaypoint, endIcon, startIcon } from "$lib/util/leaflet_util";
import {
createMarkerFromWaypoint,
endIcon,
startIcon,
} from "$lib/util/leaflet_util";
import "$lib/vendor/leaflet-elevation/src/index.css";
import type AutoGraticule from "$lib/vendor/leaflet-graticule/leaflet-auto-graticule";
import type { Map, Marker } from "leaflet";
@@ -27,7 +31,7 @@
let selectedMetric: "altitude" | "slope" | "speed" | false = "altitude";
$: gpxData = trail?.expand.gpx_data;
$: if (gpxData && controlElevation) {
$: if (gpxData && controlElevation) {
controlElevation.updateOptions({
autofitBounds: options.autofitBounds ?? true,
});
@@ -103,7 +107,9 @@
const baseMaps: Record<string, L.TileLayer> = {
OpenStreetMaps: baseLayer,
OpenTopoMaps: topoLayer,
...($page.data.settings as Settings)?.tilesets?.reduce< Record<string, string>>((t, current) => {
...($page.data.settings as Settings)?.tilesets?.reduce<
Record<string, string>
>((t, current) => {
t[current.name] = L.tileLayer(current.url);
return t;
}, {}),
@@ -139,7 +145,7 @@
closeBtn: false,
followMarker: true,
autofitBounds: true,
imperial: $page.data.settings.unit == "imperial",
imperial: ($page.data.settings?.unit ?? "metric") == "imperial",
reverseCoords: false,
acceleration: false,
slope: true,
@@ -174,7 +180,7 @@
trkStart: {
interactive: false,
className: "hihi",
icon: startIcon()
icon: startIcon(),
},
trkEnd: {
icon: endIcon(),
@@ -241,4 +247,4 @@
<slot />
<div class="basis-[300px] flex-grow flex-shrink-0" id="elevation"></div>
</div>
</div>
</div>

View File

@@ -129,7 +129,7 @@
const baseMaps: Record<string, L.TileLayer> = {
OpenStreetMaps: baseLayer,
OpenTopoMaps: topoLayer,
...($page.data.settings as Settings)?.tilesets?.reduce<
...($page.data?.settings as Settings)?.tilesets?.reduce<
Record<string, string>
>((t, current) => {
t[current.name] = L.tileLayer(current.url);