Skip to content

Map↔card interaction: link pins to cards + numbered pins#216

Open
ivanmkc wants to merge 1 commit into
masterfrom
feat/map-card-interaction
Open

Map↔card interaction: link pins to cards + numbered pins#216
ivanmkc wants to merge 1 commit into
masterfrom
feat/map-card-interaction

Conversation

@ivanmkc

@ivanmkc ivanmkc commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Tighter integration between a Map and its sibling cards — hover/select one, highlight the other.

What

  • MapLink component: wraps a card and links it to a Map marker sharing the same id (scoped by optional group). Hover/click a pin → the linked card rings and scrolls into view; hover a card → the pin's popup opens and the map pans to it.
  • Map additions: markers[].id, a group prop, and numbered (pins labelled 1..N in order).
  • map-link.ts: a tiny module-level focus pub/sub — no React-context/provider wiring through the generic resolver; keyed by group so independent boards don't cross-talk, and each side ignores its own source to avoid feedback loops.
  • CSS ring for .tc-maplink (hover/active), keyboard-focusable.

Why this shape

The component tree is generic {type,props,children} with no shared state; a module-level bus keyed by id/group is the least-invasive way to let two independent nodes talk. Purely additive — existing maps/cards are unchanged; linking only activates when a marker id matches a MapLink id.

Tests

test/map-link.test.ts: bus group-isolation + unsubscribe; resolver registration + children render; active-class toggle driven via react-dom/client + act (map-source focus rings, card-source ignored, other-id clears); Map accepts id/numbered/group and renders (SSR). Full viewer suite green (496), tsc clean, client bundle builds.

Docs

component.md geo/map recipe gains a "Link pins to cards (MapLink)" section with a Grid(map + linked cards) snippet.

- MapLink component links a card to a Map marker by shared id (+ group):
  hover/click a pin rings its card and scrolls it into view; hover a card
  opens the pin's popup and pans to it.
- Map: markers gain optional id; new group + numbered props (1..N pins).
- map-link.ts: tiny module-level focus pub/sub (no provider wiring), keyed
  by group so independent boards don't cross-talk; each side ignores its own
  source to avoid feedback loops.
- CSS ring for .tc-maplink(:hover/--active); tests (bus isolation, resolver
  registration, active-class toggle via react-dom/client, Map link props);
  component.md recipe.
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.

2 participants