feat(tours): compare a tour's plan with the track it was actually done with (ACT-02)

Each actual track in a tour's detail now stands beside the plan instead of
on its own: a table names the plan and the actual track as columns, each with
the line it is drawn as on the map, and sets distance, ascent, descent and the
time with breaks side by side. The difference is shown, signed and with an
arrow, only where both values are known and mean the same thing; a planned
total that leaves a stay out reads "at least" and is not subtracted from. A
value one side does not carry is named as missing ("Not in the plan", "Not in
the track", "No time stamps"), never estimated. Below the table, how far the
track left the planned line: its farthest point and the recorded stretches
more than 50 m away, or that there is no line to compare.

On the desktop plan map, "Compare on map" draws the actual track dotted in
the colour of done next to the plan, which stays picked in its own track
colour (and is put back should it be hidden on the map). The recording leaves
the map as a tour of its own meanwhile, so it is never drawn twice or in a
plan's colour. A frosted legend over the map names both lines and ends the
comparison; so do closing the detail, comparing another track, or the track
being unlinked. Comparing only reads: neither the plan nor the track changes.

The track is laid into the day's route lines the map already draws, so both
renderers show it without a layer of their own. distancesToLine in the shared
route corridor measures many points against one line laid flat once; a long
recording is measured in at most 1500 samples.
This commit is contained in:
Maurice
2026-10-20 13:06:17 +02:00
parent a8be1c5b45
commit 6a0c54cb2f
51 changed files with 1699 additions and 56 deletions
@@ -0,0 +1,26 @@
import { create } from 'zustand';
/**
* ACT-02: the actual track one tour is compared with on the plan map. Only
* ids: the planned line and the recorded one are both places of the trip, so
* the map reads them where they are kept and a changed recording or plan
* shows changed. Comparing is looking; it writes nothing.
*/
interface ActivityComparison {
/** The planned tour, whose detail is open. */
tourPlaceId: number;
/** The recording linked to it as its actual track. */
trackPlaceId: number;
}
interface TourActivityCompareState {
comparison: ActivityComparison | null;
show: (comparison: ActivityComparison | null) => void;
clear: () => void;
}
export const useTourActivityCompareStore = create<TourActivityCompareState>((set) => ({
comparison: null,
show: (comparison) => set({ comparison }),
clear: () => set({ comparison: null }),
}));