Commit Graph

5947 Commits

Author SHA1 Message Date
Maurice 33f6540ec3 feat(settings): keep the account's settings for a start without a connection
/api/settings is never cached, so an app started offline ran on
DEFAULT_SETTINGS until the server answered: Leaflet instead of the map
the user chose, and the default units. The answer the server gave last
time now stands in until the next one arrives.

- Dexie v18 adds accountSettings, one row in the signed-in user's own
  database, so another account on the device never reads it and logout
  deletes it with the database. The anonymous database never holds one.
  A new table only; the upgrade test covers it.
- loadSettings lays the kept answer over the defaults while nothing newer
  arrived and keeps every server answer. A key the server then leaves out
  goes back to its default, so the server stays the source of truth.
- A setting the server accepted is laid over the kept answer, so a change
  made online is what the next offline start shows. A refused save keeps
  nothing.

Keeping is best effort: where IndexedDB is refused the app starts on the
defaults as before.
2026-11-30 16:22:51 +01:00
Maurice 9cbbbdb2e9 refactor(maps): one hook decides which engine draws a map
MapViewAuto chose the renderer and the offline fallback inline, so the
journey map, which needs the same choice, could only copy it.
useEffectiveMapEngine now holds it: the user's provider where it can run
(Mapbox needs a token, both GL engines WebGL2), Leaflet where it cannot,
and offline the stored basemap with its pill, checked on the engine that
actually draws. It returns what to draw and never writes a setting.

The logic is the one MapViewAuto ran, moved and not changed, and the hook
is tested on the same cases as the trip map's offline suite. The header
comment no longer claims the Atlas uses Leaflet.
2026-11-30 16:22:51 +01:00
Maurice 6dafbc6d05 refactor(maps): build every GL map from one set of options
The trip map, the journey map and the settings preview each assembled
their own constructor options and their own 3D setup on load, and the
copies had drifted: the preview laid terrain under every style outside
the Standard family, while the trip map only under the satellite and
outdoor styles, so the preview showed a map the trip never drew.

glMapOptions builds the options for all three and applyGl3d sets up
terrain, buildings and the flattened Standard DEM. For Mapbox the options
are exactly the ones each map built before, key for key and in the same
order, which a test pins; the preview now follows the trip map's terrain
rule. The next steps tune MapLibre in this one place.

MapViewGL.tsx shrinks, and its size baseline follows.
2026-11-30 16:22:51 +01:00
Maurice 0a72ed5e76 feat(maps): describe the basemap once for every renderer
The Leaflet map read the resolved template and sniffed it again for the
datum and the credit, and a GL raster source would need the same template
with its placeholders decided. resolveBasemapSpec wraps resolveBasemap and
adds what a renderer needs: the template Leaflet takes as before, the tile
URLs a GL source takes ({s} as Leaflet's a/b/c shards, {r} as @2x on any
screen denser than one, {-y} as a TMS scheme), the tile size, the
provider's deepest zoom, the credit, the datum and the host.

The Leaflet map draws from the spec now, with the same template, credit
and datum as before, so nothing on screen changes. The tests cover every
template a user can have saved today.
2026-11-30 16:22:51 +01:00
Maurice d8a93af2f5 feat(maps): one shared list of the shipped tile hosts for the CSP and the client
A GL map fetches its style and its tiles, so it can only draw from a host
the server's connect-src names. The raster presets and OpenFreeMap were
written out in the middleware while the client kept its own idea of them,
and nothing held the two together.

The hosts, their reasons and the default OpenFreeMap style now live in
shared/src/maps/map-defaults.ts. The middleware builds those sources from
the list, and the client takes the default style from it, so the renderer
choice the next steps add reads the same hosts the policy allows.

