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,83 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
|
||||
import { countryName, formatBirthDate } from "@/lib/astro";
|
||||
import type { BirthData } from "@/lib/types";
|
||||
|
||||
import { BirthForm } from "./BirthForm";
|
||||
|
||||
export interface SavedBirth {
|
||||
birth: BirthData;
|
||||
placeName: string | null;
|
||||
region: string | null;
|
||||
countryCode: string | null;
|
||||
zone: string;
|
||||
utcOffset: string;
|
||||
dst: boolean;
|
||||
}
|
||||
|
||||
/** Shows the saved birth data (and the chart tables), or the form to enter or correct it. */
|
||||
export function BirthEditor({ chart, children }: { chart: SavedBirth | null; children: React.ReactNode }) {
|
||||
const [editing, setEditing] = useState(chart === null);
|
||||
|
||||
if (editing || !chart) {
|
||||
return (
|
||||
<div className="field" style={{ gap: 16 }}>
|
||||
{chart ? (
|
||||
<p className="muted">
|
||||
A javított adatokból új képlet készül, és az lesz a saját képleted. A régit a meglévő összevetések miatt
|
||||
megtartjuk.
|
||||
</p>
|
||||
) : (
|
||||
<p className="muted">
|
||||
Add meg a születésed adatait. Ebből számoljuk a képletedet; a helyi időt és az akkori időzónát (nyári
|
||||
időszámítást) a születési hely alapján magunk határozzuk meg.
|
||||
</p>
|
||||
)}
|
||||
<BirthForm
|
||||
initial={chart ? { ...chart.birth, placeName: chart.placeName, region: chart.region } : null}
|
||||
onCancel={chart ? () => setEditing(false) : undefined}
|
||||
onSaved={() => setEditing(false)}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const { birth } = chart;
|
||||
const country = chart.countryCode ?? birth.country;
|
||||
return (
|
||||
<div className="field" style={{ gap: 24 }}>
|
||||
<div className="card-head" style={{ alignItems: "flex-start" }}>
|
||||
<dl className="facts">
|
||||
<dt>Dátum</dt>
|
||||
<dd>{formatBirthDate(birth.date)}</dd>
|
||||
<dt>Időpont</dt>
|
||||
<dd>
|
||||
{birth.time ? (
|
||||
<>
|
||||
{birth.time.slice(0, 5)}{" "}
|
||||
<span className="muted">
|
||||
({chart.zone}, UTC{chart.utcOffset}
|
||||
{chart.dst ? ", nyári idő" : ""})
|
||||
</span>
|
||||
</>
|
||||
) : (
|
||||
<span className="muted">ismeretlen</span>
|
||||
)}
|
||||
</dd>
|
||||
<dt>Hely</dt>
|
||||
<dd>
|
||||
{chart.placeName ?? birth.place ?? "–"}
|
||||
{chart.region && <span className="muted">, {chart.region}</span>}
|
||||
{country && <span className="muted">, {countryName(country)}</span>}
|
||||
</dd>
|
||||
</dl>
|
||||
<button type="button" className="btn" onClick={() => setEditing(true)}>
|
||||
Adatok javítása
|
||||
</button>
|
||||
</div>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user