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 (
);
}
export function Logo() {
return (
sorsfonalak
);
}
/**
* 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 (
);
}
/** 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 (
{name}
{detail && {detail}}
);
}
/** 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 (
{sky &&
}
0}
replies={me.feedback_replies_unseen ?? 0}
/>
: 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] },
]}
/>
);
}