- New /kepletek/[id] page: chart wheel (SVG), big three, elements, modalities, moon phase, positions and an aspects table. /keplet opens the user's own chart; the home page goes there after login. - The profile only shows the birth data, with a link to the chart. - Saving the same birth data again returns the stored chart (200) instead of calculating a new one. - Charts without a birth time (angles null) render without houses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
134 lines
5.1 KiB
TypeScript
134 lines
5.1 KiB
TypeScript
// Hungarian names and glyphs for the chart pages.
|
||
// Glyphs end in U+FE0E so phones show them as text, not as emoji.
|
||
|
||
export const SIGNS: Record<string, { hu: string; glyph: string }> = {
|
||
aries: { hu: "Kos", glyph: "♈\uFE0E" },
|
||
taurus: { hu: "Bika", glyph: "♉\uFE0E" },
|
||
gemini: { hu: "Ikrek", glyph: "♊\uFE0E" },
|
||
cancer: { hu: "Rák", glyph: "♋\uFE0E" },
|
||
leo: { hu: "Oroszlán", glyph: "♌\uFE0E" },
|
||
virgo: { hu: "Szűz", glyph: "♍\uFE0E" },
|
||
libra: { hu: "Mérleg", glyph: "♎\uFE0E" },
|
||
scorpio: { hu: "Skorpió", glyph: "♏\uFE0E" },
|
||
sagittarius: { hu: "Nyilas", glyph: "♐\uFE0E" },
|
||
capricorn: { hu: "Bak", glyph: "♑\uFE0E" },
|
||
aquarius: { hu: "Vízöntő", glyph: "♒\uFE0E" },
|
||
pisces: { hu: "Halak", glyph: "♓\uFE0E" },
|
||
};
|
||
|
||
export const POINTS: Record<string, { hu: string; glyph: string }> = {
|
||
sun: { hu: "Nap", glyph: "☉\uFE0E" },
|
||
moon: { hu: "Hold", glyph: "☽\uFE0E" },
|
||
mercury: { hu: "Merkúr", glyph: "☿\uFE0E" },
|
||
venus: { hu: "Vénusz", glyph: "♀\uFE0E" },
|
||
mars: { hu: "Mars", glyph: "♂\uFE0E" },
|
||
jupiter: { hu: "Jupiter", glyph: "♃\uFE0E" },
|
||
saturn: { hu: "Szaturnusz", glyph: "♄\uFE0E" },
|
||
uranus: { hu: "Uránusz", glyph: "♅\uFE0E" },
|
||
neptune: { hu: "Neptunusz", glyph: "♆\uFE0E" },
|
||
pluto: { hu: "Plútó", glyph: "♇\uFE0E" },
|
||
north_node: { hu: "Észak-Holdcsomópont", glyph: "☊\uFE0E" },
|
||
south_node: { hu: "Dél-Holdcsomópont", glyph: "☋\uFE0E" },
|
||
lilith: { hu: "Lilith", glyph: "⚸\uFE0E" },
|
||
chiron: { hu: "Kiron", glyph: "⚷\uFE0E" },
|
||
ceres: { hu: "Ceres", glyph: "⚳\uFE0E" },
|
||
pallas: { hu: "Pallas", glyph: "⚴\uFE0E" },
|
||
juno: { hu: "Juno", glyph: "⚵\uFE0E" },
|
||
vesta: { hu: "Vesta", glyph: "⚶\uFE0E" },
|
||
};
|
||
|
||
export const ANGLES: [string, string][] = [
|
||
["ascendant", "Aszcendens"],
|
||
["midheaven", "MC"],
|
||
["descendant", "Descendens"],
|
||
["imum_coeli", "IC"],
|
||
];
|
||
|
||
export function signName(sign: string | null | undefined): string {
|
||
return sign ? (SIGNS[sign]?.hu ?? sign) : "–";
|
||
}
|
||
|
||
/** `12°20'50"` → `12°20′50″` (typographic prime marks). */
|
||
export function dms(text: string): string {
|
||
return text.replace(/'/g, "′").replace(/"/g, "″");
|
||
}
|
||
|
||
export const ROLE_LABELS: Record<string, string> = {
|
||
user: "Felhasználó",
|
||
premium: "Prémium",
|
||
vip: "VIP",
|
||
creator: "Szerző",
|
||
admin: "Admin",
|
||
};
|
||
|
||
const regionNames = new Intl.DisplayNames(["hu"], { type: "region" });
|
||
|
||
/** Hungarian country name from an ISO code (falls back to the given name). */
|
||
export function countryName(iso2: string, fallback?: string): string {
|
||
try {
|
||
return regionNames.of(iso2) ?? fallback ?? iso2;
|
||
} catch {
|
||
return fallback ?? iso2;
|
||
}
|
||
}
|
||
|
||
export function formatDate(iso: string | null | undefined, withTime = false): string {
|
||
if (!iso) return "–";
|
||
const d = new Date(iso);
|
||
return new Intl.DateTimeFormat("hu-HU", {
|
||
year: "numeric",
|
||
month: "long",
|
||
day: "numeric",
|
||
...(withTime ? { hour: "2-digit", minute: "2-digit" } : {}),
|
||
timeZone: "Europe/Budapest",
|
||
}).format(d);
|
||
}
|
||
|
||
/** `1990-03-15` → `1990. március 15.` without time zone shifts. */
|
||
export function formatBirthDate(date: string): string {
|
||
const [y, m, d] = date.split("-").map(Number);
|
||
return new Intl.DateTimeFormat("hu-HU", { year: "numeric", month: "long", day: "numeric", timeZone: "UTC" }).format(
|
||
new Date(Date.UTC(y, m - 1, d)),
|
||
);
|
||
}
|
||
|
||
export const ASPECTS: Record<string, { hu: string; glyph: string; kind: "harmonic" | "tense" | "neutral" }> = {
|
||
conjunction: { hu: "együttállás", glyph: "☌", kind: "neutral" },
|
||
opposition: { hu: "szembenállás", glyph: "☍", kind: "tense" },
|
||
trine: { hu: "trigon", glyph: "△", kind: "harmonic" },
|
||
square: { hu: "kvadrát", glyph: "□", kind: "tense" },
|
||
sextile: { hu: "szextil", glyph: "⚹", kind: "harmonic" },
|
||
quincunx: { hu: "kvinkunx", glyph: "⚻", kind: "tense" },
|
||
semisextile: { hu: "félszextil", glyph: "⚺", kind: "harmonic" },
|
||
semisquare: { hu: "félkvadrát", glyph: "∠", kind: "tense" },
|
||
sesquiquadrate: { hu: "másfélkvadrát", glyph: "⚼", kind: "tense" },
|
||
quintile: { hu: "kvintil", glyph: "Q", kind: "harmonic" },
|
||
biquintile: { hu: "bikvintil", glyph: "bQ", kind: "harmonic" },
|
||
};
|
||
|
||
export const ELEMENTS: Record<string, string> = { fire: "Tűz", earth: "Föld", air: "Levegő", water: "Víz" };
|
||
export const MODALITIES: Record<string, string> = { cardinal: "Kardinális", fixed: "Fix", mutable: "Változó" };
|
||
|
||
export const MOON_PHASES: Record<string, string> = {
|
||
new_moon: "Újhold",
|
||
waxing_crescent: "Növő holdsarló",
|
||
first_quarter: "Első negyed",
|
||
waxing_gibbous: "Növő hold",
|
||
full_moon: "Telihold",
|
||
waning_gibbous: "Fogyó hold",
|
||
last_quarter: "Utolsó negyed",
|
||
waning_crescent: "Fogyó holdsarló",
|
||
};
|
||
|
||
/** Name of a point or angle for labels (`midheaven` → `MC`). */
|
||
export function pointName(id: string): string {
|
||
return POINTS[id]?.hu ?? ANGLES.find(([k]) => k === id)?.[1] ?? id;
|
||
}
|
||
|
||
/** Orb in degrees and minutes: `2.25` → `2°15′`. */
|
||
export function orbText(orb: number): string {
|
||
const d = Math.floor(orb);
|
||
const m = Math.round((orb - d) * 60);
|
||
return m === 60 ? `${d + 1}°00′` : `${d}°${String(m).padStart(2, "0")}′`;
|
||
}
|