Repository navigation
feat(map): highlight an event's pin when hovering its card - #49
Merged
Merged
Conversation
Hovering (or keyboard-focusing) an EventCard now emphasizes that event's pin on the map without moving the camera, so users can connect list entries to locations before clicking through. Works at every EventCard render site (search results + region views). - store: add a transient `hover` slice to useViewState (mirrors `selection`), with `setHover`; extract the shared `MapPoint` shape. - controller: add `highlightEvent(event)` to the MapController seam, deriving the point via a shared `eventPoint` helper (identical to `frameEvent`) but setting `hover` only — never the camera. The no-op provider does nothing, so cards don't branch on `map=false`. - layers: `hoveredPointLayer` + `hoveredAreaLayer` reuse the `selected` / `cluster-selected` sprites (enlarged, slightly translucent) fed by a dedicated `hover` source — no style change. - Map: render the `hover` source mirroring `selection` (its own source, so the highlight shows even when the pin is clustered); not added to `interactiveLayerIds`. - EventCard: wire onMouseEnter/onFocus -> highlight, onMouseLeave/onBlur + unmount cleanup -> clear, so no stale highlight survives navigation. Closes #44 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Collapse the near-identical `selection` and `hover` map sources into one module-private `PointSource` component (export the shared `MapPoint` type), so the single-point GeoJSON build lives in one place and the two can't drift. No behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Per code review: the unmount-cleanup effect depended on `highlightEvent`, whose identity changes when a breakpoint-driven map-padding update rebuilds the MapController. That re-ran the cleanup mid-hover and wiped the live highlight (and every mounted card cleared the shared hover slot). Read `highlightEvent` through a ref and depend on `[]`, so the cleanup fires only when the card actually unmounts. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Set the map's fadeDuration to 0 so the card-hover highlight pin appears immediately instead of fading in over Mapbox's default ~300ms. That is a global map option (no per-layer control), so it also drops the fade on the base pins/clusters and the selection pin — a snappier, consistent appearance. Refs #44 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…-off Default the skill to implementing in an isolated git worktree (step 4: EnterWorktree + branch rename + node_modules/.env.local setup notes), remove it once the PR is open and CI is green (step 8: ExitWorktree), and close with a required final-summary template (step 9) that links the PR and gives a copy/paste command to switch the branch into the main checkout for local review. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Deploying sahajatlas-design with
|
| Latest commit: |
d16daaf
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c9777060.sahajatlas-design.pages.dev |
| Branch Preview URL: | https://feat-card-hover-highlight.sahajatlas-design.pages.dev |
Ardnived
added a commit
that referenced
this pull request
Jul 14, 2026
Brings in #49 (pin-hover highlight) and #50 (date-range filter). Two conflicts, resolved by combining both sides: - Map.tsx `filtered` memo + fetch.ts `getEvents`: keep #50's `today` arg to matchesFilters AND this branch's geometry-only toMapSource trim / per-locale titles join. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
EventCardrender site (search results + region / online views) with no per-site wiring, driven through the existingMapControllerseam — so it's a clean no-op when the widget renders without a map (map=false), and no card branches on the map flag.Changes
src/config/store.ts— add a transienthoverslice touseViewState(mirrorsselection); extract the sharedMapPointtype.src/hooks/use-map-controller.tsx— addhighlightEvent(event)to the MapController seam; derive the point via a sharedeventPoint()helper (identical toframeEvent), but sethoveronly — never the camera.src/components/organisms/Mapbox/layers.ts—hoveredPointLayer/hoveredAreaLayerreuse theselected/cluster-selectedsprites (enlarged, slightly translucent) from a dedicatedhoversource; not added tointeractiveLayerIds.src/components/organisms/Mapbox/Map.tsx— render thehoversource; the near-identicalselectionandhoversources are collapsed into one module-privatePointSource. Thehoversource is independent of the clusteredeventssource, so the highlight shows even when the pin is clustered.src/components/molecules/EventCard/EventCard.tsx—onMouseEnter/onFocus→ highlight,onMouseLeave/onBlur+ unmount cleanup → clear.Verification
pnpm lint)pnpm typecheck)setHoverstore test (pnpm test:run)pnpm build+ladle:build.Manual / visual verification
Driven in the running widget (Playwright, live data) from the region view (
/italy/lazio/rome):selectedsprite at the event's coordinates; the map camera does not move (center/zoom unchanged).hoversource is separate from the clusteredeventssource).frameEventselection (selection pin renders at zoom 15).frameEvent).Notes for reviewer
highlightEventuses the sameapproximate → area spritelogic asframeEvent. In the current data all 28 online events lack coordinates, so neither frames nor highlights them (correct "no coords → nothing"); thehoveredAreaLayerbranch is therefore not visually exercised but is symmetric to the verified point path.highlightEventthrough a ref with[]deps so it fires only on real unmount —highlightEvent's identity changes when a breakpoint-driven padding update rebuilds the controller, and depending on it would wipe a live highlight mid-hover (caught in code review; fixed in its own commit).onFocusre-shows the highlight with no pointer present. This is the intended focus-parity behavior and self-clears on blur, so it's left as-is.selectedsprites (enlarged +icon-opacity); a dedicated hover sprite can land with feat(map): brand-colour the map markers and cluster paints #17.Closes #44
🤖 Generated with Claude Code