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
|
||||
|
||||
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)})
|
||||
}
|
||||
|
||||
gpx := &gpx.GPX{
|
||||
Version: "1.1",
|
||||
Creator: "Strava GPX Exporter",
|
||||
Creator: "komoot GPX Exporter",
|
||||
Trk: []*gpx.TrkType{
|
||||
{
|
||||
Name: detailedTour.Name,
|
||||
|
||||
@@ -1,25 +1,29 @@
|
||||
<script lang="ts">
|
||||
import MapWithElevationMaplibre from "$lib/components/trail/map_with_elevation_maplibre.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 "photoswipe/style.css";
|
||||
import { _ } from "svelte-i18n";
|
||||
|
||||
let { data } = $props();
|
||||
|
||||
const trail = $state(data.trail);
|
||||
|
||||
let markers: M.Marker[] = $state([]);
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>{$trail.name} | {$_("map")} | wanderer</title>
|
||||
<title>{trail.name} | {$_("map")} | wanderer</title>
|
||||
</svelte:head>
|
||||
|
||||
<main class="grid grid-cols-1 md:grid-cols-[458px_1fr] gap-x-1 gap-y-4">
|
||||
<div id="panel" class="hidden md:block">
|
||||
<TrailInfoPanel initTrail={$trail} {markers}></TrailInfoPanel>
|
||||
<TrailInfoPanel initTrail={trail} {markers}></TrailInfoPanel>
|
||||
</div>
|
||||
<div id="trail-details">
|
||||
<MapWithElevationMaplibre
|
||||
trails={[$trail]}
|
||||
waypoints={$trail.expand?.waypoints}
|
||||
trails={[trail]}
|
||||
waypoints={trail.expand?.waypoints}
|
||||
activeTrail={0}
|
||||
bind:markers
|
||||
showTerrain={true}
|
||||
@@ -28,11 +32,13 @@
|
||||
</main>
|
||||
|
||||
<style>
|
||||
#trail-details, #panel {
|
||||
#trail-details,
|
||||
#panel {
|
||||
height: calc(100vh);
|
||||
}
|
||||
@media only screen and (min-width: 768px) {
|
||||
#trail-details, #panel {
|
||||
#trail-details,
|
||||
#panel {
|
||||
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 }) => {
|
||||
try {
|
||||
await trails_show(params.id!, true, fetch)
|
||||
const trail = await trails_show(params.id!, true, fetch)
|
||||
return { trail };
|
||||
} catch (e) {
|
||||
if (e instanceof APIError) {
|
||||
error(e.status as NumericRange<400, 599>, {
|
||||
message: e.status == 404 ? 'Not found' : e.message
|
||||
});
|
||||
}
|
||||
|
||||
throw e
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user