From 96b96c3e6c94c2f986a35652786cde439209aaed Mon Sep 17 00:00:00 2001 From: Zaldimmar Date: Tue, 6 Oct 2026 04:31:19 -0500 Subject: [PATCH] Group map: state hover, state subheadings, entry cards, scroll on click only Hovering a tile outlines that state in ink while its region stays lit. The list groups each region's groups under their state's subheading, each entry a raised card, and leaves out the region's list of states (its map note stays). The list no longer follows hover; clicking a state jumps to its subheading (or its region when it has no groups), and clicking a legend region to that region. Co-Authored-By: Claude Opus 5.5 --- src/pages/sections/OrgList-Map.tsx | 208 +++++++++++++++-------------- 1 file changed, 111 insertions(+), 97 deletions(-) diff --git a/src/pages/sections/OrgList-Map.tsx b/src/pages/sections/OrgList-Map.tsx index 0f5bdeb..02badc8 100644 --- a/src/pages/sections/OrgList-Map.tsx +++ b/src/pages/sections/OrgList-Map.tsx @@ -1,5 +1,5 @@ import { CaretRight, MagnifyingGlass, X } from '@phosphor-icons/react'; -import { Fragment, useEffect, useMemo, useRef, useState } from "react"; +import { Fragment, useMemo, useRef, useState } from "react"; import { useCommunity } from "../../lib/useCommunity.ts"; import { useOrganization } from "../../lib/useContent.ts"; import { Link } from "react-router-dom"; @@ -157,6 +157,7 @@ function Tile({ count = 0, selected, hovered, + hoveredArea, setSelected, setHovered, onPick, @@ -168,19 +169,23 @@ function Tile({ const ids = slices.map(s => s.regionId); const active = ids.includes(selected) || ids.includes(hovered); const dimmed = selected && !ids.includes(selected); + // The state under the pointer, outlined in ink over its region's + // color, so both read at once. + const here = hoveredArea === code; const clipId = `clip-${code}`; // Solid, never see-through: a tile with no groups, or one dimmed // while another region is picked, is its color mixed toward the // page's rather than faded, so the backdrop doesn't show through. - const strength = dimmed ? (count ? 35 : 15) : count ? 100 : active ? 50 : 28; + const strength = dimmed ? (count ? 35 : 15) : count ? 100 : here ? 70 : active ? 50 : 28; const tileFill = (color: string) => `color-mix(in srgb, ${color} ${strength}%, var(--color-surface))`; // Clicking a shared tile cycles through its regions and then // clears, so every slice is reachable without a second control. const cycle = () => { - onPick?.(code); const at = ids.indexOf(selected); - setSelected(at === ids.length - 1 ? null : ids[at + 1]); + const next = at === ids.length - 1 ? null : ids[at + 1]; + onPick?.(code, next); + setSelected(next); }; const name = `${AREA_NAMES[code] || code}: ${slices.map(s => s.name).join(" / ")}${ @@ -193,14 +198,14 @@ function Tile({ return ( setHovered(primary.regionId)} + onMouseEnter={() => setHovered(primary.regionId, code)} onMouseLeave={() => setHovered(null)} {...(count ? { role: "button", tabIndex: 0, "aria-label": name, - onFocus: () => setHovered(primary.regionId), + onFocus: () => setHovered(primary.regionId, code), onBlur: () => setHovered(null), onKeyDown: (e) => { if (e.key !== "Enter" && e.key !== " ") return; @@ -241,9 +246,9 @@ function Tile({ width={width} height={size} fill="none" - stroke={active ? colorOf(primary) : "var(--color-surface)"} - strokeOpacity={active ? 1 : 0.55} - strokeWidth={active ? 4 : 2} + stroke={here ? "var(--color-ink)" : active ? colorOf(primary) : "var(--color-surface)"} + strokeOpacity={active || here ? 1 : 0.55} + strokeWidth={here ? 6 : active ? 4 : 2} className="transition-all duration-200" /> @@ -304,11 +309,14 @@ function RegionMap({ slices, groupCounts, ...props }: any) { ); } -function LegendButton({ region, selected, setSelected, hovered, setHovered }) { +function LegendButton({ region, selected, setSelected, hovered, setHovered, onPickRegion }) { const on = selected === region.id || hovered === region.id; return (