From 9bec97fc19edda4b6209d8d0fc961cd936943f23 Mon Sep 17 00:00:00 2001 From: Maurice <61554723+mauriceboe@users.noreply.github.com> Date: Sun, 31 May 2026 23:28:16 +0200 Subject: [PATCH] Fix a batch of reported bugs: Atlas regions, planner overlays, imports, Safari modals (#1094) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Start the Journey date picker week on Monday (#1078) The Journey entry date picker started the week on Sunday (firstDow = getDay(), headers Su-first) while every other picker (CustomDateTimePicker, VacayCalendar) starts on Monday. Align it: Monday-first leading offset ((getDay()+6)%7) and Mo-first weekday headers. * Fix Taiwan resolving to CN-TW in the Atlas country search (#1049) natural-earth gives Taiwan ISO_A2='CN-TW' (a subdivision-style value) with ADM0_A3='TWN'. The dynamic A2_TO_A3 augmentation added 'CN-TW'->'TWN', which then overwrote the legitimate TWN->TW entry in the reverse map, so Taiwan's country option resolved to 'CN-TW' — unresolvable by Intl.DisplayNames (no name, broken flag, not searchable). Only augment A2_TO_A3 with real 2-letter codes. * Drop empty leftover dateless days when a trip gets a shorter dated range (#1083) generateDays kept all unused dateless placeholder days after switching to an explicit (shorter) date range, so day_count (COUNT(*) FROM days) stayed inflated. Delete the empty leftovers (no assignments/notes/accommodations) like the dateless path already does, while preserving any that still hold content. Adds TRIP-SVC-017. * Render GPX and route overlays once the Mapbox style has loaded (#1036) The GPX and route geojson effects ran before the map 'load' event had attached their sources, so on the first paint they hit the early return and never re-ran. Add mapReady to their dependencies so they fire again the moment the sources exist. * Convert HEIC trip and journey covers to JPEG before upload (#1085) HEIC/HEIF covers coming straight off an iPhone could not be rendered in the preview or stored as a usable image. Route both cover pickers through normalizeImageFile, the same conversion the journal entry editor already uses, so the file becomes a JPEG before it leaves the browser. * Name GPX routes and tracks after their source file so multiple imports stick (#1054) Unnamed routes and tracks all fell back to the same generic 'GPX Route' / 'GPX Track' label, so the name-based import dedup dropped every one after the first - importing several files (or one file with several tracks) only kept a single place. Derive the default name from the source filename with an index suffix when a file holds more than one geometry, thread the filename down through the controller, and let the import modal take more than one file at a time. Adds PLACE-SVC-037/038. * Namespace the modal backdrop class so content blockers stop hiding it (#1027) Generic class names like .modal-backdrop sit on the cosmetic filter lists that content blockers (1Blocker, EasyList Annoyances) ship, and get hidden with display:none. The shared Modal - used by New Trip and Add Place - carried that class, so Safari users running such a blocker saw the modal silently fail to open with no error and no network request. Rename it to .trek-modal-backdrop. * Highlight GB regions by resolving England/Scotland/Wales/NI to finer admin-1 codes (#1067) A zoom-8 reverse geocode of a UK place only resolves to the constituent country (GB-ENG/SCT/WLS/NIR), but Natural Earth's admin-1 polygons for GB are counties and boroughs (GB-LND, GB-MAN, GB-CON, ...). Those four codes match no polygon, so places in England never highlighted in the Atlas while CH/IT/NL/etc. worked. When a GB lookup lands on a constituent country, re-resolve it at a finer zoom where Nominatim exposes the county/borough code the polygons actually carry. Other countries keep the exact zoom-8 behaviour. Adds ATLAS-UNIT-021. * Surface the real place-search error instead of a generic toast (#1092) When a place search or detail lookup fails, the backend already forwards the upstream reason - including descriptive Google Places API messages such as 'Places API (New) has not been used in project ... or it is disabled'. The planner discarded it and always showed 'Place search failed', so a key that is mis-enabled, unbilled, or pointed at the legacy API instead of Places API (New) looked like an unexplained silent failure. Show the server-provided message when present, and stop the Atlas bucket-list search from swallowing its error without a trace. * Await the async cover normalization in the TripFormModal paste test (#1085) handleCoverSelect now normalizes the pasted file before previewing it, so URL.createObjectURL is called a microtask later. The assertion moves into waitFor; a non-HEIC file still passes through unchanged. --- .../Journey/JourneyDetailPageDatePicker.tsx | 5 +- .../JourneyDetailPageSettingsDialog.tsx | 3 +- client/src/components/Map/MapViewGL.tsx | 4 +- .../components/Planner/FileImportModal.tsx | 164 +++++++++++------- .../Planner/PlaceFormModal.test.tsx | 9 +- .../src/components/Planner/PlaceFormModal.tsx | 5 +- client/src/components/Todo/TodoListPanel.tsx | 4 +- .../components/Trips/TripFormModal.test.tsx | 4 +- client/src/components/Trips/TripFormModal.tsx | 11 +- client/src/components/shared/Modal.test.tsx | 2 +- client/src/components/shared/Modal.tsx | 2 +- client/src/index.css | 6 +- client/src/pages/atlas/useAtlas.ts | 7 +- client/src/utils/apiError.ts | 9 + server/src/nest/places/places.controller.ts | 2 +- server/src/nest/places/places.service.ts | 6 +- server/src/services/atlasService.ts | 70 +++++--- server/src/services/placeService.ts | 22 ++- server/src/services/tripService.ts | 18 +- .../tests/unit/services/atlasService.test.ts | 29 ++++ .../tests/unit/services/placeService.test.ts | 33 ++++ .../tests/unit/services/tripService.test.ts | 27 +++ 22 files changed, 325 insertions(+), 117 deletions(-) create mode 100644 client/src/utils/apiError.ts diff --git a/client/src/components/Journey/JourneyDetailPageDatePicker.tsx b/client/src/components/Journey/JourneyDetailPageDatePicker.tsx index 8da27b91..4b35ef0b 100644 --- a/client/src/components/Journey/JourneyDetailPageDatePicker.tsx +++ b/client/src/components/Journey/JourneyDetailPageDatePicker.tsx @@ -15,7 +15,8 @@ export function DatePicker({ value, onChange, tripDates }: { }) const daysInMonth = new Date(viewMonth.year, viewMonth.month + 1, 0).getDate() - const firstDow = new Date(viewMonth.year, viewMonth.month, 1).getDay() + // Monday-first, matching CustomDateTimePicker / VacayCalendar (getDay() is Sunday=0). + const firstDow = (new Date(viewMonth.year, viewMonth.month, 1).getDay() + 6) % 7 const monthName = new Date(viewMonth.year, viewMonth.month).toLocaleDateString(undefined, { month: 'long', year: 'numeric' }) const prevMonth = () => { @@ -68,7 +69,7 @@ export function DatePicker({ value, onChange, tripDates }: { {/* Weekday headers */}
inner