import { useState } from 'react'; import Logo from '../components/Logo.jsx'; import PlatformScene from '../components/PlatformScene.jsx'; import { BRAND, PLATFORM_MAP } from '../data.js'; import { guideHref } from '../guide/nav.js'; // The flow is drawn in a fixed space, x in thousandths of the width and y in pixels, so the curves // meet the nodes without measuring them and the prerendered page already shows them. const FLOW_HEIGHT = 460; const NODE_HEIGHT = 56; const EDGES = { sourceEnd: 260, hubStart: 370, hubEnd: 630, outputStart: 740 }; const nodeCentres = (count, gap) => { const top = (FLOW_HEIGHT - (count * NODE_HEIGHT + (count - 1) * gap)) / 2; return Array.from({ length: count }, (_, i) => top + i * (NODE_HEIGHT + gap) + NODE_HEIGHT / 2); }; // The curves reach the hub in a narrow fan around its middle rather than at a single point. const fan = (index, count, spread) => FLOW_HEIGHT / 2 + (index - (count - 1) / 2) * spread; const inPath = (y, index, count) => { const mid = (EDGES.sourceEnd + EDGES.hubStart) / 2; const end = fan(index, count, 12); return `M${EDGES.sourceEnd} ${y}C${mid} ${y} ${mid} ${end} ${EDGES.hubStart} ${end}`; }; const outPath = (y, index, count) => { const mid = (EDGES.hubEnd + EDGES.outputStart) / 2; const start = fan(index, count, 10); return `M${EDGES.hubEnd} ${start}C${mid} ${start} ${mid} ${y} ${EDGES.outputStart} ${y}`; }; const accentLine = (tokens) => `color-mix(in srgb, ${tokens.accent} 45%, transparent)`; const percent = (thousandths) => `${thousandths / 10}%`; const rowHref = ({ href, guide, anchor }) => { if (!guide) return href; return anchor ? `${guideHref(guide)}#${anchor}` : guideHref(guide); }; function RowLink({ row, style, children, ...events }) { const href = rowHref(row); if (!href) return
{children}
; return {children}; } function FlowNode({ tokens, row, lead, active, onHover, left, width, centre }) { return ( onHover(true)} onMouseLeave={() => onHover(false)} style={{ position: 'absolute', left, width, top: centre - NODE_HEIGHT / 2, height: NODE_HEIGHT, display: 'flex', alignItems: 'center', gap: 12, padding: '0 14px', border: `1px solid ${active ? accentLine(tokens) : tokens.borderStrong}`, borderRadius: 12, background: tokens.panel, transition: 'border-color 0.15s', }} > {lead}
{row.title}
{row.note}
); } function PlatformFlow({ tokens }) { const { sources, core, outputs } = PLATFORM_MAP; const [active, setActive] = useState(null); const hover = (key) => (on) => setActive(on ? key : null); const sourceCentres = nodeCentres(sources.rows.length, 14); const outputCentres = nodeCentres(outputs.rows.length, 10); const pathStyle = (key) => ({ stroke: active === key ? tokens.accent : tokens.textMuted, strokeOpacity: active === key ? 1 : 0.35, strokeWidth: active === key ? 2 : 1.5, transition: 'stroke 0.15s, stroke-opacity 0.15s', }); return (
{sources.rows.map((row, index) => ( {row.chip} )} /> ))}
{BRAND}
    {core.rows.map((row) => (
  • {row.title}
    {row.note}
  • ))}
{outputs.rows.map((row, index) => ( )} /> ))}
); } function Arrow({ tokens }) { return ( ); } function Panel({ tokens, heading, rows, highlight }) { return (

{heading}

); } export default function PlatformMap({ tokens }) { const { title, lede, sources, core, outputs } = PLATFORM_MAP; return (

{title}

{lede}

{BRAND} )} rows={core.rows} highlight />
); }