- Menu items with gold astrological marks (☉ ☽ ☌, card, box); the free pages (signs, famous people, moon calendar, retrogrades) in one "Felfedezés" dropdown with a line about each, opened by a click - A starry header band with a gold edge; the current item has a glowing gold underline - "Ma: Hold a ♉ Bikában" with the Moon's phase drawn as it is lit, to the moon calendar (narrower screens: the phase and the glyph) - The ☰ menu grouped: the Moon today, Saját, Felfedezés · ingyenes as tiles, Csomagok with the package; it covers the page now - Laptops (1440px) keep the row on one line Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
192 lines
6.9 KiB
TypeScript
192 lines
6.9 KiB
TypeScript
import Link from "next/link";
|
||
|
||
import type { Me, SkyNow } from "@/lib/types";
|
||
|
||
import { MobileMenu } from "./MobileMenu";
|
||
import { MoonChip } from "./MoonChip";
|
||
import { type NavGroup, type NavItem, 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" | "hires" | "holdnaptar" | "retrograd";
|
||
}) {
|
||
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>
|
||
<Link href="/hires-emberek" aria-current={here("hires")}>
|
||
Híres emberek
|
||
</Link>
|
||
</nav>
|
||
<Link href="/belepes" className="btn btn-sm">
|
||
Belépés
|
||
</Link>
|
||
<MobileMenu
|
||
className="mobile-menu-public"
|
||
sections={[
|
||
{
|
||
links: [
|
||
{ href: `${home}#elemzes`, label: "Elemzés" },
|
||
{ href: `${home}#elorejelzes`, label: "Előrejelzés" },
|
||
{ href: `${home}#osszevetes`, label: "Összevetés" },
|
||
{ href: "/pelda", label: "Példa" },
|
||
],
|
||
},
|
||
{
|
||
title: "Ingyenes",
|
||
links: [
|
||
{ href: "/szuletesi-horoszkop", label: "Születési horoszkóp" },
|
||
{ href: "/csillagjegyek", label: "Csillagjegyek" },
|
||
{ href: "/hires-emberek", label: "Híres emberek" },
|
||
{ href: "/holdnaptar", label: "Holdnaptár" },
|
||
{ href: "/retrograd", label: "Retrográd bolygók" },
|
||
],
|
||
},
|
||
]}
|
||
/>
|
||
</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>
|
||
);
|
||
}
|
||
|
||
/** The free pages: in the menu row one dropdown, in the ☰ menu a group of tiles. */
|
||
const EXPLORE: NavItem[] = [
|
||
{ href: "/csillagjegyek", label: "Csillagjegyek", icon: "signs", note: "A tizenkét jegy jellemzése" },
|
||
{ href: "/hires-emberek", label: "Híres emberek", icon: "famous", note: "Ismert emberek képlete és elemzése" },
|
||
{ href: "/holdnaptar", label: "Holdnaptár", icon: "moon", note: "Holdfázisok, fogyatkozások, holdjegyek" },
|
||
{ href: "/retrograd", label: "Retrográd bolygók", icon: "retro", note: "Mikor retrográd a Merkúr és a többi" },
|
||
];
|
||
|
||
/**
|
||
* The header of the logged-in app: the menu with gold marks (the free pages
|
||
* in one "Felfedezés" dropdown), the Moon today, the package and the account.
|
||
* Below 1380px the menu moves behind ☰, grouped.
|
||
*/
|
||
export function SiteHeader({ me, sky }: { me: Me; sky?: SkyNow | null }) {
|
||
const own: NavItem[] = [
|
||
{ href: "/keplet", label: "Képletem", icon: "chart" },
|
||
{ href: "/szemelyek", label: "Személyek", icon: "persons" },
|
||
{ href: "/osszevetesek", label: "Összevetések", icon: "compare" },
|
||
{ href: "/kartyajoslas", label: "Kártyajóslás", icon: "tarot" },
|
||
];
|
||
const packages: NavItem = { href: "/csomagok", label: "Csomagok", icon: "packages" };
|
||
const team: NavItem[] = me.user.roles.includes("admin")
|
||
? [{ href: "/admin", label: "Admin", icon: "admin" }]
|
||
: me.user.roles.includes("creator")
|
||
? [{ href: "/admin/hires-emberek", label: "Szerző", icon: "admin" }]
|
||
: [];
|
||
const entries: (NavItem | NavGroup)[] = [
|
||
...own,
|
||
{ label: "Felfedezés", icon: "explore", title: "Ingyenes, mindenkinek", items: EXPLORE },
|
||
packages,
|
||
...team,
|
||
];
|
||
const { natal, synastry } = me.analyses_left;
|
||
const left = natal + synastry;
|
||
const packageNote = me.package ? `${me.package.name} · ${left} elemzés` : left > 0 ? `${left} elemzés` : undefined;
|
||
return (
|
||
<header className="site-header app-header">
|
||
<Logo />
|
||
<NavLinks entries={entries} />
|
||
<div className="who">
|
||
{sky && <MoonChip sky={sky} />}
|
||
<PackageBadge me={me} />
|
||
<UserMenu
|
||
name={me.user.display_name || me.user.email}
|
||
invoices={me.invoice_count > 0}
|
||
replies={me.feedback_replies_unseen ?? 0}
|
||
/>
|
||
</div>
|
||
<MobileMenu
|
||
className="mobile-menu-app"
|
||
lead={sky ? <MoonChip sky={sky} /> : undefined}
|
||
sections={[
|
||
{ title: "Saját", links: own },
|
||
{ title: "Felfedezés · ingyenes", grid: true, links: EXPLORE.map(({ note: _note, ...l }) => l) },
|
||
{ links: [{ ...packages, note: packageNote }, ...team] },
|
||
]}
|
||
/>
|
||
</header>
|
||
);
|
||
}
|