Files
sorsfonalak/services/frontend/src/components/SiteHeader.tsx
T
fecoandClaude Opus 5.5 985b1e872d
CI / test (push) Successful in 1m44s
CI / build (push) Successful in 5m37s
CI / deploy (push) Skipped
Free birth chart instead of the sign calculator; free tools in the header
/szuletesi-horoszkop (was /aszcendens-kalkulator) shows the whole natal
chart without an account: the wheel, Sun/Moon/Ascendant with links to
the sign pages, the positions, houses, aspect grid and aspect list, the
same views as the chart pages but without the AI parts. A calculation
only, nothing saved, still 30 an hour per address (POST /v1/public/chart).
The typed birth data are offered on the profile after sign-up.

The visitors' header gets a separate 'Ingyenes' group (birth chart,
signs) next to the paid sections, on phones in its own row; the home
page links them under the hero buttons and in an 'Ingyenes' band.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
2026-11-21 20:54:57 +00:00

124 lines
3.9 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 Link from "next/link";
import type { Me } from "@/lib/types";
import { NavLinks } from "./NavLinks";
import { UserMenu } from "./UserMenu";
/** The mark: the orbit, the thread (an S, with the crossbar an f) and a star on the rim. */
export function LogoMark({ className = "logo-mark" }: { className?: string }) {
return (
<svg className={className} viewBox="0 0 64 64" aria-hidden="true">
<g fill="none" stroke="currentColor" strokeWidth="4.5" strokeLinecap="round">
<circle cx="32" cy="32" r="23" />
<path d="M10 46 C 24 45, 29 23, 44 18" />
<path d="M18 33.5 L36 33.5" strokeWidth="4.2" />
</g>
<path d="M49 6 L51.8 13.2 L59 16 L51.8 18.8 L49 26 L46.2 18.8 L39 16 L46.2 13.2 Z" className="logo-star" />
</svg>
);
}
export function Logo() {
return (
<Link href="/" className="logo" aria-label="Sorsfonalak – főoldal">
<LogoMark />
<span className="logo-word">
sors<span>fonalak</span>
</span>
</Link>
);
}
/**
* The header for visitors (not logged in): the home page sections and the
* example, then, set apart, the free tools, and the login. `onHome`: the
* section links stay on the page.
*/
export function PublicHeader({
onHome = false,
current,
}: {
onHome?: boolean;
current?: "pelda" | "horoszkop" | "csillagjegyek";
}) {
const home = onHome ? "" : "/";
const here = (page: typeof current) => (current === page ? "page" : undefined);
return (
<header className="site-header lp-header">
<Logo />
<nav className="nav lp-nav" aria-label="Fő navigáció">
<a href={`${home}#elemzes`}>Elemzés</a>
<a href={`${home}#elorejelzes`}>Előrejelzés</a>
<a href={`${home}#osszevetes`}>Összevetés</a>
<Link href="/pelda" aria-current={here("pelda")}>
Példa
</Link>
</nav>
<nav className="lp-free" aria-label="Ingyenes, belépés nélkül">
<span className="lp-free-label">Ingyenes</span>
<Link href="/szuletesi-horoszkop" aria-current={here("horoszkop")}>
Születési horoszkóp
</Link>
<Link href="/csillagjegyek" aria-current={here("csillagjegyek")}>
Csillagjegyek
</Link>
</nav>
<Link href="/belepes" className="btn btn-sm">
Belépés
</Link>
</header>
);
}
/** The user's package and what is left of it; leads to the packages page. */
function PackageBadge({ me }: { me: Me }) {
const { natal, synastry } = me.analyses_left;
const left = natal + synastry;
let name: string;
let detail: string | null;
if (me.package) {
name = me.package.name;
detail = left > 0 ? `${left} elemzés` : "elfogyott";
} else if (left > 0) {
name = `${left} elemzés`;
detail = null;
} else {
return null;
}
const units = `Képletelemzés: ${natal}, kapcsolati elemzés: ${synastry}`;
const empty = left === 0;
return (
<Link
href="/csomagok"
className={empty ? "pkg-pill pkg-pill-empty" : "pkg-pill"}
title={units}
aria-label={`Csomagod: ${name}${detail ? `, ${detail}` : ""}. ${units}.`}
>
<span className="pkg-pill-name">{name}</span>
{detail && <span className="pkg-pill-detail">{detail}</span>}
</Link>
);
}
export function SiteHeader({ me }: { me: Me }) {
const links = [
{ href: "/keplet", label: "Képletem" },
{ href: "/szemelyek", label: "Személyek" },
{ href: "/osszevetesek", label: "Összevetések" },
{ href: "/kartyajoslas", label: "Kártyajóslás" },
{ href: "/csomagok", label: "Csomagok" },
];
if (me.user.roles.includes("admin")) links.push({ href: "/admin", label: "Admin" });
return (
<header className="site-header">
<Logo />
<NavLinks links={links} />
<div className="who">
<PackageBadge me={me} />
<UserMenu name={me.user.display_name || me.user.email} invoices={me.invoice_count > 0} />
</div>
</header>
);
}