start localization

This commit is contained in:
vcoppe
2024-04-24 16:12:50 +02:00
parent 9bde53a4e2
commit 78b7612171
14 changed files with 1001 additions and 94 deletions

View File

@@ -1,6 +1,7 @@
<script lang="ts">
import * as Card from '$lib/components/ui/card';
import Tooltip from '$lib/components/Tooltip.svelte';
import WithUnits from '$lib/components/WithUnits.svelte';
import { GPXStatistics } from 'gpx';
@@ -17,17 +18,6 @@
}
});
}
function toHHMMSS(seconds: number) {
var hours = Math.floor(seconds / 3600);
var minutes = Math.floor(seconds / 60) % 60;
var seconds = Math.round(seconds % 60);
return [hours, minutes, seconds]
.map((v) => (v < 10 ? '0' + v : v))
.filter((v, i) => v !== '00' || i > 0)
.join(':');
}
</script>
<Card.Root class="h-full overflow-hidden border-none min-w-48 pl-4">
@@ -35,30 +25,32 @@
<Tooltip>
<span slot="data" class="flex flex-row items-center">
<Ruler size="18" class="mr-1" />
{gpxData.distance.total.toFixed(2)} km
<WithUnits value={gpxData.distance.total} type="distance" />
</span>
<span slot="tooltip">Distance</span>
</Tooltip>
<Tooltip>
<span slot="data" class="flex flex-row items-center">
<MoveUpRight size="18" class="mr-1" />
{gpxData.elevation.gain.toFixed(0)} m
<WithUnits value={gpxData.elevation.gain} type="elevation" />
<MoveDownRight size="18" class="mx-1" />
{gpxData.elevation.loss.toFixed(0)} m
<WithUnits value={gpxData.elevation.loss} type="elevation" />
</span>
<span slot="tooltip">Elevation</span>
</Tooltip>
<Tooltip>
<span slot="data" class="flex flex-row items-center">
<Zap size="18" class="mr-1" />
{gpxData.speed.moving.toFixed(2)} km/h
<WithUnits value={gpxData.speed.moving} type="speed" />
</span>
<span slot="tooltip">Speed</span>
</Tooltip>
<Tooltip>
<span slot="data" class="flex flex-row items-center">
<Timer size="18" class="mr-1" />
{toHHMMSS(gpxData.time.moving)} / {toHHMMSS(gpxData.time.total)}
<WithUnits value={gpxData.time.moving} type="time" />
<span class="mx-1">/</span>
<WithUnits value={gpxData.time.total} type="time" />
</span>
<span slot="tooltip">Moving time / Total time</span>
</Tooltip>