Aspect grid: the usual triangular matrix, values in collapsible details #2

Merged
sagifer merged 1 commits from main into prod 2026-11-17 10:51:21 +01:00
2 changed files with 141 additions and 42 deletions
Showing only changes of commit 90fd87ab4a - Show all commits
+22
View File
@@ -220,6 +220,28 @@ td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.legend-square { background: var(--square); } .legend-square { background: var(--square); }
.legend-opposition { background: var(--tense); } .legend-opposition { background: var(--tense); }
.aspect-tag { white-space: nowrap; } .aspect-tag { white-space: nowrap; }
/* Aspect grid */
.aspect-grid-wrap { overflow-x: auto; }
.aspect-grid { width: auto; border-collapse: collapse; font-size: 16px; }
.aspect-grid td, .aspect-grid th {
width: 30px; min-width: 30px; height: 30px; padding: 0; text-align: center; vertical-align: middle;
border: 1px solid var(--line); line-height: 1;
}
.aspect-grid th { color: var(--ink); font-weight: 400; font-size: 17px; background: var(--panel-2); }
.aspect-grid .grid-angle { font: 600 11px var(--font-body); color: var(--gold); letter-spacing: 0.3px; }
.asp-conjunction { color: var(--gold); }
.asp-trine, .asp-sextile { color: var(--harmonic); }
.asp-square { color: var(--square); }
.asp-opposition { color: var(--tense); }
.details > summary { cursor: pointer; color: var(--gold); min-height: 44px; display: flex; align-items: center; }
.details[open] > summary { margin-bottom: 8px; }
@media (max-width: 640px) {
.aspect-grid { font-size: 13px; }
.aspect-grid td, .aspect-grid th { width: 23px; min-width: 23px; height: 23px; }
.aspect-grid th { font-size: 14px; }
.aspect-grid .grid-angle { font-size: 9px; }
}
.aspect-harmonic { color: var(--harmonic); } .aspect-harmonic { color: var(--harmonic); }
.aspect-tense { color: var(--tense); } .aspect-tense { color: var(--tense); }
.aspect-neutral { color: var(--gold); } .aspect-neutral { color: var(--gold); }
+119 -42
View File
@@ -1,5 +1,5 @@
import { ANGLES, ASPECTS, POINTS, SIGNS, dms, orbText, pointName, signName } from "@/lib/astro"; import { ANGLES, ASPECTS, POINTS, SIGNS, dms, orbText, pointName, signName } from "@/lib/astro";
import type { Chart, Position } from "@/lib/types"; import type { Aspect, Chart, Position } from "@/lib/types";
function Pos({ p }: { p: Position }) { function Pos({ p }: { p: Position }) {
return ( return (
@@ -46,6 +46,77 @@ export function BigThree({ chart }: { chart: Chart }) {
); );
} }
// Rows and columns of the aspect grid: the points drawn on the wheel, then the angles.
const GRID_POINTS = [
"sun",
"moon",
"mercury",
"venus",
"mars",
"jupiter",
"saturn",
"uranus",
"neptune",
"pluto",
"north_node",
"lilith",
"chiron",
];
const GRID_ANGLES: [string, string][] = [
["ascendant", "AC"],
["midheaven", "MC"],
];
/** The usual triangular aspect grid: only the aspect symbols, the values are in the details below. */
function AspectGrid({ chart }: { chart: Chart }) {
const result = chart.chart;
const present = new Set(result.points.map((p) => p.id));
const rows: [string, string][] = GRID_POINTS.filter((id) => present.has(id)).map((id) => [
id,
POINTS[id]?.glyph ?? id,
]);
if (chart.highlights.time_known) {
for (const [key, label] of GRID_ANGLES) if (result.angles?.[key]) rows.push([key, label]);
}
const byPair = new Map<string, Aspect>();
for (const a of result.aspects ?? []) {
byPair.set(`${a.point1}|${a.point2}`, a);
byPair.set(`${a.point2}|${a.point1}`, a);
}
return (
<div className="aspect-grid-wrap">
<table className="aspect-grid" aria-label="Fényszögmátrix">
<tbody>
{rows.map(([id, label], i) => (
<tr key={id}>
{rows.slice(0, i).map(([other]) => {
const a = byPair.get(`${id}|${other}`);
const info = a ? ASPECTS[a.aspect] : undefined;
const text = a ? `${pointName(other)} ${info?.hu ?? a.aspect} ${pointName(id)}` : undefined;
return (
<td key={other} title={text}>
{a && (
<span className={`sym asp asp-${a.aspect}`} aria-label={text} role="img">
{info?.glyph ?? "?"}
</span>
)}
</td>
);
})}
<th scope="row" title={pointName(id)}>
<span className={label.length > 2 ? "sym" : "grid-angle"} aria-label={pointName(id)} role="img">
{label}
</span>
</th>
</tr>
))}
</tbody>
</table>
</div>
);
}
/** Positions, angles, house cusps and aspects of a natal chart. */ /** Positions, angles, house cusps and aspects of a natal chart. */
export function ChartTables({ chart }: { chart: Chart }) { export function ChartTables({ chart }: { chart: Chart }) {
const result = chart.chart; const result = chart.chart;
@@ -140,48 +211,54 @@ export function ChartTables({ chart }: { chart: Chart }) {
)} )}
</div> </div>
{aspects.length > 0 && ( {aspects.length > 0 && (
<div className="table-wrap"> <div className="field" style={{ gap: 12 }}>
<h3 style={{ marginBottom: 8 }}>Fényszögek</h3> <h3>Fényszögek</h3>
<table> <AspectGrid chart={chart} />
<thead> <details className="details">
<tr> <summary>Részletek: orbisz, közeledő vagy távolodó</summary>
<th scope="col">Fényszög</th> <div className="table-wrap">
<th scope="col">Orbisz</th> <table>
<th scope="col"> <thead>
<span className="sr-only">Közeledő vagy távolodó</span> <tr>
</th> <th scope="col">Fényszög</th>
</tr> <th scope="col">Orbisz</th>
</thead> <th scope="col">
<tbody> <span className="sr-only">Közeledő vagy távolodó</span>
{aspects.map((a) => { </th>
const info = ASPECTS[a.aspect];
return (
<tr key={`${a.point1}-${a.point2}-${a.aspect}`}>
<td>
<span className="sym" aria-hidden="true">
{POINTS[a.point1]?.glyph}
</span>{" "}
{pointName(a.point1)}{" "}
<span className={`aspect-tag aspect-${info?.kind ?? "neutral"}`}>
<span className="sym" aria-hidden="true">
{info?.glyph}
</span>{" "}
{info?.hu ?? a.aspect}
</span>{" "}
<span className="sym" aria-hidden="true">
{POINTS[a.point2]?.glyph}
</span>{" "}
{pointName(a.point2)}
</td>
<td className="num">{orbText(a.orb)}</td>
<td className="muted" style={{ fontSize: 13 }}>
{a.applying === true ? "közeledő" : a.applying === false ? "távolodó" : ""}
</td>
</tr> </tr>
); </thead>
})} <tbody>
</tbody> {aspects.map((a) => {
</table> const info = ASPECTS[a.aspect];
return (
<tr key={`${a.point1}-${a.point2}-${a.aspect}`}>
<td>
<span className="sym" aria-hidden="true">
{POINTS[a.point1]?.glyph}
</span>{" "}
{pointName(a.point1)}{" "}
<span className={`aspect-tag aspect-${info?.kind ?? "neutral"}`}>
<span className="sym" aria-hidden="true">
{info?.glyph}
</span>{" "}
{info?.hu ?? a.aspect}
</span>{" "}
<span className="sym" aria-hidden="true">
{POINTS[a.point2]?.glyph}
</span>{" "}
{pointName(a.point2)}
</td>
<td className="num">{orbText(a.orb)}</td>
<td className="muted" style={{ fontSize: 13 }}>
{a.applying === true ? "közeledő" : a.applying === false ? "távolodó" : ""}
</td>
</tr>
);
})}
</tbody>
</table>
</div>
</details>
</div> </div>
)} )}
{!timeKnown && ( {!timeKnown && (