2024-04-19 16:13:08 +02:00
|
|
|
<script lang="ts">
|
|
|
|
import * as Card from '$lib/components/ui/card';
|
2024-04-21 16:40:28 +02:00
|
|
|
import Tooltip from '$lib/components/Tooltip.svelte';
|
2024-04-24 16:12:50 +02:00
|
|
|
import WithUnits from '$lib/components/WithUnits.svelte';
|
2024-04-19 16:13:08 +02:00
|
|
|
|
|
|
|
import { GPXStatistics } from 'gpx';
|
|
|
|
|
2024-04-24 20:13:42 +02:00
|
|
|
import { selectedFiles, settings } from '$lib/stores';
|
|
|
|
import { get } from 'svelte/store';
|
|
|
|
|
2024-04-19 16:13:08 +02:00
|
|
|
import { MoveDownRight, MoveUpRight, Ruler, Timer, Zap } from 'lucide-svelte';
|
|
|
|
|
2024-04-24 18:02:35 +02:00
|
|
|
import { _ } from 'svelte-i18n';
|
|
|
|
|
2024-04-19 16:13:08 +02:00
|
|
|
let gpxData: GPXStatistics = new GPXStatistics();
|
|
|
|
|
|
|
|
$: {
|
|
|
|
gpxData = new GPXStatistics();
|
2024-04-24 20:13:42 +02:00
|
|
|
$selectedFiles.forEach((file) => {
|
|
|
|
gpxData.mergeWith(get(file).statistics);
|
2024-04-19 16:13:08 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2024-04-24 11:24:26 +02:00
|
|
|
<Card.Root class="h-full overflow-hidden border-none min-w-48 pl-4">
|
|
|
|
<Card.Content class="h-full flex flex-col flex-wrap gap-4 justify-center p-0">
|
2024-04-21 16:40:28 +02:00
|
|
|
<Tooltip>
|
2024-04-19 16:13:08 +02:00
|
|
|
<span slot="data" class="flex flex-row items-center">
|
|
|
|
<Ruler size="18" class="mr-1" />
|
2024-04-24 16:12:50 +02:00
|
|
|
<WithUnits value={gpxData.distance.total} type="distance" />
|
2024-04-19 16:13:08 +02:00
|
|
|
</span>
|
2024-04-24 18:02:35 +02:00
|
|
|
<span slot="tooltip">{$_('quantities.distance')}</span>
|
2024-04-21 16:40:28 +02:00
|
|
|
</Tooltip>
|
|
|
|
<Tooltip>
|
2024-04-19 16:13:08 +02:00
|
|
|
<span slot="data" class="flex flex-row items-center">
|
|
|
|
<MoveUpRight size="18" class="mr-1" />
|
2024-04-24 16:12:50 +02:00
|
|
|
<WithUnits value={gpxData.elevation.gain} type="elevation" />
|
2024-04-19 16:13:08 +02:00
|
|
|
<MoveDownRight size="18" class="mx-1" />
|
2024-04-24 16:12:50 +02:00
|
|
|
<WithUnits value={gpxData.elevation.loss} type="elevation" />
|
2024-04-19 16:13:08 +02:00
|
|
|
</span>
|
2024-04-24 18:02:35 +02:00
|
|
|
<span slot="tooltip">{$_('quantities.elevation')}</span>
|
2024-04-21 16:40:28 +02:00
|
|
|
</Tooltip>
|
|
|
|
<Tooltip>
|
2024-04-19 16:13:08 +02:00
|
|
|
<span slot="data" class="flex flex-row items-center">
|
|
|
|
<Zap size="18" class="mr-1" />
|
2024-04-24 18:02:35 +02:00
|
|
|
<WithUnits value={gpxData.speed.moving} type="speed" showUnits={false} /> /
|
|
|
|
<WithUnits value={gpxData.speed.total} type="speed" />
|
2024-04-19 16:13:08 +02:00
|
|
|
</span>
|
2024-04-24 18:02:35 +02:00
|
|
|
<span slot="tooltip"
|
|
|
|
>{$settings.velocityUnits === 'speed' ? $_('quantities.speed') : $_('quantities.pace')} ({$_(
|
|
|
|
'quantities.moving'
|
|
|
|
)} / {$_('quantities.total')})</span
|
|
|
|
>
|
2024-04-21 16:40:28 +02:00
|
|
|
</Tooltip>
|
|
|
|
<Tooltip>
|
2024-04-19 16:13:08 +02:00
|
|
|
<span slot="data" class="flex flex-row items-center">
|
|
|
|
<Timer size="18" class="mr-1" />
|
2024-04-24 16:12:50 +02:00
|
|
|
<WithUnits value={gpxData.time.moving} type="time" />
|
|
|
|
<span class="mx-1">/</span>
|
|
|
|
<WithUnits value={gpxData.time.total} type="time" />
|
2024-04-19 16:13:08 +02:00
|
|
|
</span>
|
2024-04-24 18:02:35 +02:00
|
|
|
<span slot="tooltip"
|
|
|
|
>{$_('quantities.time')} ({$_('quantities.moving')} / {$_('quantities.total')})</span
|
|
|
|
>
|
2024-04-21 16:40:28 +02:00
|
|
|
</Tooltip>
|
2024-04-19 16:13:08 +02:00
|
|
|
</Card.Content>
|
|
|
|
</Card.Root>
|