mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-23 05:21:15 +00:00
feat(client): show Dawarich stays, routes and marks where they belong
The trip planner and the journal get a "From Dawarich" list: the stays recorded for those dates, each one a row that can be dismissed or turned into a place or an entry after a review step that shows time, name, note and day. A place that came from a recording carries the Dawarich mark next to its name so its origin stays visible afterwards. The recorded route lies over the trip and journal maps as an overlay, coloured per day and cut along the reader's own timezone rather than UTC. It is fetched for the window on screen and never stored. The Atlas gets its own panel beside the map for the countries and cities the recordings prove, and the wish list is ticked off there, on the day of the visit, undoably. The phone has its own take on all of it, in the mobile shell's colours and with native sheets.
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
import { useMemo } from 'react'
|
||||
import { Polyline } from 'react-leaflet'
|
||||
import type { DawarichTrack } from '@trek/shared'
|
||||
import {
|
||||
DAWARICH_TRAIL_CASING,
|
||||
trailSegments,
|
||||
type DawarichTrailSegment,
|
||||
} from './dawarichTrail'
|
||||
|
||||
/**
|
||||
* The recorded route on the Leaflet renderer.
|
||||
*
|
||||
* Three lines per segment, the same construction the GPX tracks next door use:
|
||||
* a white casing so the line survives a satellite tile, the coloured line
|
||||
* itself, and nothing on top — this overlay is not clickable. That last part is
|
||||
* deliberate: a fat invisible hit-line would sit over the places and the
|
||||
* planned route, and swallow the clicks that select them, in exchange for a
|
||||
* popup nobody asked for.
|
||||
*
|
||||
* Dashed rather than solid. The planned route is already a solid line in the
|
||||
* user's accent, and the whole point of this layer is to be visibly the other
|
||||
* thing — what actually happened, next to what was planned. Telling them apart
|
||||
* has to survive being printed, screenshotted and looked at by someone who
|
||||
* cannot distinguish the two hues.
|
||||
*/
|
||||
export default function DawarichTrailLayer({
|
||||
track,
|
||||
selectedDate,
|
||||
casingPane,
|
||||
}: {
|
||||
track: DawarichTrack | null
|
||||
/** When set, only that local day is drawn. */
|
||||
selectedDate?: string | null
|
||||
/** The `trek-track-casing` pane, when the renderer supports panes. */
|
||||
casingPane?: string
|
||||
}) {
|
||||
const segments = useMemo(() => trailSegments(track, selectedDate), [track, selectedDate])
|
||||
if (segments.length === 0) return null
|
||||
|
||||
return (
|
||||
<>
|
||||
{segments.map((segment: DawarichTrailSegment) => (
|
||||
<Polyline
|
||||
key={`dawarich-casing-${segment.id}`}
|
||||
positions={segment.points}
|
||||
pane={casingPane}
|
||||
// theme-lint-disable — map paint
|
||||
pathOptions={{
|
||||
color: DAWARICH_TRAIL_CASING,
|
||||
weight: 6,
|
||||
opacity: 0.55,
|
||||
lineCap: 'round',
|
||||
lineJoin: 'round',
|
||||
}}
|
||||
interactive={false}
|
||||
/>
|
||||
))}
|
||||
{/* pathOptions rather than bare props: react-leaflet only calls setStyle
|
||||
when the pathOptions reference changes, so a bare `color` would stick
|
||||
at its mount-time value and a day recolour would never arrive. */}
|
||||
{segments.map((segment: DawarichTrailSegment) => (
|
||||
<Polyline
|
||||
key={`dawarich-line-${segment.id}`}
|
||||
positions={segment.points}
|
||||
pathOptions={{
|
||||
color: segment.color,
|
||||
weight: 3,
|
||||
opacity: 0.85,
|
||||
dashArray: '6 5',
|
||||
lineCap: 'round',
|
||||
lineJoin: 'round',
|
||||
}}
|
||||
interactive={false}
|
||||
/>
|
||||
))}
|
||||
</>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user