// Lens Detail — one lens across all 50 states { const { LENSES, STATES, scoreFor } = window.PL_DATA; function LensPage({ go, lensId, setLensId, mapStyle, showLabels }) { const lens = LENSES.find(l => l.id === lensId) || LENSES[0]; const [mode, setMode] = React.useState("passed"); // passed | pressure const rows = STATES.map(s => ({ code: s[0], name: s[1], passed: scoreFor(s[0], lens.id, "passed"), pressure: scoreFor(s[0], lens.id, "pressure"), })).sort((a, b) => b[mode] - a[mode]); const top5 = rows.slice(0, 5); const bottom5 = rows.slice(-5).reverse(); return (
{/* hero band */}
Lens · {lens.group} group · 2025–26 session

{lens.label}.

Higher score = the state moves toward {lens.direction === "expand" ? "expanding access" : "reducing harm"}. Below: 50 states ranked by composite_{mode}, with the rank-jump arrow showing where pressure differs from what passed.

{/* MAP + key insight */}
All 50 · composite_{mode}
{["passed","pressure","all"].map(m => ( ))}
{ window.__plSelectedState = c; go("state"); }} style={mapStyle} showLabels={showLabels} />
The headline

{top5[0].name} leads. {bottom5[0].name} sits at the floor.

{top5[0].name}'s composite_{mode} score on this lens is {top5[0][mode].toFixed(1)}. That's {(top5[0][mode] - bottom5[0][mode]).toFixed(1)} points above {bottom5[0].name}, which sits at {bottom5[0][mode].toFixed(1)}.

{/* Top / bottom stacks */}
{/* FULL STACKED LIST */}

Every state, ranked.

↓ = composite_passed bar   ·   ▮ pressure indicator   ·   click row → state
{rows.map((r, i) => { const pal = window.PL_COLOR(r[mode]); return ( ); })}
); } function RankList({ title, rows, mode, go, positive }) { return (
{title}
{rows.map((r, i) => { const pal = window.PL_COLOR(r[mode]); return ( ); })}
); } window.PL_LensPage = LensPage; }