From 71fe69c1f1c3faf1570f7af1a1287db17ca083c6 Mon Sep 17 00:00:00 2001 From: Maurice Date: Tue, 20 Oct 2026 12:16:11 +0200 Subject: [PATCH] feat(tours): mark the best known places along a city walk A search for sights along a tour now also asks the places index for the best known places near the line, ranked by how often their Wikipedia articles are read (QRank). A row the index already found is marked as a highlight; a famous sight no kind names, like a square, is added as a sight of its own. Stations, hotels and restaurants rank a row they match but are never added. Highlights are listed first with a star in the list and a badge in the map card. A place counts as a highlight from 40000 views a year, or the best three from 5000 where fewer reach that. An index without ranks, or one older than the endpoint, leaves the search as it was. --- .../src/components/Tours/poi/TourPoiCard.tsx | 21 ++- .../Tours/poi/TourPoiSearchCard.tsx | 13 ++ .../Tours/poi/tourPoiSearch.test.tsx | 42 ++++- server/src/nest/maps/maps.service.ts | 10 + server/src/nest/maps/pois-along.resolver.ts | 47 ++++- server/src/nest/maps/trek-places.client.ts | 89 +++++++++ .../src/nest/tours/tour-poi-search.service.ts | 174 ++++++++++++++++-- server/src/nest/tours/tours.mcp.ts | 2 +- .../tests/unit/nest/maps.pois-along.test.ts | 60 +++++- .../unit/nest/tour-poi-search.service.test.ts | 167 ++++++++++++++++- server/tests/unit/nest/tours.mcp.test.ts | 1 + .../unit/nest/trek-places.client.test.ts | 73 ++++++++ shared/src/i18n/ar/tours.ts | 2 + shared/src/i18n/az/tours.ts | 2 + shared/src/i18n/br/tours.ts | 2 + shared/src/i18n/ca/tours.ts | 2 + shared/src/i18n/cs/tours.ts | 2 + shared/src/i18n/de/tours.ts | 2 + shared/src/i18n/en/tours.ts | 2 + shared/src/i18n/es/tours.ts | 2 + shared/src/i18n/et/tours.ts | 2 + shared/src/i18n/fr/tours.ts | 2 + shared/src/i18n/gr/tours.ts | 2 + shared/src/i18n/hu/tours.ts | 2 + shared/src/i18n/id/tours.ts | 2 + shared/src/i18n/it/tours.ts | 2 + shared/src/i18n/ja/tours.ts | 2 + shared/src/i18n/ko/tours.ts | 2 + shared/src/i18n/nl/tours.ts | 2 + shared/src/i18n/pl/tours.ts | 2 + shared/src/i18n/ru/tours.ts | 2 + shared/src/i18n/sk/tours.ts | 2 + shared/src/i18n/sv/tours.ts | 2 + shared/src/i18n/th/tours.ts | 2 + shared/src/i18n/tours-locales.spec.ts | 2 +- shared/src/i18n/tr/tours.ts | 2 + shared/src/i18n/uk/tours.ts | 2 + shared/src/i18n/vi/tours.ts | 2 + shared/src/i18n/zh-TW/tours.ts | 2 + shared/src/i18n/zh/tours.ts | 2 + shared/src/tours/tour-highlights.spec.ts | 42 +++++ shared/src/tours/tour-highlights.ts | 35 ++++ .../src/tours/tour-poi-search.schema.spec.ts | 23 +++ shared/src/tours/tour-poi-search.schema.ts | 9 + wiki/MCP-Addon-Tools.md | 2 +- 45 files changed, 840 insertions(+), 26 deletions(-) create mode 100644 shared/src/tours/tour-highlights.spec.ts create mode 100644 shared/src/tours/tour-highlights.ts diff --git a/client/src/components/Tours/poi/TourPoiCard.tsx b/client/src/components/Tours/poi/TourPoiCard.tsx index ecee31630..5694d524c 100644 --- a/client/src/components/Tours/poi/TourPoiCard.tsx +++ b/client/src/components/Tours/poi/TourPoiCard.tsx @@ -1,6 +1,6 @@ import type { TourPoi, WalkTheme } from '@trek/shared'; import { WALK_THEMES } from '@trek/shared'; -import { Clock, ExternalLink, MoveHorizontal, Plus, Route, X } from 'lucide-react'; +import { Clock, ExternalLink, MoveHorizontal, Plus, Route, Star, X } from 'lucide-react'; import { useCallback, useRef } from 'react'; import { useTranslation } from '../../../i18n'; import { useSettingsStore } from '../../../store/settingsStore'; @@ -9,7 +9,7 @@ import { formatDistance } from '../../../utils/units'; import { MAP_CARD_GLASS } from '../../Map/mapControlShadow'; import { TOUR_POI_LOOKS } from '../../Map/poiCategories'; import { useMapCardDismiss } from '../../Map/useMapCardDismiss'; -import { WhiteBadge } from '../../Planner/planParts'; +import { SoftPill, WhiteBadge } from '../../Planner/planParts'; import { PillSelect } from '../../shared/dialogParts'; import { fs } from '../../shared/DialogShell'; import type { TourPlannerController } from '../planner/useTourPlanner'; @@ -157,7 +157,22 @@ function TourPoiCard({

{poi.name || kind}

- {poi.name &&

{kind}

} + {(poi.name || poi.highlight) && ( +
+ {poi.name &&

{kind}

} + {/* One of the best known places along the route, as the star in the list marks it. */} + {poi.highlight && ( + + + + )} +
+ )}