v2.0.1: el dibujo del flujo con el acabado «cintura» (degradados, barras finas, nudo fino)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L5npnUYgSPkAaHkdaeUqBr
This commit is contained in:
2026-10-26 09:57:15 +01:00
co-authored by Claude Opus 5.5
parent c6e731b528
commit 1f66dc3932
5 changed files with 28 additions and 12 deletions
+12 -5
View File
@@ -45,6 +45,8 @@
// porqué de cada marca sale abierta, y con el dibujo plegado se ven igual
// las filas que llevan marcas.
const [verLista, setVerLista] = useState(isMobile);
// Ids propios para los degradados: puede haber más de un dibujo en pantalla.
const uid = "flujo" + (React.useId ? React.useId() : "").replace(/[^a-zA-Z0-9]/g, "");
const caja = useRef(null);
const [ancho, setAncho] = useState(null);
useEffect(() => {
@@ -89,7 +91,7 @@
<React.Fragment key={q}>
{q > 0 && <tspan fill={C.t3}> · </tspan>}
{p.letra && <tspan fill={C.purple} fontWeight="700">{p.letra} </tspan>}
<tspan fill={col(p.tono)} fontWeight={p.negrita || p.marca ? 700 : 400}>{p.t}</tspan>
<tspan fill={col(p.tono)} fontWeight={p.negrita ? 700 : 400} fontStyle={p.marca ? "italic" : undefined}>{p.t}</tspan>
</React.Fragment>))}
</tspan>))}
</text>
@@ -122,18 +124,23 @@
{g.simulada&&<div style={{marginBottom:8,fontSize:"0.6rem",fontFamily:C.mono,color:C.amber,fontWeight:700,letterSpacing:"0.08em"}}>SIMULACIÓN · no es una transacción real; el cambio y la comisión son estimados</div>}
<div ref={caja} style={{width:"100%"}}>
<svg role="img" aria-label={g.aria} width={g.ancho} height={g.alto} viewBox={`0 0 ${g.ancho} ${g.alto}`} style={{display:"block",maxWidth:"100%",overflow:"visible"}}>
{/* v2.0.0: franjas en degradado, del gris de las entradas al color de cada salida. */}
<defs>
<linearGradient id={`${uid}-in`} x1="0" x2="1"><stop offset="0" stopColor={C.t2} stopOpacity="0.10"/><stop offset="1" stopColor={C.t2} stopOpacity="0.24"/></linearGradient>
{derecha.map((f,k)=><linearGradient key={k} id={`${uid}-o${k}`} x1="0" x2="1"><stop offset="0" stopColor={C.t2} stopOpacity="0.10"/><stop offset="1" stopColor={tonoFila(f)} stopOpacity={f.grupo?0.25:0.45}/></linearGradient>)}
</defs>
<text x={g.columnas.xIn + 10} y={11} textAnchor="end" fontFamily={C.mono} fontSize={9} fill={C.t2} letterSpacing="0.1em">{g.coinbase?"MINADO":"ENTRADAS"}</text>
<text x={g.columnas.xOut} y={11} textAnchor="start" fontFamily={C.mono} fontSize={9} fill={C.t2} letterSpacing="0.1em">SALIDAS</text>
{g.entradas.map((f,k)=><path key={"bi"+k} d={f.banda} fill={C.t2} fillOpacity={0.22}/>)}
{g.entradas.map((f,k)=><path key={"bi"+k} d={f.banda} fill={`url(#${uid}-in)`}/>)}
{derecha.map((f,k)=>f.lado==="comision"
? <path key={"bo"+k} d={f.banda} fill={C.t3} fillOpacity={0.25} stroke={C.t3} strokeWidth={0.8} strokeDasharray="3 2"/>
: <path key={"bo"+k} d={f.banda} fill={tonoFila(f)} fillOpacity={f.grupo?0.18:0.3}/>)}
: <path key={"bo"+k} d={f.banda} fill={`url(#${uid}-o${k})`}/>)}
{g.enlaces.map((e,k)=><path key={"en"+k} d={e.d} fill="none" stroke={C.amber} strokeWidth={1.6} strokeDasharray="5 3"/>)}
<rect x={g.nudo.x} y={g.nudo.y} width={g.nudo.ancho} height={Math.max(2,g.nudo.alto)} rx={2} fill={C.purple}/>
<rect x={g.nudo.x} y={g.nudo.y-4} width={g.nudo.ancho} height={Math.max(2,g.nudo.alto)+8} rx={1} fill={C.purple} fillOpacity={0.9}/>
{[...g.entradas, ...derecha].map((f,k)=>(
<g key={"f"+k}>
<title>{titulo(f)}</title>
<rect x={f.x} y={f.y} width={f.ancho} height={f.alto} rx={1.5} fill={f.lado==="entrada"&&!f.coinbase?(f.marcas.some(m=>m.id==="tuya")?C.green:f.grupo?C.t3:C.t2):f.coinbase?C.amber:tonoFila(f)}/>
<rect x={f.x} y={f.y} width={f.ancho} height={f.alto} rx={f.ancho/2} fill={f.lado==="entrada"&&!f.coinbase?(f.marcas.some(m=>m.id==="tuya")?C.green:f.grupo?C.t3:C.t2):f.coinbase?C.amber:tonoFila(f)}/>
{etiqueta(f,k)}
</g>))}
</svg>