Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

Tours: resolve the distance unit once where tour facts are built

Mauricef690065de897
diff --git a/client/scripts/strict-baseline.json b/client/scripts/strict-baseline.json
index 0d713ffbc..31b55fa95 100644
--- a/client/scripts/strict-baseline.json
+++ b/client/scripts/strict-baseline.json
@@ -89,7 +89,6 @@
"src/components/Todo/todoListModel.ts": 1,
"src/components/Tours/planner/TourPlannerPanels.tsx": 2,
"src/components/Tours/planner/useTourPlanner.ts": 2,
- "src/components/Tours/tourParts.tsx": 5,
"src/components/Trips/TripFormModal.tsx": 3,
"src/components/Trips/TripMembersModal.tsx": 1,
"src/components/Vacay/VacayCalendar.tsx": 1,
diff --git a/client/src/components/Tours/tourFacts.ts b/client/src/components/Tours/tourFacts.ts
index a97574437..71725b2b7 100644
--- a/client/src/components/Tours/tourFacts.ts
+++ b/client/src/components/Tours/tourFacts.ts
@@ -6,10 +6,12 @@ import type { TourMetricField } from './tourParts';
/** A line's measures as label and value: distance, the extras, lowest and highest point, ascent, descent. */
export function tourMetricFacts(
analysis: Pick<RouteGeometryAnalysis, 'distanceKm' | 'minEle' | 'maxEle' | 'gain' | 'loss'> | null,
- unit: DistanceUnit | undefined,
+ unitSetting: DistanceUnit | undefined,
t: (key: string, params?: Record<string, unknown>) => string,
extra: readonly TourMetricField[] = []
): TourMetricField[] {
+ // The setting is unset until the user picks one; metric is what the app shows then.
+ const unit = unitSetting ?? 'metric';
const fields: TourMetricField[] = [
{ label: t('tours.detail.distance'), value: analysis ? formatDistance(analysis.distanceKm, unit) : '-' },
...extra,