| Fényszög | -Orbisz | -- Közeledő vagy távolodó - | -
|---|---|---|
| - {" "} - {pointName(a.point1)}{" "} - - {" "} - {info?.hu ?? a.aspect} - {" "} - {" "} - {pointName(a.point2)} - | -{orbText(a.orb)} | -- {a.applying === true ? "közeledő" : a.applying === false ? "távolodó" : ""} - | -
Születési idő nélkül a házak, a tengelyek és az Aszcendens nem számolhatók; a Hold helyzete a nap folyamán akár @@ -290,3 +235,53 @@ export function ChartTables({ chart }: { chart: Chart }) { ); } + +/** Every aspect with its orb and whether it is applying, closest first. */ +export function AspectList({ chart }: { chart: Chart }) { + const aspects = [...(chart.chart.aspects ?? [])].sort((a, b) => a.orb - b.orb); + if (aspects.length === 0) return
Nincs fényszög.
; + return ( +| Fényszög | +Orbisz | ++ Közeledő vagy távolodó + | +
|---|---|---|
| + {" "} + {pointName(a.point1)}{" "} + + {" "} + {info?.hu ?? a.aspect} + {" "} + {" "} + {pointName(a.point2)} + | +{orbText(a.orb)} | ++ {a.applying === true ? "közeledő" : a.applying === false ? "távolodó" : ""} + | +
diff --git a/services/frontend/src/components/Tabs.tsx b/services/frontend/src/components/Tabs.tsx new file mode 100644 index 0000000..f8976f5 --- /dev/null +++ b/services/frontend/src/components/Tabs.tsx @@ -0,0 +1,73 @@ +"use client"; + +import { type KeyboardEvent, type ReactNode, useEffect, useRef, useState } from "react"; + +export type Tab = { id: string; label: string; content: ReactNode }; + +/** + * Tabs with the chosen one kept in the URL hash (#matrix), so a reload or a + * shared link opens the same tab. Hidden panels stay mounted: a running + * analysis keeps polling while another tab is open. + */ +export function Tabs({ tabs, label }: { tabs: Tab[]; label: string }) { + const [active, setActive] = useState(tabs[0]?.id); + const buttons = useRef<(HTMLButtonElement | null)[]>([]); + + useEffect(() => { + const fromHash = window.location.hash.slice(1); + if (tabs.some((t) => t.id === fromHash)) setActive(fromHash); + }, [tabs]); + + function choose(id: string) { + setActive(id); + history.replaceState(null, "", `#${id}`); + } + + function onKey(e: KeyboardEvent, i: number) { + const step = e.key === "ArrowRight" ? 1 : e.key === "ArrowLeft" ? -1 : 0; + const to = e.key === "Home" ? 0 : e.key === "End" ? tabs.length - 1 : step ? (i + step + tabs.length) % tabs.length : -1; + if (to < 0) return; + e.preventDefault(); + choose(tabs[to].id); + buttons.current[to]?.focus(); + } + + return ( +