@sarimarcus/content-sites-tourism 0.49.0 → 0.49.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All packages in the platform release in lockstep; entries are per release version.
|
|
4
4
|
|
|
5
|
+
## 0.49.1 (2026-10-26)
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- `locator` slot on `NeighborhoodHubPage` and `NeighborhoodDetailPage` (SLA-3510): a site passes its own live map there in place of the not-to-scale SVG, which stays the fallback when the slot is absent or renders empty. Optional; nothing has to adopt it.
|
|
10
|
+
- `stops` on the hub model's `map` and the detail model's `locator`: one `LocatorStop` (`order`, `name`, `coordinates`, `type: 'neighborhood'`, `slug`) per neighbourhood with coordinates, numbered as in the hub list; the detail page's own neighbourhood carries `active: true`. `LocatorStop` is exported from `/neighborhoods`.
|
|
11
|
+
- `liveNote` (hub) and `liveCaption` (detail): the map copy without "Not to scale", shown when a live map is slotted.
|
|
12
|
+
|
|
5
13
|
## 0.49.0 (2026-10-25)
|
|
6
14
|
|
|
7
15
|
### Added
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sarimarcus/content-sites-tourism",
|
|
3
|
-
"version": "0.49.
|
|
3
|
+
"version": "0.49.1",
|
|
4
4
|
"description": "City-tourism vertical: city-entity components, pages templates and utilities for the tourism sites.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"astro": "^7.0.6",
|
|
39
39
|
"tailwindcss": "^4.1.18",
|
|
40
|
-
"@sarimarcus/content-sites-core": "0.49.
|
|
41
|
-
"@sarimarcus/content-sites-ui": "0.49.
|
|
40
|
+
"@sarimarcus/content-sites-core": "0.49.1",
|
|
41
|
+
"@sarimarcus/content-sites-ui": "0.49.1"
|
|
42
42
|
}
|
|
43
43
|
}
|
package/src/internal/labels.ts
CHANGED
|
@@ -36,12 +36,12 @@ export const LABELS = {
|
|
|
36
36
|
allIn: 'All {count} {noun} in {name}', kmFrom: '{km} km from the {anchor}', beside: 'Beside the {anchor}',
|
|
37
37
|
insiderTips: 'Insider tips', otherHoods: 'Other neighbourhoods', allHoods: 'All neighbourhoods', googleMaps: 'Open in Google Maps',
|
|
38
38
|
detailMapAria: "Locator map of {city}'s neighbourhoods, not to scale, with {name} highlighted and the {anchor} marked.",
|
|
39
|
-
detailMapCaption: 'Where {name} sits. Not to scale.',
|
|
39
|
+
detailMapCaption: 'Where {name} sits. Not to scale.', detailLiveMapCaption: 'Where {name} sits.',
|
|
40
40
|
hubHeading: 'Where to stay in {city}, neighbourhood by neighbourhood',
|
|
41
41
|
hubStandfirst: '{count} areas compared as a base: who each suits, what is on the doorstep, and how far it is from the {anchor}.',
|
|
42
42
|
allAreas: 'All areas', filterAria: 'Filter neighbourhoods by who they suit', status: 'Showing {shown} of {total} neighbourhoods',
|
|
43
43
|
hubMapAria: "Locator map of {city}'s {count} neighbourhoods, numbered as in the list, with the {anchor} marked. Not to scale.",
|
|
44
|
-
hubMapSummary: 'Map of the {count} areas', hubMapNote: 'Numbers match the list. Not to scale: the list gives true straight-line distances from the {anchor}.',
|
|
44
|
+
hubMapSummary: 'Map of the {count} areas', hubMapNote: 'Numbers match the list. Not to scale: the list gives true straight-line distances from the {anchor}.', hubLiveMapNote: 'Numbers match the list.',
|
|
45
45
|
explore: 'Explore {name}', seeHotels: 'See the {count} hotels', siblingsLabel: 'Other neighbourhoods:',
|
|
46
46
|
hotel: ['hotel', 'hotels'] as const, restaurant: ['restaurant', 'restaurants'] as const, monument: ['monument', 'monuments'] as const,
|
|
47
47
|
museum: ['museum', 'museums'] as const, bar: ['bar', 'bars'] as const, activity: ['activity', 'activities'] as const, sight: ['sight', 'sights'] as const,
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
*
|
|
9
9
|
* The route keeps Layout, StructuredData, the data and every string. It resolves images, caps each shelf with
|
|
10
10
|
* `shelfPlan` and the picks with `resolvePicks`, and passes the site's own components in slots: `breadcrumb`, `hero`,
|
|
11
|
-
* `byline`, `people`, `body` (DetailBody), `after-shelves`, `faq`, `
|
|
11
|
+
* `byline`, `people`, `body` (DetailBody), `after-shelves`, `faq`, `locator` (the site's live map, in place of the SVG),
|
|
12
|
+
* `sources`, `closer`.
|
|
12
13
|
*/
|
|
13
14
|
import { EntityDetailShell, Container } from '@sarimarcus/content-sites-ui/layout';
|
|
14
15
|
import { Chip, Icon } from '@sarimarcus/content-sites-ui/primitives';
|
|
@@ -49,11 +50,14 @@ interface Props {
|
|
|
49
50
|
bodyFigure?: DetailFigure;
|
|
50
51
|
shelves: readonly DetailShelf[];
|
|
51
52
|
tips?: { heading: string; items: readonly DetailTip[]; figure?: DetailFigure };
|
|
52
|
-
locator?: { layout: LocatorLayout; numbers: Record<string, number>; names: Record<string, string>; anchorLabel: string; ariaLabel: string; caption: string; mapLink?: { href: string; label: string } };
|
|
53
|
+
locator?: { layout: LocatorLayout; numbers: Record<string, number>; names: Record<string, string>; anchorLabel: string; ariaLabel: string; caption: string; liveCaption?: string; mapLink?: { href: string; label: string } };
|
|
53
54
|
siblings?: DetailSiblings;
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
const { slug, audiences = [], base, bodyFigure, shelves, tips, locator, siblings } = Astro.props;
|
|
58
|
+
// Rendered, not slots.has alone: a site's `{cond && <Map slot="locator" />}` counts as present even when cond is false.
|
|
59
|
+
const locatorHtml = Astro.slots.has('locator') ? (await Astro.slots.render('locator')).trim() : '';
|
|
60
|
+
const live = locatorHtml !== '';
|
|
57
61
|
const hasTips = Boolean(tips && tips.items.length);
|
|
58
62
|
const hasFaq = Astro.slots.has('faq');
|
|
59
63
|
---
|
|
@@ -87,9 +91,9 @@ const hasFaq = Astro.slots.has('faq');
|
|
|
87
91
|
{hasFaq && <div class="min-w-0 max-w-measure"><slot name="faq" /></div>}
|
|
88
92
|
{locator && (
|
|
89
93
|
<figure id="map" class="m-0 scroll-mt-20">
|
|
90
|
-
<NeighborhoodLocatorMap layout={locator.layout} numbers={locator.numbers} names={locator.names} anchorLabel={locator.anchorLabel} ariaLabel={locator.ariaLabel} active={slug} />
|
|
94
|
+
{live ? <Fragment set:html={locatorHtml} /> : <NeighborhoodLocatorMap layout={locator.layout} numbers={locator.numbers} names={locator.names} anchorLabel={locator.anchorLabel} ariaLabel={locator.ariaLabel} active={slug} />}
|
|
91
95
|
<figcaption class="mt-2 text-sm text-muted-foreground">
|
|
92
|
-
{locator.caption}
|
|
96
|
+
{live ? (locator.liveCaption ?? locator.caption) : locator.caption}
|
|
93
97
|
{locator.mapLink && <a href={locator.mapLink.href} class="ml-1 inline-flex min-h-[44px] items-center text-secondary hover:text-primary">{locator.mapLink.label}</a>}
|
|
94
98
|
</figcaption>
|
|
95
99
|
</figure>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* NeighborhoodHubPage — /neighborhoods (SLA-3449, design SLA-3446): "where to stay, neighbourhood by neighbourhood".
|
|
4
4
|
* A compact head (H1, one-line standfirst), the best-for filter (hidden until hubFilter.ts runs), the numbered rows
|
|
5
|
-
* and, beside them, the not-to-scale
|
|
5
|
+
* and, beside them, the locator map (the not-to-scale SVG, or the site's live map passed as `locator`; sticky and open on desktop, collapsed below the list on mobile).
|
|
6
6
|
*
|
|
7
7
|
* The route keeps Layout, StructuredData, the data and every string, renders the rows as NeighborhoodHubRow children
|
|
8
8
|
* of the default slot, and passes `breadcrumb` and `after` (ItineraryTeaser, AlsoExplore). `statusTemplate` holds
|
|
@@ -22,10 +22,13 @@ interface Props {
|
|
|
22
22
|
filterAriaLabel: string;
|
|
23
23
|
statusTemplate: string;
|
|
24
24
|
total: number;
|
|
25
|
-
map?: { layout: LocatorLayout; numbers: Record<string, number>; names: Record<string, string>; anchorLabel: string; ariaLabel: string; summary: string; note: string };
|
|
25
|
+
map?: { layout: LocatorLayout; numbers: Record<string, number>; names: Record<string, string>; anchorLabel: string; ariaLabel: string; summary: string; note: string; liveNote?: string };
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
const { heading, standfirst, filters, allLabel, filterAriaLabel, statusTemplate, total, map } = Astro.props;
|
|
29
|
+
// Rendered, not slots.has alone: a site's `{cond && <Map slot="locator" />}` counts as present even when cond is false.
|
|
30
|
+
const locatorHtml = Astro.slots.has('locator') ? (await Astro.slots.render('locator')).trim() : '';
|
|
31
|
+
const live = locatorHtml !== '';
|
|
29
32
|
const status = countText(statusTemplate, total, total);
|
|
30
33
|
---
|
|
31
34
|
|
|
@@ -46,8 +49,8 @@ const status = countText(statusTemplate, total, total);
|
|
|
46
49
|
{map && (
|
|
47
50
|
<details data-hub-map class="order-last self-start rounded-xl border border-border bg-card p-4 lg:sticky lg:top-24">
|
|
48
51
|
<summary class="flex min-h-[44px] cursor-pointer items-center font-display text-lg text-foreground">{map.summary}</summary>
|
|
49
|
-
<p class="mb-2 text-xs text-muted-foreground">{map.note}</p>
|
|
50
|
-
<NeighborhoodLocatorMap layout={map.layout} numbers={map.numbers} names={map.names} anchorLabel={map.anchorLabel} ariaLabel={map.ariaLabel} />
|
|
52
|
+
<p class="mb-2 text-xs text-muted-foreground">{live ? (map.liveNote ?? map.note) : map.note}</p>
|
|
53
|
+
{live ? <Fragment set:html={locatorHtml} /> : <NeighborhoodLocatorMap layout={map.layout} numbers={map.numbers} names={map.names} anchorLabel={map.anchorLabel} ariaLabel={map.ariaLabel} />}
|
|
51
54
|
</details>
|
|
52
55
|
)}
|
|
53
56
|
</div>
|
|
@@ -93,6 +93,9 @@ function kmLabel(km: number, anchor: Anchor, L: Labels) {
|
|
|
93
93
|
return km < 0.1 ? fill(L.beside, { anchor: anchor.label }) : fill(L.kmFrom, { km: km.toFixed(1), anchor: anchor.label });
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
/** A pin for the site's live map, in the shape its map component takes; `order` is the number in the hub list. */
|
|
97
|
+
export interface LocatorStop { order: number; name: string; coordinates: LatLng; type: 'neighborhood'; slug: string; active?: boolean }
|
|
98
|
+
|
|
96
99
|
/** `order` is hubOrder's output: the map numbers what the hub list numbers. */
|
|
97
100
|
function locatorFor(order: readonly HoodSummary[], anchor: Anchor) {
|
|
98
101
|
if (!anchor.at) return undefined;
|
|
@@ -100,6 +103,10 @@ function locatorFor(order: readonly HoodSummary[], anchor: Anchor) {
|
|
|
100
103
|
layout: locatorPoints(order.map((h) => ({ slug: h.slug, points: h.points })), anchor.at) as LocatorLayout,
|
|
101
104
|
numbers: Object.fromEntries(order.map((h, i) => [h.slug, i + 1])),
|
|
102
105
|
names: Object.fromEntries(order.map((h) => [h.slug, h.name])),
|
|
106
|
+
stops: order.flatMap((h, i): LocatorStop[] => {
|
|
107
|
+
const c = centroid(h.points);
|
|
108
|
+
return c ? [{ order: i + 1, name: h.name, coordinates: c, type: 'neighborhood', slug: h.slug }] : [];
|
|
109
|
+
}),
|
|
103
110
|
};
|
|
104
111
|
}
|
|
105
112
|
|
|
@@ -194,9 +201,11 @@ export function neighborhoodDetailModel(input: DetailModelInput) {
|
|
|
194
201
|
const loc = locatorFor(hubOrder(input.hoods, anchor), anchor);
|
|
195
202
|
const locator = loc && {
|
|
196
203
|
...loc,
|
|
204
|
+
stops: loc.stops.map((s) => (s.slug === hood.slug ? { ...s, active: true } : s)),
|
|
197
205
|
anchorLabel: anchor.label,
|
|
198
206
|
ariaLabel: fill(L.detailMapAria, { city: input.city, name: hood.name, anchor: anchor.label }),
|
|
199
207
|
caption: fill(L.detailMapCaption, { name: hood.name }),
|
|
208
|
+
liveCaption: fill(L.detailLiveMapCaption, { name: hood.name }),
|
|
200
209
|
mapLink: input.mapsLink && { href: input.mapsLink.href, label: input.mapsLink.label ?? L.googleMaps },
|
|
201
210
|
};
|
|
202
211
|
|
|
@@ -285,6 +294,7 @@ export function neighborhoodHubModel(input: HubModelInput) {
|
|
|
285
294
|
ariaLabel: fill(L.hubMapAria, { city: input.city, count: rows.length, anchor: anchor.label }),
|
|
286
295
|
summary: fill(L.hubMapSummary, { count: rows.length }),
|
|
287
296
|
note: fill(L.hubMapNote, { anchor: anchor.label }),
|
|
297
|
+
liveNote: L.hubLiveMapNote,
|
|
288
298
|
},
|
|
289
299
|
};
|
|
290
300
|
}
|
|
@@ -5,5 +5,5 @@ export {
|
|
|
5
5
|
neighborhoodDetailModel, neighborhoodHubModel, neighborhoodData, hubOrder, hubFilters, rankItems, resolvePicks, ratingValue, toLatLng, ITEM_ROUTES,
|
|
6
6
|
} from './neighborhoodModel.ts';
|
|
7
7
|
export type {
|
|
8
|
-
NeighborhoodItem, NeighborhoodItems, HoodSummary, Anchor, ItemType, DetailModelInput, HubModelInput, NeighborhoodCollections, DataOptions, EntryLike,
|
|
8
|
+
NeighborhoodItem, NeighborhoodItems, HoodSummary, LocatorStop, Anchor, ItemType, DetailModelInput, HubModelInput, NeighborhoodCollections, DataOptions, EntryLike,
|
|
9
9
|
} from './neighborhoodModel.ts';
|