fixes distances and durations in info panel
This commit is contained in:
@@ -356,14 +356,14 @@ func generateTourGPX(detailedTour *DetailedKomootTour) (*filesystem.File, error)
|
|||||||
var points []*gpx.WptType
|
var points []*gpx.WptType
|
||||||
|
|
||||||
for _, item := range detailedTour.Embedded.Coordinates.Items {
|
for _, item := range detailedTour.Embedded.Coordinates.Items {
|
||||||
t := detailedTour.Date.Unix() + int64(item.T)
|
t := detailedTour.Date.Unix() + int64(item.T/1000)
|
||||||
|
|
||||||
points = append(points, &gpx.WptType{Lat: item.Lat, Lon: item.Lng, Ele: item.Alt, Time: time.Unix(t, 0)})
|
points = append(points, &gpx.WptType{Lat: item.Lat, Lon: item.Lng, Ele: item.Alt, Time: time.Unix(t, 0)})
|
||||||
}
|
}
|
||||||
|
|
||||||
gpx := &gpx.GPX{
|
gpx := &gpx.GPX{
|
||||||
Version: "1.1",
|
Version: "1.1",
|
||||||
Creator: "Strava GPX Exporter",
|
Creator: "komoot GPX Exporter",
|
||||||
Trk: []*gpx.TrkType{
|
Trk: []*gpx.TrkType{
|
||||||
{
|
{
|
||||||
Name: detailedTour.Name,
|
Name: detailedTour.Name,
|
||||||
|
|||||||
@@ -1,25 +1,29 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import MapWithElevationMaplibre from "$lib/components/trail/map_with_elevation_maplibre.svelte";
|
import MapWithElevationMaplibre from "$lib/components/trail/map_with_elevation_maplibre.svelte";
|
||||||
import TrailInfoPanel from "$lib/components/trail/trail_info_panel.svelte";
|
import TrailInfoPanel from "$lib/components/trail/trail_info_panel.svelte";
|
||||||
import { trail } from "$lib/stores/trail_store";
|
|
||||||
import * as M from "maplibre-gl";
|
import * as M from "maplibre-gl";
|
||||||
import "photoswipe/style.css";
|
import "photoswipe/style.css";
|
||||||
import { _ } from "svelte-i18n";
|
import { _ } from "svelte-i18n";
|
||||||
|
|
||||||
|
let { data } = $props();
|
||||||
|
|
||||||
|
const trail = $state(data.trail);
|
||||||
|
|
||||||
let markers: M.Marker[] = $state([]);
|
let markers: M.Marker[] = $state([]);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
<title>{$trail.name} | {$_("map")} | wanderer</title>
|
<title>{trail.name} | {$_("map")} | wanderer</title>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<main class="grid grid-cols-1 md:grid-cols-[458px_1fr] gap-x-1 gap-y-4">
|
<main class="grid grid-cols-1 md:grid-cols-[458px_1fr] gap-x-1 gap-y-4">
|
||||||
<div id="panel" class="hidden md:block">
|
<div id="panel" class="hidden md:block">
|
||||||
<TrailInfoPanel initTrail={$trail} {markers}></TrailInfoPanel>
|
<TrailInfoPanel initTrail={trail} {markers}></TrailInfoPanel>
|
||||||
</div>
|
</div>
|
||||||
<div id="trail-details">
|
<div id="trail-details">
|
||||||
<MapWithElevationMaplibre
|
<MapWithElevationMaplibre
|
||||||
trails={[$trail]}
|
trails={[trail]}
|
||||||
waypoints={$trail.expand?.waypoints}
|
waypoints={trail.expand?.waypoints}
|
||||||
activeTrail={0}
|
activeTrail={0}
|
||||||
bind:markers
|
bind:markers
|
||||||
showTerrain={true}
|
showTerrain={true}
|
||||||
@@ -28,11 +32,13 @@
|
|||||||
</main>
|
</main>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
#trail-details, #panel {
|
#trail-details,
|
||||||
|
#panel {
|
||||||
height: calc(100vh);
|
height: calc(100vh);
|
||||||
}
|
}
|
||||||
@media only screen and (min-width: 768px) {
|
@media only screen and (min-width: 768px) {
|
||||||
#trail-details, #panel {
|
#trail-details,
|
||||||
|
#panel {
|
||||||
height: calc(100vh - 124px);
|
height: calc(100vh - 124px);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,13 +4,14 @@ import { error, type NumericRange, type ServerLoad } from "@sveltejs/kit";
|
|||||||
|
|
||||||
export const load: ServerLoad = async ({ params, locals, fetch }) => {
|
export const load: ServerLoad = async ({ params, locals, fetch }) => {
|
||||||
try {
|
try {
|
||||||
await trails_show(params.id!, true, fetch)
|
const trail = await trails_show(params.id!, true, fetch)
|
||||||
|
return { trail };
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof APIError) {
|
if (e instanceof APIError) {
|
||||||
error(e.status as NumericRange<400, 599>, {
|
error(e.status as NumericRange<400, 599>, {
|
||||||
message: e.status == 404 ? 'Not found' : e.message
|
message: e.status == 404 ? 'Not found' : e.message
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
throw e
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user