SPB Git

Repository Public

OrbitalDiagram.tsx 4.9 KB 118 lines tsx

1/**2 * =============================================================================3 *                  SP BOUCHER | SOFTWARE & RESEARCH4 *             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project          : agentilab-web8 * File             : components/marketing/OrbitalDiagram.tsx9 * Module           : User Interface10 * Repository       : https://git.spboucher.ai/agentilab-web11 * Project Website  : Not specified12 * Created          : 2026-12-0513 * Last Modified    : 2026-12-0514 *15 * Author           : Simon-Pierre Boucher16 * Position         : Professor of Finance17 * Institution      : Université du Québec en Outaouais (UQO)18 * Organization     : SP Boucher19 * Website          : https://spboucher.ai20 * Git              : https://git.spboucher.ai21 *22 * Preferred Contact: contact@spboucher.ai23 * Development      : dev@spboucher.ai24 * Support          : support@spboucher.ai25 * Security/Admin   : admin@spboucher.ai26 *27 * Copyright (c) 202628 * Simon-Pierre Boucher29 * All rights reserved where applicable. This file is governed by the30 * applicable project license, copyright notices and relevant law.31 * Existing third-party rights and notices remain unaffected.32 *33 * License          : Proprietary34 *35 * Do not embed credentials, private keys, access tokens,36 * certificates or confidential personal information.37 *38 * =============================================================================39 * END OF SP BOUCHER SOURCE HEADER40 * =============================================================================41 */4243interface OrbitalDiagramProps {44  kaLabel: string;45  kaSub: string;46  orixLabel: string;47  orixSub: string;48  kaCount: number;49  orixCount: number;50}5152const C = 260;53const polar = (r: number, deg: number): [number, number] => {54  const a = (deg * Math.PI) / 180;55  return [Math.round((C + r * Math.cos(a)) * 10) / 10, Math.round((C + r * Math.sin(a)) * 10) / 10];56};5758/**59 * Diagramme orbital du portefeuille : la société au centre, ses deux marques60 * en orbite, chacune entourée de ses produits. Purement décoratif (aria-hidden) ;61 * la légende visible sous la figure en donne l’équivalent textuel.62 */63export function OrbitalDiagram({ kaLabel, kaSub, orixLabel, orixSub, kaCount, orixCount }: OrbitalDiagramProps) {64  const [kx, ky] = polar(168, -38);65  const [ox, oy] = polar(168, 148);66  const ring = (count: number, r: number) =>67    Array.from({ length: count }, (_, i) => {68      const a = (i / count) * 2 * Math.PI - Math.PI / 2;69      return [Math.round(r * Math.cos(a) * 10) / 10, Math.round(r * Math.sin(a) * 10) / 10] as const;70    });71  return (72    <svg viewBox="0 0 520 520" aria-hidden="true" focusable="false">73      <circle className="orbit__ring" cx={C} cy={C} r="96" />74      <circle className="orbit__ring orbit__ring--dash" cx={C} cy={C} r="168" />75      <circle className="orbit__ring" cx={C} cy={C} r="236" />76      {[20, 80, 140, 200, 260, 320].map((deg) => {77        const [x, y] = polar(236, deg);78        return <circle key={deg} className="orbit__dot" cx={x} cy={y} r="3" />;79      })}80      <line className="orbit__link" x1={C} y1={C} x2={kx} y2={ky} />81      <line className="orbit__link" x1={C} y1={C} x2={ox} y2={oy} />8283      <circle className="orbit__core" cx={C} cy={C} r="44" />84      <g transform={`translate(${C - 24} ${C - 25}) scale(1.5)`} fill="none" strokeLinecap="round" strokeLinejoin="round">85        <path d="M6.5 26 16 5.5 25.5 26" stroke="var(--background)" strokeWidth="2.6" />86        <path d="M3.5 21.5C9 14.2 21 13.4 27.6 18.4" stroke="var(--accent-solid)" strokeWidth="2.2" />87        <circle cx="27.6" cy="18.4" r="2.6" fill="var(--accent-solid)" stroke="none" />88      </g>8990      <g transform={`translate(${kx} ${ky})`}>91        <circle className="orbit__ring" r="48" />92        <g className="orbit__sat">93          {ring(kaCount, 48).map(([x, y], i) => (94            <circle key={i} className={i === 0 ? 'orbit__dot orbit__dot--accent' : 'orbit__dot'} cx={x} cy={y} r={i === 0 ? 6 : 4.5} />95          ))}96        </g>97        <circle className="orbit__node" r="27" />98        <text className="orbit__label" textAnchor="middle" y="5">Ka</text>99        <text className="orbit__label" textAnchor="middle" y="76">{kaLabel}</text>100        <text className="orbit__sub" textAnchor="middle" y="92">{kaSub}</text>101      </g>102103      <g transform={`translate(${ox} ${oy})`}>104        <circle className="orbit__ring" r="48" />105        <g className="orbit__sat">106          {ring(orixCount, 48).map(([x, y], i) => (107            <circle key={i} className="orbit__dot" cx={x} cy={y} r="2.6" />108          ))}109        </g>110        <circle className="orbit__node" r="27" />111        <text className="orbit__label" textAnchor="middle" y="5" fontSize="12">ORIX</text>112        <text className="orbit__label" textAnchor="middle" y="76">{orixLabel}</text>113        <text className="orbit__sub" textAnchor="middle" y="92">{orixSub}</text>114      </g>115    </svg>116  );117}118
Files main
Menu

Theme