// 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}.
setLensId(e.target.value)}
style={{
font: "inherit", fontFamily: "var(--mono)",
fontSize: 12, letterSpacing: "0.08em", textTransform: "uppercase",
padding: "10px 14px",
background: "var(--ink)", color: "var(--bg)", border: "1px solid var(--ink)",
cursor: "pointer",
}}>
{LENSES.map(l => SWITCH LENS · {l.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 => (
setMode(m)} className="mono"
style={{
padding: "6px 12px", fontSize: 11, letterSpacing: "0.06em",
textTransform: "uppercase",
border: "1px solid var(--ink)",
background: mode === m ? "var(--ink)" : "transparent",
color: mode === m ? "var(--bg)" : "var(--ink)",
cursor: "pointer", marginLeft: -1,
}}>{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 (
{ window.__plSelectedState = r.code; go("state"); }}
style={{
display: "grid",
gridTemplateColumns: "44px 220px 1fr 70px 70px",
gap: 18, alignItems: "center",
padding: "12px 10px",
width: "100%",
border: "none", borderBottom: "1px solid var(--rule)",
background: "transparent", color: "inherit",
fontFamily: "inherit", textAlign: "left", cursor: "pointer",
}}>
{String(i+1).padStart(2,"0")}
{r[mode].toFixed(1)}
Δ{r.pressure - r.passed > 0 ? "+" : ""}{(r.pressure - r.passed).toFixed(1)}
);
})}
);
}
function RankList({ title, rows, mode, go, positive }) {
return (
{title}
{rows.map((r, i) => {
const pal = window.PL_COLOR(r[mode]);
return (
{ window.__plSelectedState = r.code; go("state"); }}
style={{
display: "grid", gridTemplateColumns: "16px 1fr auto", gap: 12,
alignItems: "center",
padding: "10px 0",
border: "none", borderBottom: "1px solid var(--rule)",
background: "transparent", color: "inherit",
fontFamily: "inherit", textAlign: "left", cursor: "pointer",
}}>
{r.name}
{r[mode].toFixed(1)}
);
})}
);
}
window.PL_LensPage = LensPage;
}