Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
26c5bb2746 | ||
|
|
2997a06474 |
@@ -145,6 +145,14 @@ export function Landing({ inviteOnly }: { inviteOnly: boolean }) {
|
|||||||
</span>
|
</span>
|
||||||
<span className="lp-free-go">Megnézem →</span>
|
<span className="lp-free-go">Megnézem →</span>
|
||||||
</Link>
|
</Link>
|
||||||
|
<Link href="/hires-emberek" className="card lp-free-card">
|
||||||
|
<strong>Híres emberek horoszkópja</strong>
|
||||||
|
<span className="muted">
|
||||||
|
Ismert emberek születési képlete és részletes asztrológiai portréja: mit árul el róluk a születésük
|
||||||
|
pillanatának égboltja?
|
||||||
|
</span>
|
||||||
|
<span className="lp-free-go">Megnézem →</span>
|
||||||
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useEffect, useState } from "react";
|
import { useCallback, useEffect, useState } from "react";
|
||||||
|
|
||||||
import { BirthForm } from "@/app/profil/BirthForm";
|
import { BirthForm } from "@/app/profil/BirthForm";
|
||||||
import { api, errorText } from "@/lib/api";
|
import { api, errorText } from "@/lib/api";
|
||||||
@@ -24,11 +24,19 @@ export function AdminCelebrities() {
|
|||||||
const [adding, setAdding] = useState(false);
|
const [adding, setAdding] = useState(false);
|
||||||
const [subtitle, setSubtitle] = useState("");
|
const [subtitle, setSubtitle] = useState("");
|
||||||
|
|
||||||
useEffect(() => {
|
const load = useCallback(() => {
|
||||||
api<{ celebrities: AdminCelebrityRow[] }>("/admin/celebrities")
|
api<{ celebrities: AdminCelebrityRow[] }>("/admin/celebrities")
|
||||||
.then((r) => setRows(r.celebrities))
|
.then((r) => setRows(r.celebrities))
|
||||||
.catch((e) => setError(errorText(e)));
|
.catch((e) => setError(errorText(e)));
|
||||||
}, []);
|
}, []);
|
||||||
|
useEffect(load, [load]);
|
||||||
|
// A portrait being written: look again now and then.
|
||||||
|
const writing = rows?.some((c) => c.analysis_status === "pending" || c.analysis_status === "running");
|
||||||
|
useEffect(() => {
|
||||||
|
if (!writing) return;
|
||||||
|
const t = setInterval(load, 10_000);
|
||||||
|
return () => clearInterval(t);
|
||||||
|
}, [writing, load]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="field" style={{ gap: 18 }}>
|
<section className="field" style={{ gap: 18 }}>
|
||||||
|
|||||||
@@ -1249,3 +1249,55 @@ span.tarot-fan-card { cursor: default; }
|
|||||||
.celeb-tile { padding: 10px; }
|
.celeb-tile { padding: 10px; }
|
||||||
.celeb-tile strong { font-size: 19px; }
|
.celeb-tile strong { font-size: 19px; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The ☰ menu: instead of the header's link rows where they no longer fit
|
||||||
|
on one line (logged out below 1240px; logged in below 1380px, with more
|
||||||
|
links and the package). */
|
||||||
|
.mobile-menu { display: none; margin-left: auto; }
|
||||||
|
.mobile-menu-button {
|
||||||
|
display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
|
||||||
|
background: none; border: 1px solid var(--line-2); border-radius: 10px; color: var(--ink); cursor: pointer;
|
||||||
|
}
|
||||||
|
.mobile-menu-button:hover, .mobile-menu-button[aria-expanded="true"] { color: var(--gold); border-color: #5a6790; }
|
||||||
|
.mobile-menu-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
|
||||||
|
.mobile-menu-panel {
|
||||||
|
position: absolute; top: 100%; left: 0; right: 0; z-index: 20;
|
||||||
|
display: flex; flex-direction: column; gap: 6px; padding: 10px 16px 16px;
|
||||||
|
background: rgba(13, 18, 32, 0.98); border-bottom: 1px solid var(--line); box-shadow: 0 16px 32px rgba(0, 0, 0, 0.45);
|
||||||
|
max-height: calc(100vh - 70px); overflow-y: auto;
|
||||||
|
}
|
||||||
|
.mobile-menu-group { display: flex; flex-direction: column; }
|
||||||
|
.mobile-menu-group + .mobile-menu-group { border-top: 1px solid var(--line); padding-top: 10px; }
|
||||||
|
.mobile-menu-group .lp-free-label { align-self: flex-start; margin: 2px 0 6px 12px; }
|
||||||
|
.mobile-menu-panel a { color: var(--ink-2); text-decoration: none; padding: 12px; border-radius: 8px; font-size: 17px; min-height: 44px; display: flex; align-items: center; }
|
||||||
|
.mobile-menu-panel a:hover, .mobile-menu-panel a[aria-current="page"] { color: var(--gold); background: rgba(217, 180, 106, 0.08); }
|
||||||
|
@media (max-width: 1240px) {
|
||||||
|
.mobile-menu-public { display: block; }
|
||||||
|
.lp-header .lp-nav, .lp-header .lp-free { display: none; }
|
||||||
|
.lp-header > .btn { margin-left: auto; }
|
||||||
|
.lp-header > .btn + .mobile-menu { margin-left: 0; }
|
||||||
|
}
|
||||||
|
@media (max-width: 1500px) {
|
||||||
|
.site-header .pkg-pill-detail { display: none; }
|
||||||
|
}
|
||||||
|
@media (max-width: 1380px) {
|
||||||
|
.mobile-menu-app { display: block; }
|
||||||
|
.site-header .app-nav { display: none; }
|
||||||
|
.site-header .who { margin-left: auto; }
|
||||||
|
.site-header .who + .mobile-menu { margin-left: 0; }
|
||||||
|
}
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
/* Logo, account and ☰ on one line: the name only as an icon. */
|
||||||
|
.site-header { flex-wrap: nowrap; }
|
||||||
|
.site-header .who { flex-wrap: nowrap; gap: 8px; min-width: 0; }
|
||||||
|
.site-header .who-name-text, .site-header .pkg-pill-detail { display: none; }
|
||||||
|
.site-header .who-name { padding: 0 10px; }
|
||||||
|
}
|
||||||
|
@media (max-width: 460px) {
|
||||||
|
/* No room for the package next to the account and ☰ (the menu has Csomagok). */
|
||||||
|
.site-header .pkg-pill { display: none; }
|
||||||
|
}
|
||||||
|
@media (max-width: 380px) {
|
||||||
|
.site-header { gap: 8px; padding-left: 12px; padding-right: 12px; }
|
||||||
|
.logo { font-size: 22px; }
|
||||||
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export default async function CelebritiesPage() {
|
|||||||
const [people, me] = await Promise.all([loadCelebrities(), getMe()]);
|
const [people, me] = await Promise.all([loadCelebrities(), getMe()]);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{!me && <PublicHeader />}
|
{!me && <PublicHeader current="hires" />}
|
||||||
<main className="page" style={{ maxWidth: 1080 }}>
|
<main className="page" style={{ maxWidth: 1080 }}>
|
||||||
<div className="page-head">
|
<div className="page-head">
|
||||||
<span className="eyebrow">Híres emberek</span>
|
<span className="eyebrow">Híres emberek</span>
|
||||||
|
|||||||
@@ -0,0 +1,83 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import Link from "next/link";
|
||||||
|
import { usePathname } from "next/navigation";
|
||||||
|
import { useEffect, useId, useRef, useState } from "react";
|
||||||
|
|
||||||
|
export interface MenuSection {
|
||||||
|
/** A small heading above the group (e.g. "Ingyenes"). */
|
||||||
|
title?: string;
|
||||||
|
links: { href: string; label: string }[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The menu behind the ☰ button on narrow screens (the header's link rows are
|
||||||
|
* 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 }) {
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
const box = useRef<HTMLDivElement>(null);
|
||||||
|
const button = useRef<HTMLButtonElement>(null);
|
||||||
|
const panelId = 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]);
|
||||||
|
|
||||||
|
const current = (href: string) => !href.includes("#") && pathname.startsWith(href);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={`mobile-menu ${className}`} ref={box}>
|
||||||
|
<button
|
||||||
|
ref={button}
|
||||||
|
type="button"
|
||||||
|
className="mobile-menu-button"
|
||||||
|
aria-expanded={open}
|
||||||
|
aria-controls={panelId}
|
||||||
|
aria-label={open ? "Menü bezárása" : "Menü"}
|
||||||
|
onClick={() => setOpen((o) => !o)}
|
||||||
|
>
|
||||||
|
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||||
|
{open ? <path d="M6 6l12 12M18 6L6 18" /> : <path d="M4 7h16M4 12h16M4 17h16" />}
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
{open && (
|
||||||
|
<nav id={panelId} className="mobile-menu-panel" aria-label="Menü">
|
||||||
|
{sections.map((s, i) => (
|
||||||
|
<div key={i} className="mobile-menu-group">
|
||||||
|
{s.title && <span className="lp-free-label">{s.title}</span>}
|
||||||
|
{s.links.map((l) => (
|
||||||
|
<Link
|
||||||
|
key={l.href}
|
||||||
|
href={l.href}
|
||||||
|
aria-current={current(l.href) ? "page" : undefined}
|
||||||
|
onClick={() => setOpen(false)}
|
||||||
|
>
|
||||||
|
{l.label}
|
||||||
|
</Link>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</nav>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@ import { usePathname } from "next/navigation";
|
|||||||
export function NavLinks({ links }: { links: { href: string; label: string }[] }) {
|
export function NavLinks({ links }: { links: { href: string; label: string }[] }) {
|
||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
return (
|
return (
|
||||||
<nav className="nav" aria-label="Fő navigáció">
|
<nav className="nav app-nav" aria-label="Fő navigáció">
|
||||||
{links.map((l) => (
|
{links.map((l) => (
|
||||||
<Link key={l.href} href={l.href} aria-current={pathname.startsWith(l.href) ? "page" : undefined}>
|
<Link key={l.href} href={l.href} aria-current={pathname.startsWith(l.href) ? "page" : undefined}>
|
||||||
{l.label}
|
{l.label}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import Link from "next/link";
|
|||||||
|
|
||||||
import type { Me } from "@/lib/types";
|
import type { Me } from "@/lib/types";
|
||||||
|
|
||||||
|
import { MobileMenu } from "./MobileMenu";
|
||||||
import { NavLinks } from "./NavLinks";
|
import { NavLinks } from "./NavLinks";
|
||||||
import { UserMenu } from "./UserMenu";
|
import { UserMenu } from "./UserMenu";
|
||||||
|
|
||||||
@@ -40,7 +41,7 @@ export function PublicHeader({
|
|||||||
current,
|
current,
|
||||||
}: {
|
}: {
|
||||||
onHome?: boolean;
|
onHome?: boolean;
|
||||||
current?: "pelda" | "horoszkop" | "csillagjegyek";
|
current?: "pelda" | "horoszkop" | "csillagjegyek" | "hires";
|
||||||
}) {
|
}) {
|
||||||
const home = onHome ? "" : "/";
|
const home = onHome ? "" : "/";
|
||||||
const here = (page: typeof current) => (current === page ? "page" : undefined);
|
const here = (page: typeof current) => (current === page ? "page" : undefined);
|
||||||
@@ -63,10 +64,34 @@ export function PublicHeader({
|
|||||||
<Link href="/csillagjegyek" aria-current={here("csillagjegyek")}>
|
<Link href="/csillagjegyek" aria-current={here("csillagjegyek")}>
|
||||||
Csillagjegyek
|
Csillagjegyek
|
||||||
</Link>
|
</Link>
|
||||||
|
<Link href="/hires-emberek" aria-current={here("hires")}>
|
||||||
|
Híres emberek
|
||||||
|
</Link>
|
||||||
</nav>
|
</nav>
|
||||||
<Link href="/belepes" className="btn btn-sm">
|
<Link href="/belepes" className="btn btn-sm">
|
||||||
Belépés
|
Belépés
|
||||||
</Link>
|
</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" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
</header>
|
</header>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -108,6 +133,7 @@ export function SiteHeader({ me }: { me: Me }) {
|
|||||||
{ href: "/osszevetesek", label: "Összevetések" },
|
{ href: "/osszevetesek", label: "Összevetések" },
|
||||||
{ href: "/kartyajoslas", label: "Kártyajóslás" },
|
{ href: "/kartyajoslas", label: "Kártyajóslás" },
|
||||||
{ href: "/csillagjegyek", label: "Csillagjegyek" },
|
{ href: "/csillagjegyek", label: "Csillagjegyek" },
|
||||||
|
{ href: "/hires-emberek", label: "Híres emberek" },
|
||||||
{ href: "/csomagok", label: "Csomagok" },
|
{ href: "/csomagok", label: "Csomagok" },
|
||||||
];
|
];
|
||||||
if (me.user.roles.includes("admin")) links.push({ href: "/admin", label: "Admin" });
|
if (me.user.roles.includes("admin")) links.push({ href: "/admin", label: "Admin" });
|
||||||
@@ -119,6 +145,7 @@ export function SiteHeader({ me }: { me: Me }) {
|
|||||||
<PackageBadge me={me} />
|
<PackageBadge me={me} />
|
||||||
<UserMenu name={me.user.display_name || me.user.email} invoices={me.invoice_count > 0} />
|
<UserMenu name={me.user.display_name || me.user.email} invoices={me.invoice_count > 0} />
|
||||||
</div>
|
</div>
|
||||||
|
<MobileMenu className="mobile-menu-app" sections={[{ links }]} />
|
||||||
</header>
|
</header>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,14 @@ export const loadCelebrity = cache(async (slug: string): Promise<PublicCelebrity
|
|||||||
const res = await fetch(`${BACKEND_URL}/v1/public/celebrities/${slug}`, {
|
const res = await fetch(`${BACKEND_URL}/v1/public/celebrities/${slug}`, {
|
||||||
next: { revalidate: 300, tags: [CELEBRITIES_TAG] },
|
next: { revalidate: 300, tags: [CELEBRITIES_TAG] },
|
||||||
});
|
});
|
||||||
if (res.ok) return (await res.json()) as PublicCelebrity;
|
if (res.ok) {
|
||||||
|
const c = (await res.json()) as PublicCelebrity;
|
||||||
|
if (c.analysis) return c;
|
||||||
|
// The portrait is still being written (the worker does not clear the
|
||||||
|
// cache when it is done): no cached copy until it is there.
|
||||||
|
const fresh = await fetch(`${BACKEND_URL}/v1/public/celebrities/${slug}`, { cache: "no-store" });
|
||||||
|
return fresh.ok ? ((await fresh.json()) as PublicCelebrity) : c;
|
||||||
|
}
|
||||||
if (res.status !== 404) throw new Error(`celebrity ${slug}: HTTP ${res.status}`);
|
if (res.status !== 404) throw new Error(`celebrity ${slug}: HTTP ${res.status}`);
|
||||||
const token = (await cookies()).get(SESSION_COOKIE)?.value;
|
const token = (await cookies()).get(SESSION_COOKIE)?.value;
|
||||||
if (!token) return null;
|
if (!token) return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user