The policy an install sends stays byte for byte the same: a test pins the
whole connect-src in its order.
2026-11-30 16:22:50 +01:00
Maurice b27b3f6563 docs(maps): classify MAP_EXTRA_CONNECT_HOSTS and separate its wiki section
The app-config README lists every variable as boot-stable or runtime-toggled;
the new one was missing. The CSP takes it when the app is built, so it is
boot-stable. The wiki section also lacked the rule that separates it from
Storage & Paths like every other section.
2026-11-30 16:22:50 +01:00
Maurice fdfc034a68 fix(settings): a managed install keeps a map provider somebody chose
With the operator's Mapbox token a managed install replaced every empty or
Leaflet provider with Mapbox, including a Leaflet the user picked and a
Leaflet default the admin set. A plain "only when empty" would switch
everyone whose Leaflet row only exists because the settings form writes
every field (#1634), so the choice is recorded instead, by the server alone:

- map_provider_chosen on the user's settings, set when a write changes the
  provider the user is shown (so saving the form unchanged is no choice,
  and leaving the Mapbox a managed install shows is one). A client patch
  naming the key is dropped on both routes, false included, so no client
  can set or clear it.
- map_provider_default_chosen in app_settings, set when the admin saves a
  map_provider default and removed when it is reset.

Mapbox now replaces an empty provider, or a Leaflet without the mark of
where it came from. No stored row is rewritten: rows without a mark read
exactly as before. The client Settings type gains the read-only field.
2026-11-30 16:22:50 +01:00
Maurice 51dc0e6a82 feat(maps): MAP_EXTRA_CONNECT_HOSTS adds the operator's map hosts to the CSP
A GL map fetches its tiles and its style, so a template on a host of the
operator's own (a self-hosted tile server) was refused by connect-src while
Leaflet drew it as images. The new variable lists such hosts; each entry
becomes an https source in connect-src and the same list reaches the client
as map_extra_connect_hosts in the app config, so the renderer choice and the
policy can never disagree.

The variable is owned by readEnv() like the rest of the maps namespace and
read once when the middleware is applied. The boot refuses an entry outside
the shared grammar; a path that skips the boot check drops it, so a bad
value never widens the policy. Unset, the CSP and the app config are as
before apart from an empty list.

Documented in .env.example, docker-compose.yml, the Helm values and
ConfigMap and the wiki. Making room for the app config field shrinks
auth.service.ts by one line, and its size baseline follows.
2026-11-30 16:22:50 +01:00
Maurice 6c68f6ebec feat(shared): host grammar for the operator's own map hosts
MAP_EXTRA_CONNECT_HOSTS lets an operator name tile and style hosts beyond
the ones TREK ships. The server adds them to the CSP connect-src and the
client will only ask a GL renderer to draw what that list names, so both
sides read entries through one grammar: a lower-case host name with at
least two labels, an optional port and an optional leading wildcard over
two or more labels. No scheme, path or user, so an entry can never widen
the policy past a single host family.

The parser returns the accepted hosts and the refused entries, for the
boot check, and the app config field gets a Zod contract.
2026-11-30 16:22:50 +01:00
Maurice dbf808362d ci(sonar): analyse the server tests in the server's own TypeScript program
The scan ran out of memory since the places work: the analyser keeps every
file it parsed until the end, finds only files named tsconfig.json, and
server/tsconfig.json leaves out tests/, so the server tests landed in a
catch-all program that parsed server/src and shared/src a second time,
about 9,400 files and some 2 GB. Naming the tsconfigs, with the server's
tsconfig.tests.json in place of tsconfig.json, keeps them in the program
that already parsed those files. No file leaves the analysis.
2026-11-30 14:04:47 +01:00
Maurice dc645b1205 fix(places): All saved acts on every copy of the place a row stands for
All saved shows a place kept in several lists once, but deleting that row
removed only the copy shown, so the next copy took its place, and the
status filter and counts read only that copy. The filters now look at
every copy before the places are shown once, the counts count a place
under each status its copies hold, and deleting or setting the status of
the row reaches every copy.
2026-11-30 13:28:01 +01:00
Maurice 73e3ac2606 fix(places): the closed-day tests parse, and the inspector keeps its size
A test title held an unescaped apostrophe, so the file did not parse. The
inspector maps a provider's week through one helper again, which keeps it
at its size baseline, and the counts type of the rail stays inside its file.
2026-11-30 13:28:00 +01:00
Maurice f15b9e73a0 fix(dashboard): the more-countries chip on the passport card is solid
The +N chip after the visited countries' flags sat on the last flag with a
see-through white, so that flag showed through it. It is now the same tone,
solid.
2026-11-30 13:21:03 +01:00
Maurice 7f2c6638a8 fix(places): a closed day from OSM reads closed, not off
OSM tags a closed day as off ("Mo off"), which the tag parser hands on
as "Monday: off", and the place view showed that word as the day's hours
and as today's line. A day the provider wrote as off or closed now reads
in the reader's own word for closed, in the place view and in the details
column of the place dialog.
2026-11-30 13:18:00 +01:00
Maurice 07d54d6f6e fix(maps): a place's marker photo is its community picture where it has one
An OSM or index place with a reviewed TREK Community picture showed it in
its gallery but only a category pin in the lists and on the map: the
marker photo asked Google and Wikimedia, never the community's pictures.
It now asks them first, the order the gallery shows them in, and only
while the TREK Places API is on.
2026-11-30 13:14:23 +01:00
Maurice 51c45d0573 feat(places): the picker shows how many places All places holds from the start
The count beside All places in the place dialog's picker appeared only
once All places was chosen and read. It is now read with the picker,
with one entry, the way the rail reads it.
2026-11-30 13:10:34 +01:00
Maurice 91bf941e4c fix(places): the picker's All lists and All places count places alike
All lists in the place dialog's picker now shows a place kept in several
lists once, as All saved does, and All places keeps the places of the
trip being planned, so it always holds at least what All lists holds and
its count matches the rail.
2026-11-30 13:09:02 +01:00
Maurice 2204e851fa feat(places): All saved shows each place once, All places shows its count
A place saved into several lists from the same trip place showed once per
list in All saved and counted that often, while All places groups the
copies as one place. All saved now shows such a place once, the first
copy read standing for it, and the rail counts All saved and All places
the way All places groups them, on the desktop and the phone.
2026-11-30 13:09:01 +01:00
Maurice b36b83a32e test(places): the saved place forms send no tags or notes
The desktop dialog and the phone sheet tests still expected label_ids and
notes in the edit form's patch, which the form no longer sends: the tags
card and the notes tab write those.
2026-11-30 13:09:01 +01:00
Maurice 101c4b5d7a feat(places): All places in the saved-place picker of the place dialog
The picker beside the add place form only offered the places of the
lists. Its list filter now also offers All places: the places of the
other trips beside the lists', each place once, read when chosen, with
the same search, status filter and distance order. The trip being
planned stays out, it has those places already. A pick fills the form
with the place's name, address, position and category.
2026-11-30 13:01:20 +01:00
Maurice e90380e2b4 fix(places): votes copied with a place keep when they were last changed
Saving a trip place into a list and copying a saved place into a trip
carried the votes with no change time, so each copy read as cast now and
could outrank a newer vote on another copy of the same place, moving the
entry's own vote, average, filter and sort. Both copies now carry the
source vote's time, as the vote carry-over already does.
2026-11-30 12:55:07 +01:00
Maurice 09ae971cc8 fix(places): an edit left open does not follow onto the next place
In All places the edit state outlived the place it was opened on, so on
the phone a draft started on one place and left open was saved onto the
next place the sheet showed. The form now closes when another place
opens.
2026-11-30 12:55:06 +01:00
Maurice 1435076cec fix(places): a saved place's edit form no longer undoes its tags and notes
The tags card and the notes tab write a list copy's labels and notes
directly, but the edit form still sent the label_ids and notes it was
seeded with when the place opened, so saving a name change laid the old
tags and note back over them. The form now sends only the fields it shows.
2026-11-30 12:55:06 +01:00
Maurice 501e4449ef refactor(places): one label for a rating badge
The list rows and the map pins wrote the average with their own copy of
the whole star or one decimal rule; both now read ratingBadge.
2026-11-30 12:34:50 +01:00
Maurice 7008427022 refactor(places): drop the unused note chooser from the origin notes
The composer opens the first writable trip or list and its chips switch it,
so the old "+ Note" toggle and its chooser state are read by no view.
2026-11-30 12:34:47 +01:00
Maurice 1997a49e3d chore(places): export only what other files use
The media targets, the rating label, the rating score constants, the rating
match and the copy editor types are read inside their own files only, which
lint:knip holds.
2026-11-30 00:33:35 +00:00
Maurice 8057688da3 fix(places): say why registering the join listeners writes nothing itself
onModuleInit only hands the list and trip joins their listener; each join
then carries the joiner's votes in a transaction of its own, which
lint:tx reads from the @txIndependent note.
2026-11-30 00:24:37 +00:00
Maurice 29ae0de1ef fix(places): the third CI run, no awaits in loops and an edit target that may be none
The rating order test pages through its cursor with a recursion and checks
the refused floors at once instead of awaiting in a loop, and the edit hook
types its first editable copy as possibly none, which the strict check reads
from a conditional rather than a narrowed assignment.
2026-11-30 00:16:23 +00:00
Maurice 1c9ac0b159 fix(places): the second CI run, split the library reads and test the rating order
The reads of what an entry of All places keeps beside its facts (tags,
notes, votes, planned days, bookings, list roles) move from
PlacesLibraryRepository into PlacesLibraryDetailsRepository, so neither
file passes the size limit. New end to end tests cover the rating filter,
the tab counts under it, the rating order and its cursor, and
list_all_places with both. The test types follow the vote shapes, the edit
target says it may be null, the bookings pair names the booking card that
now holds the booking model, and the size baselines drop to the measured
lengths.
2026-11-30 00:06:47 +00:00
Maurice 7104fa6dd4 fix(places): the first CI run on the place view and the copies in step
Imports the picture icon the media sections draw for "use as the place
picture", narrows the types the type check refused, moves the dropdown
open state and the media lightbox into one module each for both views,
replaces an await in a loop, and lowers the ratchet baselines to the counts
the run measured. The tests follow the place view: the vote route of a trip
place lives with the votes now, the history holds an entry per copy that
followed an edit, the rate_library_place tool has its broadcast case, and
the row tags of a list are dots behind the name.
2026-11-29 23:53:36 +00:00
Maurice 71392ec9c1 docs(mcp): copies in step, the rating filter and the voters of an entry
The place and saved place update tools say that the general facts follow
onto the other copies, list_all_places names min_rating, the rating sort
and the voters, and the tool count is current.
2026-11-29 23:36:43 +00:00
Maurice d6708f6ff2 feat(i18n): translate the new Places strings and drop the unused ones
The media, notes and tag strings of the place view and the rating sort in
every language; the strings nothing reads any more leave every locale.
2026-11-29 23:36:43 +00:00
Maurice 20e3d2d9ae test(places): cover the place view, the rating row and the rating filter
Tests for the vote by entry key in the api and the repository, the rating
row and its voters, the rating filter and sort on both views, the edit form
without a choice of copy, and the place view's sections, aligned with the
renamed tag strings.
2026-11-29 23:36:43 +00:00
Maurice d758f4c592 feat(places): one place view for All places and the lists
The desktop dialog and the phone sheet of a place show its overview, notes,
tours and bookings, photos and files and its history in tabs, with the tags
of each list and trip, a markdown notes editor, uploads and the place
picture. The rating bar of All places is the rating row the lists show,
with its voters, and votes once for every copy. All places filters by a
lowest rating and sorts by it, and the edit form changes the first copy the
reader may edit, which the server carries to the others.
2026-11-29 23:36:43 +00:00
Maurice 783c98f41e feat(places): one vote per person across copies, copies stay in step
A vote belongs to its person: cast or taken back on one copy of a place, it
lands on every copy of that place in the lists and trips the person may vote
on, in one transaction. A pass on the first start carries the existing votes
over, and whoever joins a list or a trip brings their latest vote onto its
copies of the places they voted on elsewhere, as inserts that never
overwrite.

An edit of the general facts of a place (name, description, address,
position, category, picture, website, phone) on a trip place or a saved
place is made on every other copy of it the editor may edit, with a history
entry per copy and an announcement per trip and list. Notes, tags, status
and votes stay with each copy, and a copy the editor may not edit is
skipped. REST and MCP take the same path; a token reaches only the kinds of
copies it holds write scope for.

The entry rating names its voters, the library list filters by a lowest
average vote and sorts by rating, and the tab counts honour the filter.
2026-11-29 23:36:43 +00:00
Maurice c24c724861 feat(places): contracts for the one vote per person and the rating filter
The entry rating of All places names its voters (user_id, username,
avatar_url, rating), the people the average counts. The library query takes
min_rating (1 to 5) and the sort rating, the vote by entry key has its
request and response schemas, and the personal place tags give way to the
tags of the lists and trips a place is in.
2026-11-29 23:36:42 +00:00
Maurice 2653f0cb07 docs(mcp): list the place history, activity and tag tools 2026-11-29 21:16:51 +01:00
Maurice c944ef6de5 test(places): cover the place sheet sections, tags, trip lists and the visited filter 2026-11-29 21:16:51 +01:00
Maurice d008331e5f feat(places): notes, visits, tours, history, tags and location in the place sheet, saved lists on the trip map
Both the desktop sheet and the phone sheet of All places show the place's
location as a badge, its notes per list, its visits from trips (hidden without
any), linked tours and bookings, its change history and the reader's own tags
with a tag filter. A trip map can show the places of linked lists and add one
to the trip. All places reloads after a list is added or removed.
2026-11-29 21:16:51 +01:00
Maurice 9abd16b907 feat(i18n): the new Places strings in every language 2026-11-29 21:16:51 +01:00
Maurice 382ba79584 feat(places): visits read from trips, change history, linked tours and bookings, personal tags
A visit is a place planned on a day of one of the reader's trips; nothing is kept
or confirmed by hand. A place keeps a log of changes to its details, links the
tours and bookings it is about, and carries tags private to the reader, which a
copy into a trip takes along only when picked. Contracts, routes, MCP tools and
migrations for both engines.
2026-11-29 21:16:50 +01:00
Maurice ab7468f028 fix(ci): the file error helper no longer shadows the modal's own errorText
The new switch over the file errors took the name of the component's local errorText, so the local constant was read before its declaration (TS2448, the import tests and an unused-var warning). It is fileErrorText now.
2026-11-29 18:39:54 +01:00
Maurice b1c7bd0a33 fix(ci): the file import's words resolve through t, the unused key count drops
The KML skip reasons and the file errors were looked up from plain maps, which lint:i18n-keys cannot follow, so the new map keys counted as unused. Both are switches over t() now; the older file error keys are reached as well, so collection.ts holds 29 unused keys instead of 35.
2026-11-29 18:29:37 +01:00
Maurice 2b0ef098fd fix(ci): one save-to-list mapping for both All places views
lint:dup found the trip place to save dialog mapping copied in the desktop and phone views of All places; it is now saveDraftOf in libraryPairs, with a test.
2026-11-29 18:16:27 +01:00
Maurice 587f5f6bb6 fix(ci): drop the stale theme exception and format the filter bar
AddPlaceToCollectionModal no longer holds its theme-lint-disable line, so its entry in theme-disable-baseline.json goes; LibraryFilterBar is formatted after its import moved to the component status model.
2026-11-29 18:06:28 +01:00
Maurice 026d593c8d fix(ci): layering and theme counts after the places changes
- LibraryFilterBar reads the list statuses from the component-level
  collectionStatus model instead of reaching into pages/.
- The phone filter kit moved out of MCollections with its raw text sizes; it
  now uses the type tiers (control, caption), so the user's text size applies.
- The cover of a place of All places on the phone keeps its scrim, close button
  and name colours in a small stylesheet, as the desktop sheet does.
- theme-baseline: ratingBadge back to the two corner-badge literals it holds,
  MapView, MapViewGL and MCollections lowered to what they hold now.
2026-11-29 16:48:45 +01:00
Maurice f99c7f5421 fix(ci): the second round of gates after the places changes
- index.css stays at its size: the map canvas colour moves to its own
  stylesheet.
- The rating badge on map markers takes its amber and white from a class in
  ratingBadge.css instead of inline literals; the theme entry drops with it.
- Strict mode: the identity a link joins is resolved without a widened union,
  the description of an entry's origins is string or undefined, and the map
  search rows are typed.
- knip: PLACE_NAME_ATTR is module private, the linked-by enum names the values
  the service writes, and the unlink contract is its own described schema
  rather than a second name for the use schema.
- The duplicates hook test reads toasts through a module mock instead of the
  window hook; react-hooks/refs is lowered to the count the run measured.
- Tests follow the rename to Places and the list icon on an edit.
2026-11-29 16:38:53 +01:00
Maurice bacc6a29a7 feat(places): review possible duplicates, and repair the client gates
All places offers the pairs that look like one place: both sides side by side
with what differs marked, "keep this one" to group them as one place of the
user's own (undo right after), and "not the same place" to set a pair aside for
good. Desktop dialog and phone sheet share usePlaceDuplicates; every locale has
the new strings.

What the last dev run flagged on the client:
- Tailwind's Prettier plugin had trimmed the leading space of conditional class
  names (col-filter-btn, col-lrow sel, col-split map-full, col-detail docked),
  so the filter row and the open row lost their styling; those classes are now
  joined so the formatter cannot glue them.
- The dock position lives in one helper for the lists and All places, which
  moves the measured-position markers there instead of adding new ones.
- usePlacesLibrary is split into filters, pages, detail and cover hooks that
  derive their loading state instead of setting it inside effects; the big
  sheets and views are cut into parts under the complexity limit, dynamic icons
  go through createElement, originName moves out of a component file.
- formatRange is guarded like in the packing export, the cover lookup skips
  places without a position.
- Tests follow the rename to Places, the category icon, the default list icon
  and the new trip collections store; react-hooks/refs is lowered to the count
  the run measured.
- The rating on a place is a round badge again, in the list and on the map.
2026-11-29 16:28:22 +01:00
Maurice 62232ec87e fix(places): undo, unlink and dismissals that hold after a key or access change
Review findings on the place identities and trip list links:

- The assistant offers PlacesLibraryMcp, PlaceIdentitiesMcp and
  TripCollectionsMcp with the collections group (done with the CI fix).
- Undoing a merge restores the entries as they were: the merge logs, in its
  moved_link_ids JSON, each link it moved and each link it made with the use
  that link names, and whether the merged side became an own place only for
  the merge. The undo deletes what the merge made and moves the rest back,
  and only touches a link still in the leading place naming the same use, so
  a link id SQLite hands out again never moves someone else's link. The
  sweep counts a merge as spent by the same rule. Same unreleased migration,
  no schema change.
- A use can be taken out of an own place by the user's own link row also
  once its trip or list is out of reach; the answer then holds no entry, and
  the place left can be merged again.
- A dismissed duplicate is kept by one use of each side (an own place by its
  first link) and matched by the uses each entry holds, so it stays out when
  an entry becomes an own place or a merge is undone.
- link() checks the named uses with one targeted read instead of reading
  every use of the user, and the library reads its rows in blocks of 500 ids.
- Saved place reorders and the trip tags of a copy run one statement after
  the other again; a copy takes the first spelling of a tag name, as before.
- Unlinking a list from a trip takes place_edit alone, so a link to a list
  the writer cannot open can be taken off; a member leaving or taken off the
  trip takes the links whose list nobody left on it can open.
- The linked lists and their map places sort by lower(name), then by id, the
  same on both engines.
- list_all_places names the own:<id> keys and identity_id (MCP and wiki); the
  undo, unlink and trip unlink descriptions say what they do now; README
  counts 451 tools.
2026-11-29 16:27:12 +01:00
Maurice 7a06db393f fix(ci): repair server and shared gates after the place identities change
Push run 46275645144 on dev (f69a4c1a2) was red in these jobs:

- Server types: UserPlacesRepository.create, UserPlaceMergesRepository.create
  and UserPlaceLinksRepository.insert shadowed MikroORM's EntityRepository
  methods with other signatures (TS2416), which also broke defineEntity on the
  three entities (TS2769). They are createOwn, record and insertUses now.
- Server lint: collections.service.ts had grown to 1411 lines against 1410.
  The trip tag lookup of a copy moved into collections.helpers.ts
  (tripTagIdsOf, tagKeyOf); the size baseline is lowered to the 1398 it holds.
- ASTCAP-001/002/005b: the trip chat core had taken in PlacesLibraryMcp,
  PlaceIdentitiesMcp and TripCollectionsMcp, so core and the tours group
  offered 132 tools against 128. They load with the collections group now.
- PLIB-001, PLIB-MCP-001 and the places library e2e: the two entries named
  Museum tie on the name and go by their anchor, which the expected order
  hard coded the other way. The fixture orders every tie by its anchors.
- ENT-003 and CLASSFIELD-002: the five new entities and their 18 NOT NULL
  columns without a default are counted.
- Shared tests: collections.ratingBadge was missing in 26 locales; each has
  its translation now.
2026-11-29 16:14:42 +01:00