Skip to content

feat(map): show recurrence + time popover on event pin hover - #73

Merged
Ardnived merged 5 commits into
mainfrom
feat/pin-hover-popover
Jul 23, 2026
Merged

Ardnived merged 5 commits into
mainfrom
feat/pin-hover-popover

Conversation

@Ardnived

Copy link
Copy Markdown
Contributor

Summary

  • Hovering an individual event pin on the map now shows a small, non-interactive popover with that event's timing line — recurrence + start time (e.g. "Every Thursday · 7:30 PM"). Previously hovering a pin only swapped the cursor, so you couldn't tell when an event met without clicking through.
  • The line is produced by the same shared formatter the list card uses, so the popover and the EventListItem card can never drift across weekly / fortnightly / monthly / daily / one-off / course / online events and locales.
  • Popover only appears for individual pins (unclustered-point), never clusters; it's a desktop/hover affordance that never blocks tap-to-open on touch.

Changes

  • src/hooks/use-event-display.ts — extracted the calendar-line composition into a pure composeCalendarLine({ recurrenceLine, whenLine, time, hasNext }) helper (unit-tested). EventFacts now calls it (behavior-preserving) so the list card and popover share one source.
  • src/components/organisms/Mapbox/EventPinPopover/ — new component: calls useEventDisplay once for the hovered event, renders a react-map-gl <Popup> (no close button, offset above the pin, pointer-events: none). Includes a Ladle story (token-gated live-map preview) + barrel.
  • src/components/organisms/Mapbox/Map.tsx — track the hovered unclustered-point id in local state (never a cluster), clear on move-to-empty/cluster (onMouseMove), on canvas exit (onMouseOut), and on click; re-join the id to the full event from the ['geojson'] cache (the vector source is trimmed to id + webPath).
  • src/styles/globals.css — scoped .event-pin-popover override strips Mapbox's default popup chrome (box/tip) and forces pointer-events: none, so the tokened card themes light/dark and can't steal hover.

Verification

  • Lint: ✓ No errors (pnpm lint)
  • Types: ✓ Clean (pnpm typecheck)
  • Tests: ✓ Unit lane green (pnpm test:run) — includes 5 new composeCalendarLine cases (weekly / one-off / terminal / missing-time)
  • Build: deferred to CI (adds pnpm build + ladle:build)

Manual / visual verification

  • Verified manually in the running widget (author-confirmed): the recurrence + start-time line appears on pin hover, follows the pin, and dismisses on leave; light + dark; non-interactive (no hover flicker, tap-to-open still works).

Notes for reviewer

  • The popover carries no title, so the locale-agnostic ['geojson'] feed event is sufficient — the per-locale titles sliver isn't needed.
  • hoveredId is deliberately local useState, not useViewState: it's set and read entirely within Map.tsx (unlike the cross-component card→pin hover), so it stays off the hot-path store.
  • /simplify pass: dropped a redundant prev === next state-update guard (React already bails out via Object.is). Code-review pass (single, isolated subagent, high effort): no Critical/High/Medium findings; applied L2 (dismiss popover on click); dismissed L1 (memo ignoring filters) as unreachable — changing filters goes through toolbar/drawer interaction that fires onMouseOut first, and background refetches are handled by the memo's data dep.
  • Security review skipped: no security-relevant paths changed (no api/auth, widget entry, HTML sinks, deps, or env/build config).

Closes #72

🤖 Generated with Claude Code

Ardnived and others added 5 commits July 23, 2026 07:50
Pull the calendar-line composition (recurrence · time, with the one-off /
terminal fallback to the when-line) out of EventFacts into a pure
`composeCalendarLine` helper on the display layer, so a second surface can
render the identical line without re-deriving it. Behaviour-preserving for
the list card; unit-tested for the join rules.

Prep for #72 (map-pin hover popover).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Hovering an individual event pin now shows a small non-interactive popover
with that event's timing line (recurrence · start time), the same compact
calendar line the list card leads with — via the shared composeCalendarLine
formatter so the two can never drift.

- Track the hovered unclustered-point id in Map.tsx (never a cluster), clear
  it on move-to-empty / cluster and on canvas exit (onMouseOut).
- Re-join the id to the full feed event from the ['geojson'] cache (the map
  source is trimmed to id + webPath); the title sliver isn't needed.
- Render via react-map-gl <Popup>, non-interactive (pointer-events:none),
  no close button, offset above the pin; default Mapbox popup chrome stripped
  in globals.css so the tokened card themes light/dark.

Closes #72

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Drop the redundant functional-update guard in the pin-hover handler — React
already bails out of a re-render when the id is unchanged (Object.is), so the
manual prev===next check was reimplementing the built-in bailout.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Clear the hovered-pin state when a pin or cluster is clicked, so the timing
popover doesn't linger over the pin after tap-to-open / click-through until the
next pointer move (code-review L2).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Note the new EventPinPopover interaction in the map rule: local hovered-id
state, re-join to the ['geojson'] cache, non-interactive react-map-gl Popup with
chrome stripped in globals.css, and the shared composeCalendarLine formatter.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying sahajatlas-design with  Cloudflare Pages  Cloudflare Pages

Latest commit: 905ff20
Status: ✅  Deploy successful!
Preview URL: https://9a9bba1a.sahajatlas-design.pages.dev
Branch Preview URL: https://feat-pin-hover-popover.sahajatlas-design.pages.dev

View logs

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying sahajatlas with  Cloudflare Pages  Cloudflare Pages

Latest commit: 905ff20
Status: ✅  Deploy successful!
Preview URL: https://abd74773.sahajatlas.pages.dev
Branch Preview URL: https://feat-pin-hover-popover.sahajatlas.pages.dev

View logs

@Ardnived
Ardnived merged commit 21ca7bd into main Jul 23, 2026
4 checks passed
@Ardnived
Ardnived deleted the feat/pin-hover-popover branch July 23, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(map): show recurrence + time popover on event pin hover

1 participant