diff --git a/client/src/pages/JourneyPublicPage.test.tsx b/client/src/pages/JourneyPublicPage.test.tsx
index 62f3373c8..e1d1adbad 100644
--- a/client/src/pages/JourneyPublicPage.test.tsx
+++ b/client/src/pages/JourneyPublicPage.test.tsx
@@ -536,4 +536,26 @@ describe('JourneyPublicPage', () => {
expect(images.length).toBeGreaterThan(0);
});
});
+
+ // #1962 — the marker number used to be the stop's position within its day while
+ // the day heading showed the day number, so the same digit appeared repeatedly in
+ // different colours with no key. Both now count stops across the whole journey.
+ it('FE-PAGE-PUBLICJOURNEY-021: numbers each stop once, and the timeline carries the same number', async () => {
+ setupSuccess();
+ render();
+
+ await waitFor(() => expect(screen.getByText('Shibuya Crossing')).toBeInTheDocument());
+
+ // Two geocoded entries on two different days: stops 1 and 2, not 1 and 1.
+ const shibuya = document.querySelector('[data-entry-id="10"]') as HTMLElement;
+ const sensoji = document.querySelector('[data-entry-id="11"]') as HTMLElement;
+ expect(shibuya).toBeTruthy();
+ expect(sensoji).toBeTruthy();
+
+ const badge = (el: HTMLElement) =>
+ Array.from(el.querySelectorAll('span')).find(s => /^\d+$/.test(s.textContent || ''))?.textContent;
+
+ expect(badge(shibuya)).toBe('1');
+ expect(badge(sensoji)).toBe('2');
+ });
});
diff --git a/client/src/pages/JourneyPublicPage.tsx b/client/src/pages/JourneyPublicPage.tsx
index e6c8b55f9..381d8ff79 100644
--- a/client/src/pages/JourneyPublicPage.tsx
+++ b/client/src/pages/JourneyPublicPage.tsx
@@ -112,6 +112,7 @@ export default function JourneyPublicPage() {
sortedDates,
sidebarMapItems,
allPhotos,
+ stopNumberById,
desktopTwoColumn,
} = useJourneyPublic();
@@ -304,6 +305,22 @@ export default function JourneyPublicPage() {
)}
+ {/* The number the map marker carries, so the timeline is the key
+ to the map rather than a second, unrelated numbering (#1962).
+ Outside the photo-count gate below: a single-photo entry puts
+ its title and location in the image overlay, but the stop
+ number has to be readable either way. */}
+ {stopNumberById.has(String(entry.id)) && (
+
+
+ {stopNumberById.get(String(entry.id))}
+
+
+ )}
+
{/* Location + time badges */}
{(entry.location_name || entry.entry_time) && photos.length !== 1 && (
diff --git a/client/src/pages/JourneyPublicPage.wiring.test.tsx b/client/src/pages/JourneyPublicPage.wiring.test.tsx
index 9f9c3a250..dec7adb13 100644
--- a/client/src/pages/JourneyPublicPage.wiring.test.tsx
+++ b/client/src/pages/JourneyPublicPage.wiring.test.tsx
@@ -82,6 +82,7 @@ function buildHook(over: Record = {}): Record
groupedEntries: grouped,
sortedDates: [...grouped.keys()].sort(),
sidebarMapItems: [],
+ stopNumberById: new Map(),
allPhotos: [] as PublicGalleryPhoto[],
desktopTwoColumn: true,
...over,
diff --git a/client/src/pages/journeyPublic/useJourneyPublic.ts b/client/src/pages/journeyPublic/useJourneyPublic.ts
index 71f71ee31..5d38bb9f0 100644
--- a/client/src/pages/journeyPublic/useJourneyPublic.ts
+++ b/client/src/pages/journeyPublic/useJourneyPublic.ts
@@ -63,12 +63,16 @@ export function useJourneyPublic() {
// Map entries with day color/label for colored markers.
// dayIdx is derived from sortedDates (ALL timeline dates) so marker colors
// stay in sync with the timeline day headers even when some days have no locations.
+ // The marker number used to be the stop's position *within* its day, while the
+ // timeline heading showed the day number — two different numbers in the same
+ // colour, and on mobile the heading is not rendered at all, so the key was
+ // missing entirely (#1962). It is now the stop's place in the whole journey, so
+ // every number appears exactly once and the colour still groups the day.
const sidebarMapItems = useMemo(() => {
- const counters = new Map()
+ let stop = 0
return mapEntries.map(e => {
const dayIdx = sortedDates.indexOf(e.entry_date)
- const dayLabel = (counters.get(e.entry_date) ?? 0) + 1
- counters.set(e.entry_date, dayLabel)
+ const dayLabel = ++stop
return {
id: String(e.id),
lat: e.location_lat!,
@@ -83,6 +87,14 @@ export function useJourneyPublic() {
})
}, [mapEntries, sortedDates])
+ // The same number the marker carries, so the timeline is the key to the map
+ // rather than a second, unrelated numbering.
+ const stopNumberById = useMemo(() => {
+ const m = new Map()
+ sidebarMapItems.forEach(i => m.set(i.id, i.dayLabel))
+ return m
+ }, [sidebarMapItems])
+
// Two-column desktop layout: timeline feed left + sticky map right
const desktopTwoColumn = !isMobile && perms.share_timeline && perms.share_map
@@ -102,7 +114,7 @@ export function useJourneyPublic() {
view, setView, lightbox, setLightbox, showLangPicker, setShowLangPicker,
mapRef, activeEntryId, setActiveEntryId, viewingEntry, setViewingEntry, handleMarkerClick,
perms, journey, stats,
- timelineEntries, groupedEntries, sortedDates, sidebarMapItems, allPhotos,
+ timelineEntries, groupedEntries, sortedDates, sidebarMapItems, allPhotos, stopNumberById,
desktopTwoColumn,
}
}