Main #1

Merged
sagifer merged 5 commits from main into prod 2026-11-17 08:04:10 +01:00
4 changed files with 152 additions and 43 deletions
Showing only changes of commit 163612e527 - Show all commits
@@ -6,6 +6,35 @@ import { useCallback, useEffect, useRef, useState } from "react";
import { api, errorText } from "@/lib/api"; import { api, errorText } from "@/lib/api";
/** Google's "G" mark (branding guidelines: unmodified, on the left of the label). */
function GoogleMark() {
return (
<svg width="20" height="20" viewBox="0 0 48 48" aria-hidden="true">
<path
fill="#EA4335"
d="M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z"
/>
<path
fill="#4285F4"
d="M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z"
/>
<path
fill="#FBBC05"
d="M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z"
/>
<path
fill="#34A853"
d="M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z"
/>
</svg>
);
}
/**
* "Continue with Google" in the site's own button style. Google's real
* (rendered, invisible) button lies on top of it and receives the click, so
* the sign-in still returns an ID token.
*/
export function GoogleLogin({ clientId, target }: { clientId: string; target: string }) { export function GoogleLogin({ clientId, target }: { clientId: string; target: string }) {
const router = useRouter(); const router = useRouter();
const slot = useRef<HTMLDivElement>(null); const slot = useRef<HTMLDivElement>(null);
@@ -34,7 +63,7 @@ export function GoogleLogin({ clientId, target }: { clientId: string; target: st
if (!ready || !google || !slot.current) return; if (!ready || !google || !slot.current) return;
google.accounts.id.initialize({ client_id: clientId, callback: onCredential, ux_mode: "popup", itp_support: true }); google.accounts.id.initialize({ client_id: clientId, callback: onCredential, ux_mode: "popup", itp_support: true });
google.accounts.id.renderButton(slot.current, { google.accounts.id.renderButton(slot.current, {
theme: "filled_black", theme: "outline",
size: "large", size: "large",
text: "continue_with", text: "continue_with",
shape: "rectangular", shape: "rectangular",
@@ -51,8 +80,15 @@ export function GoogleLogin({ clientId, target }: { clientId: string; target: st
onReady={() => setReady(true)} onReady={() => setReady(true)}
onError={() => setError("Nem sikerült betölteni a Google-belépést. Ellenőrizd a hálózatot vagy a reklámblokkolót.")} onError={() => setError("Nem sikerült betölteni a Google-belépést. Ellenőrizd a hálózatot vagy a reklámblokkolót.")}
/> />
<div ref={slot} className="gsi-slot" aria-busy={busy} /> <div className="social-login" data-ready={ready} aria-busy={busy}>
{busy && <p className="msg muted">Belépés…</p>} <span className="btn-social" aria-hidden="true">
<span className="btn-social-icon">
<GoogleMark />
</span>
{busy ? "Belépés…" : "Folytatás Google-fiókkal"}
</span>
<div ref={slot} className="gsi-overlay" />
</div>
{error && ( {error && (
<p className="msg msg-error" role="alert"> <p className="msg msg-error" role="alert">
{error} {error}
+2 -1
View File
@@ -47,7 +47,7 @@ export default async function LoginPage({ searchParams }: { searchParams: Promis
<div className="auth-box"> <div className="auth-box">
<div className="page-head"> <div className="page-head">
<h1 style={{ fontSize: 44 }}>Belépés</h1> <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> <p className="muted">Üdv újra! Lépj be a fiókodba.</p>
</div> </div>
{config === null ? ( {config === null ? (
<p className="msg msg-error" role="alert"> <p className="msg msg-error" role="alert">
@@ -60,6 +60,7 @@ export default async function LoginPage({ searchParams }: { searchParams: Promis
A Google-belépés még nincs beállítva (a backend <code>GOOGLE_CLIENT_IDS</code> változója üres). A Google-belépés még nincs beállítva (a backend <code>GOOGLE_CLIENT_IDS</code> változója üres).
</p> </p>
)} )}
<p className="auth-foot">Még nincs fiókod? Az első belépéskor létrejön.</p>
<p className="hint"> <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 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. őket a profilodban.
+21 -3
View File
@@ -143,9 +143,27 @@ td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
} }
.auth-main { flex: 1 1 480px; display: flex; align-items: center; justify-content: center; padding: 48px 24px; } .auth-main { flex: 1 1 480px; display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.auth-box { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 28px; } .auth-box { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 28px; }
.wheel { width: min(380px, 80%); aspect-ratio: 1; margin: 0 auto; } .wheel { width: min(440px, 80%); aspect-ratio: 1; margin: 0 auto; }
.tagline { font-family: var(--font-display); font-size: 36px; font-weight: 600; line-height: 1.1; } .tagline { font-family: var(--font-display); font-size: 38px; font-weight: 600; line-height: 1.1; }
.gsi-slot { min-height: 44px; display: flex; justify-content: center; } .auth-foot { font-size: 15px; color: var(--muted); text-align: center; }
/* Social login buttons; Google's own button lies invisibly on top (.gsi-overlay). */
.social-login { position: relative; }
.btn-social {
position: relative; width: 100%; min-height: 48px; padding: 0 52px;
display: flex; align-items: center; justify-content: center; gap: 12px;
border: 1px solid var(--line-2); border-radius: var(--radius); background: transparent;
color: var(--ink); font: 500 15px var(--font-body);
}
.btn-social-icon { position: absolute; left: 16px; top: 50%; margin-top: -10px; width: 20px; height: 20px; display: flex; }
.social-login:hover .btn-social { border-color: #5a6790; background: rgba(255, 255, 255, 0.03); }
.social-login:focus-within .btn-social { outline: 2px solid var(--gold); outline-offset: 2px; }
.social-login[data-ready="false"] .btn-social { opacity: 0.6; }
.gsi-overlay {
position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
opacity: 0.001; overflow: hidden; cursor: pointer;
}
.gsi-overlay > div, .gsi-overlay iframe { transform: scale(1.06, 1.2); }
/* Detailed analysis */ /* Detailed analysis */
.analysis-card { gap: 14px; } .analysis-card { gap: 14px; }
@@ -1,36 +1,74 @@
// Decorative zodiac wheel for the login page (pure SVG, no data needed). // Decorative chart wheel for the login page (pure SVG, sample sky from the design canvas).
const GLYPHS = ["♈", "♉", "♊", "♋", "♌", "♍", "♎", "♏", "♐", "♑", "♒", "♓"]; const SIGNS = ["♈", "♉", "♊", "♋", "♌", "♍", "♎", "♏", "♐", "♑", "♒", "♓"];
// A few planets of a sample sky, for the aspect lines in the middle. const ASC = 182.73;
const SAMPLE = [12, 75, 131, 200, 247, 302, 338]; const PLANETS: [string, number][] = [
["☉", 53.61],
["☽", 204.02],
["☿", 46.72],
["♀", 62.71],
["♂", 334.49],
["♃", 311.71],
["♄", 80.06],
["♅", 199.7],
["♆", 246.42],
["♇", 181.88],
];
// angle, orb, colour, dash (conjunctions are not drawn)
const ASPECTS: [number, number, string, string | undefined][] = [
[0, 7, "", undefined],
[60, 5, "#7fb0ff", "1.2 1"],
[90, 6, "#f08a4b", undefined],
[120, 6, "#7fb0ff", undefined],
[180, 7, "#f08a4b", "1.8 1"],
];
const VS = "︎"; // text presentation, not emoji
function point(deg: number, r: number) { const norm = (a: number) => ((a % 360) + 360) % 360;
const t = ((180 - deg) * Math.PI) / 180;
function point(lon: number, r: number) {
const t = ((180 + lon - ASC) * Math.PI) / 180;
return { x: 50 + r * Math.cos(t), y: 50 - r * Math.sin(t) }; return { x: 50 + r * Math.cos(t), y: 50 - r * Math.sin(t) };
} }
export function ZodiacWheel({ className }: { className?: string }) { /** Glyph positions pushed at least 12° apart. */
const lines: { a: number; b: number; hard: boolean }[] = []; function spread(): { g: string; lon: number; at: number }[] {
SAMPLE.forEach((a, i) => const out = PLANETS.map(([g, lon]) => ({ g, lon, at: lon })).sort((a, b) => a.at - b.at);
SAMPLE.slice(i + 1).forEach((b) => { for (let it = 0; it < 14; it++) {
let d = Math.abs(a - b) % 360; for (let k = 0; k < out.length; k++) {
const a = out[k];
const b = out[(k + 1) % out.length];
const gap = norm(b.at - a.at);
if (gap < 12) {
a.at -= (12 - gap) / 2;
b.at += (12 - gap) / 2;
}
}
}
return out;
}
function aspectLines() {
const lines: { a: number; b: number; color: string; dash?: string }[] = [];
PLANETS.forEach(([, a], i) =>
PLANETS.slice(i + 1).forEach(([, b]) => {
let d = Math.abs(norm(a) - norm(b));
if (d > 180) d = 360 - d; if (d > 180) d = 360 - d;
if (Math.abs(d - 120) < 8 || Math.abs(d - 60) < 6) lines.push({ a, b, hard: false }); const hit = ASPECTS.find(([angle, orb]) => Math.abs(d - angle) <= orb);
else if (Math.abs(d - 90) < 7 || Math.abs(d - 180) < 8) lines.push({ a, b, hard: true }); if (hit && hit[0] > 0) lines.push({ a, b, color: hit[2], dash: hit[3] });
}), }),
); );
return lines;
}
export function ZodiacWheel({ className }: { className?: string }) {
return ( return (
<svg className={className} viewBox="0 0 100 100" aria-hidden="true"> <svg className={className} viewBox="0 0 100 100" aria-hidden="true">
<circle cx="50" cy="50" r="49" fill="none" stroke="#2c3654" strokeWidth="0.5" /> <circle cx="50" cy="50" r="49.6" fill="none" stroke="#2c3654" strokeWidth="0.35" />
<circle cx="50" cy="50" r="38" fill="none" stroke="#2c3654" strokeWidth="0.35" /> <circle cx="50" cy="50" r="36" fill="none" stroke="#2c3654" strokeWidth="0.25" />
<circle cx="50" cy="50" r="24" fill="#0f1426" stroke="#263049" strokeWidth="0.35" /> <circle cx="50" cy="50" r="16" fill="#0f1426" stroke="#263049" strokeWidth="0.25" />
{GLYPHS.map((_, i) => { {SIGNS.map((g, i) => {
const a = point(i * 30, 38); const p = point(i * 30 + 15, 43);
const b = point(i * 30, 49);
return <line key={`d${i}`} x1={a.x} y1={a.y} x2={b.x} y2={b.y} stroke="#263049" strokeWidth="0.35" />;
})}
{GLYPHS.map((g, i) => {
const p = point(i * 30 + 15, 43.5);
return ( return (
<text <text
key={g} key={g}
@@ -38,18 +76,17 @@ export function ZodiacWheel({ className }: { className?: string }) {
y={p.y} y={p.y}
textAnchor="middle" textAnchor="middle"
dominantBaseline="central" dominantBaseline="central"
fontSize="5" fontSize="6.5"
fill={i % 3 === 0 ? "#d9b46a" : "#5a6790"} fill={i % 3 === 0 ? "#d9b46a" : "#5a6790"}
style={{ fontFamily: "var(--font-symbols)" }} style={{ fontFamily: "var(--font-symbols)" }}
> >
{g} {g + VS}
{"︎"}
</text> </text>
); );
})} })}
{lines.map(({ a, b, hard }) => { {aspectLines().map(({ a, b, color, dash }) => {
const p = point(a, 24); const p = point(a, 16);
const q = point(b, 24); const q = point(b, 16);
return ( return (
<line <line
key={`${a}-${b}`} key={`${a}-${b}`}
@@ -57,16 +94,33 @@ export function ZodiacWheel({ className }: { className?: string }) {
y1={p.y} y1={p.y}
x2={q.x} x2={q.x}
y2={q.y} y2={q.y}
stroke={hard ? "#f08a4b" : "#7fb0ff"} stroke={color}
strokeWidth="0.4" strokeWidth="0.32"
strokeDasharray={hard ? undefined : "1.4 0.8"} strokeDasharray={dash}
opacity="0.8" opacity="0.85"
/> />
); );
})} })}
{SAMPLE.map((d) => { {spread().map(({ g, lon, at }) => {
const p = point(d, 24); const t1 = point(lon, 16);
return <circle key={d} cx={p.x} cy={p.y} r="0.9" fill="#ece6d8" />; const t2 = point(lon, 19.5);
const p = point(at, 26.5);
return (
<g key={g}>
<line x1={t1.x} y1={t1.y} x2={t2.x} y2={t2.y} stroke="#ece6d8" strokeWidth="0.35" opacity="0.9" />
<text
x={p.x}
y={p.y}
textAnchor="middle"
dominantBaseline="central"
fontSize="5"
fill="#ece6d8"
style={{ fontFamily: "var(--font-symbols)" }}
>
{g + VS}
</text>
</g>
);
})} })}
</svg> </svg>
); );