Files
sorsfonalak/services/frontend/src/app/belepes/page.tsx
T
fecoandClaude Opus 5.5 e789e5a981 Chart page with a drawn wheel; reuse saved charts for identical birth data
- 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
2026-11-16 06:37:59 +00:00

72 lines
2.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type { Metadata } from "next";
import { redirect } from "next/navigation";
import { Logo } from "@/components/SiteHeader";
import { ZodiacWheel } from "@/components/ZodiacWheel";
import { BACKEND_URL, getMe } from "@/lib/server";
import type { PublicConfig } from "@/lib/types";
import { GoogleLogin } from "./GoogleLogin";
export const metadata: Metadata = { title: "Belépés" };
/** Only local paths, so the login cannot redirect to another site. */
function safeTarget(value: string | string[] | undefined): string {
const v = Array.isArray(value) ? value[0] : value;
return v && v.startsWith("/") && !v.startsWith("//") ? v : "/";
}
async function loadConfig(): Promise<PublicConfig | null> {
try {
const res = await fetch(`${BACKEND_URL}/v1/config`, { cache: "no-store" });
return res.ok ? ((await res.json()) as PublicConfig) : null;
} catch {
return null;
}
}
export default async function LoginPage({ searchParams }: { searchParams: Promise<Record<string, string | string[]>> }) {
const target = safeTarget((await searchParams).vissza);
if (await getMe()) redirect(target);
const config = await loadConfig();
const clientId = config?.google_login.enabled ? config.google_login.client_id : null;
return (
<div className="auth">
<aside className="auth-aside">
<Logo />
<ZodiacWheel className="wheel" />
<div className="row" style={{ flexDirection: "column", alignItems: "flex-start", gap: 10, maxWidth: 460 }}>
<p className="tagline">Ahol a csillagok összekötnek.</p>
<p className="muted" style={{ fontSize: 16 }}>
Születési képlet, szinasztria és közösség – egy helyen.
</p>
</div>
</aside>
<main className="auth-main">
<div className="auth-box">
<div className="page-head">
<h1 style={{ fontSize: 44 }}>Belépés</h1>
<p className="muted">Lépj be a Google-fiókoddal. Ha még nincs fiókod, az első belépéskor létrejön.</p>
</div>
{config === null ? (
<p className="msg msg-error" role="alert">
A szerver most nem érhető el. Próbáld újra egy kicsit később.
</p>
) : clientId ? (
<GoogleLogin clientId={clientId} target={target} />
) : (
<p className="msg msg-error" role="alert">
A Google-belépés még nincs beállítva (a backend <code>GOOGLE_CLIENT_IDS</code> változója üres).
</p>
)}
<p className="hint">
A belépéssel elfogadod, hogy a születési adataidat a képleted kiszámításához tároljuk. Bármikor törölheted
őket a profilodban.
</p>
</div>
</main>
</div>
);
}