Start the Next.js frontend: Google login, profile, birth data, admin
services/frontend (Next.js 16, App Router) runs on port 3001 in compose. The browser only talks to the frontend: /api/v1/* is proxied to the backend, so the session cookie lives on the frontend's host, and /api/geo/* exposes the country list and place search of the horoscope-api. - /belepes: Google Identity Services button, client id from /v1/config - /profil: account facts, display name and language, own birth data with place search, DST ambiguity prompt and the chart's positions - /admin: user search, role toggles, credit grants (admins only, 404 otherwise) Services now tolerate migrations newer than their binary, so they can be rebuilt one at a time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
// Hungarian names and glyphs for the chart tables.
|
||||
|
||||
export const SIGNS: Record<string, { hu: string; glyph: string }> = {
|
||||
aries: { hu: "Kos", glyph: "♈" },
|
||||
taurus: { hu: "Bika", glyph: "♉" },
|
||||
gemini: { hu: "Ikrek", glyph: "♊" },
|
||||
cancer: { hu: "Rák", glyph: "♋" },
|
||||
leo: { hu: "Oroszlán", glyph: "♌" },
|
||||
virgo: { hu: "Szűz", glyph: "♍" },
|
||||
libra: { hu: "Mérleg", glyph: "♎" },
|
||||
scorpio: { hu: "Skorpió", glyph: "♏" },
|
||||
sagittarius: { hu: "Nyilas", glyph: "♐" },
|
||||
capricorn: { hu: "Bak", glyph: "♑" },
|
||||
aquarius: { hu: "Vízöntő", glyph: "♒" },
|
||||
pisces: { hu: "Halak", glyph: "♓" },
|
||||
};
|
||||
|
||||
export const POINTS: Record<string, { hu: string; glyph: string }> = {
|
||||
sun: { hu: "Nap", glyph: "☉" },
|
||||
moon: { hu: "Hold", glyph: "☽" },
|
||||
mercury: { hu: "Merkúr", glyph: "☿" },
|
||||
venus: { hu: "Vénusz", glyph: "♀" },
|
||||
mars: { hu: "Mars", glyph: "♂" },
|
||||
jupiter: { hu: "Jupiter", glyph: "♃" },
|
||||
saturn: { hu: "Szaturnusz", glyph: "♄" },
|
||||
uranus: { hu: "Uránusz", glyph: "♅" },
|
||||
neptune: { hu: "Neptunusz", glyph: "♆" },
|
||||
pluto: { hu: "Plútó", glyph: "♇" },
|
||||
north_node: { hu: "Észak-Holdcsomópont", glyph: "☊" },
|
||||
south_node: { hu: "Dél-Holdcsomópont", glyph: "☋" },
|
||||
lilith: { hu: "Lilith", glyph: "⚸" },
|
||||
chiron: { hu: "Kiron", glyph: "⚷" },
|
||||
ceres: { hu: "Ceres", glyph: "⚳" },
|
||||
pallas: { hu: "Pallas", glyph: "⚴" },
|
||||
juno: { hu: "Juno", glyph: "⚵" },
|
||||
vesta: { hu: "Vesta", glyph: "⚶" },
|
||||
};
|
||||
|
||||
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)),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user