mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-06 02:34:21 +00:00
Add the track colour picker to the place inspector
New shared component rather than a ninth copy of the swatch grid that is already inline in eight places. Selection is drawn with var(--accent) so it follows whatever accent the user runs. The custom-colour cell listens for the native change event instead of React's onChange: for a colour input React maps onChange to input, which fires on every drag inside the OS picker — dozens of writes, each one a 409 candidate against the base-version header. The auto cell previews the colour you would get back, not the one currently set, which is a different value as soon as anything is picked. The row sits next to the track stats block, not inside it: that block returns null on unparsable geometry and the colour control has no business disappearing with it. The elevation chart and the distance pin follow the track colour too, otherwise the panel and the map read as two unrelated objects. In the places list the track icon becomes a stroke in the colour the line is drawn in. The map has no legend of its own, so that stroke is the only thing tying a line back to a row. Undo after deleting a track now restores its geometry and colour instead of bringing back a bare point.
This commit is contained in:
@@ -565,6 +565,9 @@ export function useTripPlanner() {
|
||||
address: capturedPlace.address,
|
||||
category_id: capturedPlace.category_id,
|
||||
price: capturedPlace.price,
|
||||
// An undone track has to come back as a track, not a bare point.
|
||||
route_geometry: capturedPlace.route_geometry,
|
||||
route_color: capturedPlace.route_color,
|
||||
})
|
||||
for (const { dayId, orderIndex } of capturedAssignments) {
|
||||
await tripActions.assignPlaceToDay(tripId, dayId, newPlace.id, orderIndex)
|
||||
@@ -595,6 +598,7 @@ export function useTripPlanner() {
|
||||
name: place.name, description: place.description,
|
||||
lat: place.lat, lng: place.lng, address: place.address,
|
||||
category_id: place.category_id, price: place.price,
|
||||
route_geometry: place.route_geometry, route_color: place.route_color,
|
||||
})
|
||||
for (const a of capturedAssignments.filter(x => x.placeId === place.id)) {
|
||||
await tripActions.assignPlaceToDay(tripId, a.dayId, newPlace.id, a.orderIndex)
|
||||
|
||||
Reference in New Issue
Block a user