feat(hunt): track walking distance via GPS, show live locations on map
Docker Image CI / test (push) Failing after 41s
Docker Image CI / deploy (push) Skipped
Tests / unit (push) Failing after 36s
Tests / integration (push) Successful in 1m34s

Add foreground-only GPS distance tracking for hunts
This commit is contained in:
2026-09-27 20:55:58 +02:00
parent a0fc836c05
commit 61cc516f47
43 changed files with 2313 additions and 24 deletions
+31
View File
@@ -0,0 +1,31 @@
/**
* Locale-aware walking-distance formatting.
*
* Distances are stored as Int meters. Under 1000 m they render as whole
* meters, above that as kilometers with one decimal (e.g. "1.2 km"). Reused by
* the tracking card, the team leaderboards and the profile distances.
*/
export function useFormatDistance() {
const { locale } = useI18n();
function formatDistance(meters: number | null | undefined): string {
const value = meters ?? 0;
const loc = locale.value || 'en';
if (value < 1000) {
return new Intl.NumberFormat(loc, {
style: 'unit',
unit: 'meter',
maximumFractionDigits: 0
}).format(Math.round(value));
}
return new Intl.NumberFormat(loc, {
style: 'unit',
unit: 'kilometer',
maximumFractionDigits: 1
}).format(value / 1000);
}
return { formatDistance };
}