From 227e8b5b80177f881599f9e95c43a866e5375e23 Mon Sep 17 00:00:00 2001 From: feco Date: Tue, 24 Nov 2026 09:17:48 +0000 Subject: [PATCH] =?UTF-8?q?App=20header:=20gold=20marks,=20a=20"Felfedez?= =?UTF-8?q?=C3=A9s"=20dropdown,=20the=20Moon=20today?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL --- services/frontend/src/app/globals.css | 73 ++++++++++ services/frontend/src/app/layout.tsx | 5 +- .../frontend/src/components/MobileMenu.tsx | 42 ++++-- services/frontend/src/components/MoonChip.tsx | 58 ++++++++ services/frontend/src/components/NavIcon.tsx | 73 ++++++++++ services/frontend/src/components/NavLinks.tsx | 132 +++++++++++++++++- .../frontend/src/components/SiteHeader.tsx | 65 ++++++--- 7 files changed, 413 insertions(+), 35 deletions(-) create mode 100644 services/frontend/src/components/MoonChip.tsx create mode 100644 services/frontend/src/components/NavIcon.tsx diff --git a/services/frontend/src/app/globals.css b/services/frontend/src/app/globals.css index 9d994fa..60cbd83 100644 --- a/services/frontend/src/app/globals.css +++ b/services/frontend/src/app/globals.css @@ -1675,3 +1675,76 @@ span.tarot-fan-card { cursor: default; } .nps-score { min-width: 34px; } } .contact-card p { margin: 0; } + +/* The app header (logged in): a starry band with a gold edge, menu items with + gold marks, the free pages in one dropdown, and the Moon today. */ +.app-header { + background: + radial-gradient(1px 1px at 22% 28%, rgba(236, 230, 216, 0.6), transparent 60%), + radial-gradient(1px 1px at 47% 72%, rgba(236, 230, 216, 0.4), transparent 60%), + radial-gradient(1.5px 1.5px at 66% 20%, rgba(217, 180, 106, 0.7), transparent 60%), + radial-gradient(1px 1px at 83% 70%, rgba(236, 230, 216, 0.45), transparent 60%), + radial-gradient(1px 1px at 95% 30%, rgba(236, 230, 216, 0.5), transparent 60%), + rgba(15, 21, 40, 0.95); + border-bottom-color: transparent; +} +.app-header::after { + content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; pointer-events: none; + background: linear-gradient(90deg, rgba(217, 180, 106, 0), rgba(217, 180, 106, 0.6) 30%, rgba(217, 180, 106, 0.6) 70%, rgba(217, 180, 106, 0)); +} +.nav-icon { width: 17px; height: 17px; flex: none; color: rgba(217, 180, 106, 0.8); fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; } +.nav-icon.sym { width: auto; height: auto; font-size: 17px; line-height: 1; text-align: center; min-width: 17px; } +.nav-icon .nav-icon-fill { fill: currentColor; stroke: none; } +.app-nav { gap: 2px; align-items: center; } +.app-nav > a, .nav-group-button { + display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 11px; + color: var(--ink-2); text-decoration: none; border-radius: 8px 8px 0 0; border-bottom: 2px solid transparent; font-size: 15px; +} +.app-nav > a:hover, .nav-group-button:hover { color: var(--ink); background: rgba(217, 180, 106, 0.06); } +.app-nav > a[aria-current="page"], .nav-group-button.is-active { + color: var(--ink); background: none; border-bottom-color: var(--gold); box-shadow: 0 7px 12px -9px rgba(217, 180, 106, 0.9); +} +.app-nav > a[aria-current="page"] .nav-icon, .nav-group-button.is-active .nav-icon { color: var(--gold); } +.nav-group { position: relative; } +.nav-group-button { background: none; border-top: 0; border-left: 0; border-right: 0; font-family: inherit; cursor: pointer; } +.nav-group-button[aria-expanded="true"] { color: var(--gold); background: rgba(217, 180, 106, 0.1); border-radius: 8px; } +.nav-group-chevron { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; } +.nav-group-button[aria-expanded="true"] .nav-group-chevron { transform: rotate(180deg); } +.nav-dropdown { + position: absolute; left: 0; top: calc(100% + 8px); z-index: 30; width: 340px; padding: 8px; + display: flex; flex-direction: column; gap: 2px; background: var(--panel); border: 1px solid var(--line-2); + border-radius: 14px; box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5); +} +.nav-dropdown-title { padding: 6px 10px 8px; font-size: 11px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; color: var(--gold); } +.nav-dropdown-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px; border-radius: 10px; color: var(--ink); text-decoration: none; } +.nav-dropdown-item:hover, .nav-dropdown-item[aria-current="page"] { background: rgba(255, 255, 255, 0.04); color: var(--gold); } +.nav-dropdown-item .nav-icon { margin-top: 2px; width: 20px; height: 20px; font-size: 19px; color: var(--gold); } +.nav-dropdown-text { display: flex; flex-direction: column; gap: 2px; font-size: 15px; } +.nav-dropdown-text .hint { font-size: 13px; } +.moon-chip { + display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px 0 8px; border-radius: 999px; + background: rgba(217, 180, 106, 0.08); color: var(--ink); text-decoration: none; font-size: 13px; white-space: nowrap; +} +.moon-chip:hover { background: rgba(217, 180, 106, 0.14); color: var(--ink); } +.moon-chip-glyph { color: var(--gold); font-size: 15px; } +.moon-phase-icon { width: 20px; height: 20px; flex: none; } +.moon-phase-icon .moon-dark { fill: #1a2238; stroke: var(--gold); stroke-width: 1; } +.moon-phase-icon .moon-lit { fill: var(--gold); } +@media (max-width: 1760px) { .app-header .who .moon-chip-text { display: none; } .app-header .who .moon-chip { padding: 0 10px 0 8px; } } +/* The grouped ☰ menu of the app. */ +.mobile-menu-panel > .moon-chip { align-self: stretch; min-height: 48px; padding: 0 14px; font-size: 14px; border-radius: 12px; } +.mobile-menu-list { display: flex; flex-direction: column; } +.mobile-menu-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; } +.mobile-menu-grid a { border: 1px solid var(--line); font-size: 15px; } +.mobile-menu-panel a { gap: 12px; } +.mobile-menu-panel a .nav-icon { color: var(--gold); } +.mobile-menu-label { flex: 1; min-width: 0; } +.mobile-menu-note { font-size: 13px; color: var(--gold); white-space: nowrap; } +/* Laptops (1440px): the items closer, so the row still fits next to the account. */ +@media (max-width: 1520px) { + .app-nav > a, .nav-group-button { padding: 10px 7px; gap: 6px; font-size: 14.5px; } + .app-header { gap: 16px; } + .app-header .who { gap: 8px; } +} +/* The ☰ panel covers the page fully (the header's blur showed it through). */ +.mobile-menu-panel { background: #0f1528; } diff --git a/services/frontend/src/app/layout.tsx b/services/frontend/src/app/layout.tsx index 74c41ec..8959ecd 100644 --- a/services/frontend/src/app/layout.tsx +++ b/services/frontend/src/app/layout.tsx @@ -9,6 +9,7 @@ import { SiteFooter } from "@/components/PublicFooter"; import { SiteHeader } from "@/components/SiteHeader"; import { ValidationMessages } from "@/components/ValidationMessages"; import { getMe } from "@/lib/server"; +import { loadSky } from "@/lib/sky"; import { siteUrl } from "@/lib/share"; import "./globals.css"; @@ -31,12 +32,14 @@ export async function generateMetadata(): Promise { export default async function RootLayout({ children }: { children: React.ReactNode }) { const me = await getMe(); + // The Moon today in the header (cached for five minutes). + const sky = me ? await loadSky() : null; return ( - {me && } + {me && } {children} {/* At the very bottom, apart from the page content: up top it drew the eye away. */} {me?.nps_due && } diff --git a/services/frontend/src/components/MobileMenu.tsx b/services/frontend/src/components/MobileMenu.tsx index 50d2c05..2fc0592 100644 --- a/services/frontend/src/components/MobileMenu.tsx +++ b/services/frontend/src/components/MobileMenu.tsx @@ -4,10 +4,14 @@ import Link from "next/link"; import { usePathname } from "next/navigation"; import { useEffect, useId, useRef, useState } from "react"; +import { NavIcon, type NavIconName } from "./NavIcon"; + export interface MenuSection { /** A small heading above the group (e.g. "Ingyenes"). */ title?: string; - links: { href: string; label: string }[]; + /** Two columns of tiles instead of a list. */ + grid?: boolean; + links: { href: string; label: string; icon?: NavIconName; note?: string }[]; } /** @@ -15,7 +19,16 @@ export interface MenuSection { * hidden there, see globals.css). Closes on a click outside, Escape, or * moving to another page. `className` sets the width from which it shows. */ -export function MobileMenu({ sections, className }: { sections: MenuSection[]; className: string }) { +export function MobileMenu({ + sections, + className, + lead, +}: { + sections: MenuSection[]; + className: string; + /** Shown first in the panel (the Moon today). */ + lead?: React.ReactNode; +}) { const [open, setOpen] = useState(false); const box = useRef(null); const button = useRef(null); @@ -61,19 +74,24 @@ export function MobileMenu({ sections, className }: { sections: MenuSection[]; c {open && ( diff --git a/services/frontend/src/components/MoonChip.tsx b/services/frontend/src/components/MoonChip.tsx new file mode 100644 index 0000000..2f7b464 --- /dev/null +++ b/services/frontend/src/components/MoonChip.tsx @@ -0,0 +1,58 @@ +import Link from "next/link"; + +import { SIGNS } from "@/lib/astro"; +import { SIGN_IN, withArticle } from "@/lib/skyText"; +import type { SkyNow } from "@/lib/types"; + +/** The Moon as it is lit now: the lit part on the right while waxing, on the left while waning. */ +export function MoonPhaseIcon({ + illumination, + waxing, +}: { + illumination: number; + waxing: boolean; +}) { + const r = 8.5; + const k = Math.min(1, Math.max(0, illumination)); + const rx = Math.abs(1 - 2 * k) * r; + // The outer edge on the lit side, then the terminator back. + const outer = waxing ? 1 : 0; + const terminator = waxing ? (k > 0.5 ? 1 : 0) : k > 0.5 ? 0 : 1; + const d = `M12 ${12 - r}A${r} ${r} 0 0 ${outer} 12 ${12 + r}A${rx} ${r} 0 0 ${terminator} 12 ${12 - r}Z`; + return ( + + ); +} + +/** + * "Ma: Hold a ♉ Bikában" in the header (the moon calendar behind it). Narrow + * screens show the phase and the sign's glyph only. + */ +export function MoonChip({ sky }: { sky: SkyNow }) { + const moon = sky.moon; + const sign = moon.position.sign; + const where = withArticle(SIGN_IN[sign] ?? sign); + return ( + + + + + + + ); +} diff --git a/services/frontend/src/components/NavIcon.tsx b/services/frontend/src/components/NavIcon.tsx new file mode 100644 index 0000000..a6b4e3e --- /dev/null +++ b/services/frontend/src/components/NavIcon.tsx @@ -0,0 +1,73 @@ +// Small gold marks before the menu items: astrological glyphs where one fits, +// otherwise a line drawing. + +export type NavIconName = + | "chart" + | "persons" + | "compare" + | "tarot" + | "explore" + | "signs" + | "famous" + | "moon" + | "retro" + | "packages" + | "admin"; + +const GLYPHS: Partial> = { + chart: "☉", + persons: "☽", + compare: "☌", + explore: "✧", + signs: "♈", + retro: "☿", +}; + +export function NavIcon({ name }: { name: NavIconName }) { + const glyph = GLYPHS[name]; + if (glyph) { + return ( + + ); + } + return ( + + ); +} diff --git a/services/frontend/src/components/NavLinks.tsx b/services/frontend/src/components/NavLinks.tsx index 27912e4..b6fce54 100644 --- a/services/frontend/src/components/NavLinks.tsx +++ b/services/frontend/src/components/NavLinks.tsx @@ -2,16 +2,136 @@ import Link from "next/link"; import { usePathname } from "next/navigation"; +import { useEffect, useId, useRef, useState } from "react"; -export function NavLinks({ links }: { links: { href: string; label: string }[] }) { +import { NavIcon, type NavIconName } from "./NavIcon"; + +export interface NavItem { + href: string; + label: string; + icon: NavIconName; + /** One line under the label in a dropdown. */ + note?: string; +} + +export interface NavGroup { + label: string; + icon: NavIconName; + /** The dropdown's small heading. */ + title: string; + items: NavItem[]; +} + +const isGroup = (e: NavItem | NavGroup): e is NavGroup => "items" in e; + +/** + * The app's menu row: items with a gold mark, and a group (the free pages) + * that opens on a click as a dropdown. Closes on a click outside, Escape or + * moving to another page. + */ +export function NavLinks({ entries }: { entries: (NavItem | NavGroup)[] }) { const pathname = usePathname(); + const here = (href: string) => pathname.startsWith(href); return ( ); } + +function Dropdown({ + group, + active, + here, +}: { + group: NavGroup; + active: boolean; + here: (href: string) => boolean; +}) { + const [open, setOpen] = useState(false); + const box = useRef(null); + const button = useRef(null); + const id = useId(); + const pathname = usePathname(); + + useEffect(() => setOpen(false), [pathname]); + useEffect(() => { + if (!open) return; + const outside = (e: PointerEvent) => { + if (box.current && !box.current.contains(e.target as Node)) + setOpen(false); + }; + const escape = (e: KeyboardEvent) => { + if (e.key === "Escape") { + setOpen(false); + button.current?.focus(); + } + }; + document.addEventListener("pointerdown", outside); + document.addEventListener("keydown", escape); + return () => { + document.removeEventListener("pointerdown", outside); + document.removeEventListener("keydown", escape); + }; + }, [open]); + + return ( +
+ + {open && ( +
+ {group.title} + {group.items.map((i) => ( + + + + {i.label} + {i.note && {i.note}} + + + ))} +
+ )} +
+ ); +} diff --git a/services/frontend/src/components/SiteHeader.tsx b/services/frontend/src/components/SiteHeader.tsx index 9a3af30..e930af0 100644 --- a/services/frontend/src/components/SiteHeader.tsx +++ b/services/frontend/src/components/SiteHeader.tsx @@ -1,9 +1,10 @@ import Link from "next/link"; -import type { Me } from "@/lib/types"; +import type { Me, SkyNow } from "@/lib/types"; import { MobileMenu } from "./MobileMenu"; -import { NavLinks } from "./NavLinks"; +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. */ @@ -128,23 +129,47 @@ function PackageBadge({ me }: { me: Me }) { ); } -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: "/csillagjegyek", label: "Csillagjegyek" }, - { href: "/hires-emberek", label: "Híres emberek" }, - { href: "/csomagok", label: "Csomagok" }, +/** 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" }, ]; - if (me.user.roles.includes("admin")) links.push({ href: "/admin", label: "Admin" }); - else if (me.user.roles.includes("creator")) links.push({ href: "/admin/hires-emberek", label: "Szerző" }); + 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 ( -
+
- +
+ {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] }, + ]} + />
); }